Skip to content

Commit dbc8ec3

Browse files
committed
Refactorings to clean up a few warnings.
1 parent 8e29a8d commit dbc8ec3

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

driver-core/src/main/com/mongodb/operation/OperationHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static <T> QueryBatchCursor<T> createEmptyBatchCursor(final MongoNamespace names
7777
final ServerAddress serverAddress, final int batchSize) {
7878
return new QueryBatchCursor<T>(new QueryResult<T>(namespace, Collections.<T>emptyList(), 0L,
7979
serverAddress),
80-
0, batchSize, decoder, serverAddress);
80+
0, batchSize, decoder);
8181
}
8282

8383
static <T> AsyncBatchCursor<T> createEmptyAsyncBatchCursor(final MongoNamespace namespace, final Decoder<T> decoder,
@@ -225,7 +225,7 @@ public void onResult(final AsyncConnectionSource source, final Throwable t) {
225225
}
226226
}
227227

228-
private static <T> void withConnectionSource(final AsyncConnectionSource source, final AsyncCallableWithConnection callable) {
228+
private static void withConnectionSource(final AsyncConnectionSource source, final AsyncCallableWithConnection callable) {
229229
source.getConnection(new SingleResultCallback<AsyncConnection>() {
230230
@Override
231231
public void onResult(final AsyncConnection connection, final Throwable t) {
@@ -239,7 +239,7 @@ public void onResult(final AsyncConnection connection, final Throwable t) {
239239
});
240240
}
241241

242-
private static <T> void withConnectionSource(final AsyncConnectionSource source, final AsyncCallableWithConnectionAndSource callable) {
242+
private static void withConnectionSource(final AsyncConnectionSource source, final AsyncCallableWithConnectionAndSource callable) {
243243
source.getConnection(new SingleResultCallback<AsyncConnection>() {
244244
@Override
245245
public void onResult(final AsyncConnection result, final Throwable t) {

driver-core/src/main/com/mongodb/operation/QueryBatchCursor.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@
2929

3030
import static com.mongodb.assertions.Assertions.notNull;
3131
import static com.mongodb.operation.CursorHelper.getNumberToReturn;
32-
import static java.util.Arrays.asList;
32+
import static java.util.Collections.singletonList;
3333

3434
class QueryBatchCursor<T> implements BatchCursor<T> {
3535
private final MongoNamespace namespace;
3636
private final int limit;
37-
private final ServerAddress serverAddress;
3837
private final Decoder<T> decoder;
3938
private final ConnectionSource connectionSource;
4039
private int batchSize;
@@ -44,23 +43,16 @@ class QueryBatchCursor<T> implements BatchCursor<T> {
4443
private int count;
4544
private boolean closed;
4645

47-
QueryBatchCursor(final QueryResult<T> firstQueryResult, final int limit, final int batchSize,
48-
final Decoder<T> decoder, final ServerAddress serverAddress) {
49-
this(firstQueryResult, limit, batchSize, decoder, (ConnectionSource) null, serverAddress);
46+
QueryBatchCursor(final QueryResult<T> firstQueryResult, final int limit, final int batchSize, final Decoder<T> decoder) {
47+
this(firstQueryResult, limit, batchSize, decoder, (ConnectionSource) null);
5048
}
5149

5250
QueryBatchCursor(final QueryResult<T> firstQueryResult, final int limit, final int batchSize,
5351
final Decoder<T> decoder, final ConnectionSource connectionSource) {
54-
this(firstQueryResult, limit, batchSize, decoder, connectionSource, connectionSource.getServerDescription().getAddress());
55-
}
56-
57-
QueryBatchCursor(final QueryResult<T> firstQueryResult, final int limit, final int batchSize,
58-
final Decoder<T> decoder, final ConnectionSource connectionSource, final ServerAddress serverAddress) {
5952
this.namespace = firstQueryResult.getNamespace();
6053
this.limit = limit;
6154
this.batchSize = batchSize;
6255
this.decoder = notNull("decoder", decoder);
63-
this.serverAddress = notNull("serverAddress", serverAddress);
6456
if (firstQueryResult.getCursor() != null) {
6557
notNull("connectionSource", connectionSource);
6658
}
@@ -230,7 +222,7 @@ private void killCursor() {
230222

231223
private void killCursor(final Connection connection) {
232224
if (serverCursor != null && !killed) {
233-
connection.killCursor(asList(serverCursor.getId()));
225+
connection.killCursor(singletonList(serverCursor.getId()));
234226
killed = true;
235227
}
236228
}

0 commit comments

Comments
 (0)