2929
3030import static com .mongodb .assertions .Assertions .notNull ;
3131import static com .mongodb .operation .CursorHelper .getNumberToReturn ;
32- import static java .util .Arrays . asList ;
32+ import static java .util .Collections . singletonList ;
3333
3434class 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