Skip to content

Commit 2cfbfc3

Browse files
committed
Simplify AsyncCryptConnectionSource reference counting
Fixes Coverity error about missing call to superclass method
1 parent 4ea1415 commit 2cfbfc3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

driver-async/src/main/com/mongodb/async/client/internal/AsyncCryptBinding.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.mongodb.connection.AsyncConnection;
2424
import com.mongodb.connection.Cluster;
2525
import com.mongodb.connection.ServerDescription;
26-
import com.mongodb.internal.binding.AbstractReferenceCounted;
2726
import com.mongodb.internal.binding.AsyncClusterAwareReadWriteBinding;
2827
import com.mongodb.session.SessionContext;
2928

@@ -95,7 +94,7 @@ public Cluster getCluster() {
9594
return wrapped.getCluster();
9695
}
9796

98-
private class AsyncCryptConnectionSource extends AbstractReferenceCounted implements AsyncConnectionSource {
97+
private class AsyncCryptConnectionSource implements AsyncConnectionSource {
9998
private final AsyncConnectionSource wrapped;
10099

101100
AsyncCryptConnectionSource(final AsyncConnectionSource wrapped) {
@@ -127,6 +126,11 @@ public void onResult(final AsyncConnection result, final Throwable t) {
127126
});
128127
}
129128

129+
@Override
130+
public int getCount() {
131+
return wrapped.getCount();
132+
}
133+
130134
@Override
131135
public AsyncConnectionSource retain() {
132136
wrapped.retain();
@@ -136,9 +140,6 @@ public AsyncConnectionSource retain() {
136140
@Override
137141
public void release() {
138142
wrapped.release();
139-
if (wrapped.getCount() == 0) {
140-
AsyncCryptBinding.this.release();
141-
}
142143
}
143144
}
144145
}

0 commit comments

Comments
 (0)