Package com.mongodb.internal.connection
Class DefaultServerConnection
- java.lang.Object
-
- com.mongodb.internal.connection.DefaultServerConnection
-
- All Implemented Interfaces:
ReferenceCounted
,AsyncConnection
,Connection
@Deprecated(since="2021-05-27") public class DefaultServerConnection extends java.lang.Object implements Connection, AsyncConnection
Deprecated.
-
-
Constructor Summary
Constructors Constructor Description DefaultServerConnection(InternalConnection wrapped, ProtocolExecutor protocolExecutor, ClusterConnectionMode clusterConnectionMode)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> T
command(java.lang.String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
Deprecated.Execute the command.<T> T
command(java.lang.String database, BsonDocument command, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext)
Deprecated.Execute the command.<T> T
command(java.lang.String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator)
Deprecated.Executes the command, consuming as much of theSplittablePayload
as possible.<T> void
commandAsync(java.lang.String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder, SingleResultCallback<T> callback)
Deprecated.Execute the command asynchronously.<T> void
commandAsync(java.lang.String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator, SingleResultCallback<T> callback)
Deprecated.Executes the command, consuming as much of theSplittablePayload
as possible.<T> void
commandAsync(java.lang.String database, BsonDocument command, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, SingleResultCallback<T> callback)
Deprecated.Execute the command.WriteConcernResult
delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
Deprecated.Delete the documents using the delete wire protocol and apply the write concern.void
deleteAsync(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Delete the documents using the delete wire protocol and apply the write concern asynchronously.int
getCount()
Deprecated.Gets the current reference count, which starts at 0.ConnectionDescription
getDescription()
Deprecated.Gets the description of the connection.<T> QueryResult<T>
getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
Deprecated.Get more result documents from a cursor.<T> void
getMoreAsync(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Get more result documents from a cursor asynchronously.WriteConcernResult
insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
Deprecated.Insert the documents using the insert wire protocol and apply the write concern.void
insertAsync(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Insert the documents using the insert wire protocol and apply the write concern asynchronously.void
killCursor(MongoNamespace namespace, java.util.List<java.lang.Long> cursors)
Deprecated.Kills the given list of cursors.void
killCursor(java.util.List<java.lang.Long> cursors)
Deprecated.Kills the given list of cursors.void
killCursorAsync(MongoNamespace namespace, java.util.List<java.lang.Long> cursors, SingleResultCallback<java.lang.Void> callback)
Deprecated.Asynchronously Kills the given list of cursors.void
killCursorAsync(java.util.List<java.lang.Long> cursors, SingleResultCallback<java.lang.Void> callback)
Deprecated.Asynchronously Kills the given list of cursors.<T> QueryResult<T>
query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int numberToReturn, int skip, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
Deprecated.Execute the query.<T> QueryResult<T>
query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int skip, int limit, int batchSize, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
Deprecated.Execute the query.<T> void
queryAsync(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int numberToReturn, int skip, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Execute the query asynchronously.<T> void
queryAsync(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int skip, int limit, int batchSize, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Execute the query asynchronously.void
release()
Deprecated.Release a reference to this object.DefaultServerConnection
retain()
Deprecated.Retain an additional reference to this object.WriteConcernResult
update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
Deprecated.Update the documents using the update wire protocol and apply the write concern.void
updateAsync(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Update the documents using the update wire protocol and apply the write concern asynchronously.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.mongodb.binding.ReferenceCounted
getCount
-
-
-
-
Constructor Detail
-
DefaultServerConnection
public DefaultServerConnection(InternalConnection wrapped, ProtocolExecutor protocolExecutor, ClusterConnectionMode clusterConnectionMode)
Deprecated.
-
-
Method Detail
-
retain
public DefaultServerConnection retain()
Deprecated.Description copied from interface:ReferenceCounted
Retain an additional reference to this object. All retained references must be released, or there will be a leak.- Specified by:
retain
in interfaceAsyncConnection
- Specified by:
retain
in interfaceConnection
- Specified by:
retain
in interfaceReferenceCounted
- Returns:
- this
-
release
public void release()
Deprecated.Description copied from interface:ReferenceCounted
Release a reference to this object.- Specified by:
release
in interfaceReferenceCounted
-
getDescription
public ConnectionDescription getDescription()
Deprecated.Description copied from interface:Connection
Gets the description of the connection.- Specified by:
getDescription
in interfaceAsyncConnection
- Specified by:
getDescription
in interfaceConnection
- Returns:
- the connection description
-
insert
public WriteConcernResult insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
Deprecated.Description copied from interface:Connection
Insert the documents using the insert wire protocol and apply the write concern.- Specified by:
insert
in interfaceConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedinsertRequest
- the insert request- Returns:
- the write concern result
-
insertAsync
public void insertAsync(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Description copied from interface:AsyncConnection
Insert the documents using the insert wire protocol and apply the write concern asynchronously.- Specified by:
insertAsync
in interfaceAsyncConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedinsertRequest
- the insert requestcallback
- the callback to be passed the write result
-
update
public WriteConcernResult update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
Deprecated.Description copied from interface:Connection
Update the documents using the update wire protocol and apply the write concern.- Specified by:
update
in interfaceConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedupdateRequest
- the update request- Returns:
- the write concern result
-
updateAsync
public void updateAsync(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Description copied from interface:AsyncConnection
Update the documents using the update wire protocol and apply the write concern asynchronously.- Specified by:
updateAsync
in interfaceAsyncConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are orderedupdateRequest
- the update requestcallback
- the callback to be passed the write result
-
delete
public WriteConcernResult delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
Deprecated.Description copied from interface:Connection
Delete the documents using the delete wire protocol and apply the write concern.- Specified by:
delete
in interfaceConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are ordereddeleteRequest
- the delete request- Returns:
- the write concern result
-
deleteAsync
public void deleteAsync(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest, SingleResultCallback<WriteConcernResult> callback)
Deprecated.Description copied from interface:AsyncConnection
Delete the documents using the delete wire protocol and apply the write concern asynchronously.- Specified by:
deleteAsync
in interfaceAsyncConnection
- Parameters:
namespace
- the namespaceordered
- whether the writes are ordereddeleteRequest
- the delete requestcallback
- the callback to be passed the write result
-
command
public <T> T command(java.lang.String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder)
Deprecated.Description copied from interface:Connection
Execute the command.- Specified by:
command
in interfaceConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentslaveOk
- whether the command can run on a secondaryfieldNameValidator
- the field name validator for the command documentcommandResultDecoder
- the decoder for the result- Returns:
- the command result
-
command
public <T> T command(java.lang.String database, BsonDocument command, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext)
Deprecated.Description copied from interface:Connection
Execute the command.- Specified by:
command
in interfaceConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentfieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session context- Returns:
- the command result
-
command
public <T> T command(java.lang.String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator)
Deprecated.Description copied from interface:Connection
Executes the command, consuming as much of theSplittablePayload
as possible.- Specified by:
command
in interfaceConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentcommandFieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session contextresponseExpected
- true if a response from the server is expectedpayload
- the splittable payload to incorporate with the commandpayloadFieldNameValidator
- the field name validator for the payload documents- Returns:
- the command result
-
commandAsync
public <T> void commandAsync(java.lang.String database, BsonDocument command, boolean slaveOk, FieldNameValidator fieldNameValidator, Decoder<T> commandResultDecoder, SingleResultCallback<T> callback)
Deprecated.Description copied from interface:AsyncConnection
Execute the command asynchronously.- Specified by:
commandAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentslaveOk
- whether the command can run on a secondaryfieldNameValidator
- the field name validator for the command documentcommandResultDecoder
- the decoder for the resultcallback
- the callback to be passed the command result
-
commandAsync
public <T> void commandAsync(java.lang.String database, BsonDocument command, FieldNameValidator fieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, SingleResultCallback<T> callback)
Deprecated.Description copied from interface:AsyncConnection
Execute the command.- Specified by:
commandAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentfieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session contextcallback
- the callback to be passed the write result
-
commandAsync
public <T> void commandAsync(java.lang.String database, BsonDocument command, FieldNameValidator commandFieldNameValidator, ReadPreference readPreference, Decoder<T> commandResultDecoder, SessionContext sessionContext, boolean responseExpected, SplittablePayload payload, FieldNameValidator payloadFieldNameValidator, SingleResultCallback<T> callback)
Deprecated.Description copied from interface:AsyncConnection
Executes the command, consuming as much of theSplittablePayload
as possible.- Specified by:
commandAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the type of the result- Parameters:
database
- the database to execute the command incommand
- the command documentcommandFieldNameValidator
- the field name validator for the command documentreadPreference
- the read preference that was applied to get this connection, or null if this is a write operationcommandResultDecoder
- the decoder for the resultsessionContext
- the session contextresponseExpected
- true if a response from the server is expectedpayload
- the splittable payload to incorporate with the commandpayloadFieldNameValidator
- the field name validator for the payload documentscallback
- the callback to be passed the write result
-
query
public <T> QueryResult<T> query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int numberToReturn, int skip, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
Deprecated.Description copied from interface:Connection
Execute the query.- Specified by:
query
in interfaceConnection
- Type Parameters:
T
- the query result document type- Parameters:
namespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludenumberToReturn
- the number of documents to returnskip
- the number of documents to skipslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documents- Returns:
- the query results
-
query
public <T> QueryResult<T> query(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int skip, int limit, int batchSize, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder)
Deprecated.Description copied from interface:Connection
Execute the query.- Specified by:
query
in interfaceConnection
- Type Parameters:
T
- the query result document type- Parameters:
namespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludeskip
- the number of documents to skiplimit
- the maximum number of documents to return in all batchesbatchSize
- the maximum number of documents to return in this batchslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documents- Returns:
- the query results
-
queryAsync
public <T> void queryAsync(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int numberToReturn, int skip, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Description copied from interface:AsyncConnection
Execute the query asynchronously.- Specified by:
queryAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the query result document type- Parameters:
namespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludenumberToReturn
- the number of documents to returnskip
- the number of documents to skipslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documentscallback
- the callback to be passed the write result
-
queryAsync
public <T> void queryAsync(MongoNamespace namespace, BsonDocument queryDocument, BsonDocument fields, int skip, int limit, int batchSize, boolean slaveOk, boolean tailableCursor, boolean awaitData, boolean noCursorTimeout, boolean partial, boolean oplogReplay, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Description copied from interface:AsyncConnection
Execute the query asynchronously.- Specified by:
queryAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the query result document type- Parameters:
namespace
- the namespace to queryqueryDocument
- the query documentfields
- the field to include or excludeskip
- the number of documents to skiplimit
- the maximum number of documents to return in all batchesbatchSize
- the maximum number of documents to return in this batchslaveOk
- whether the query can run on a secondarytailableCursor
- whether to return a tailable cursorawaitData
- whether a tailable cursor should wait before returning if no documents are availablenoCursorTimeout
- whether the cursor should not timeoutpartial
- whether partial results from sharded clusters are acceptableoplogReplay
- whether to replay the oplogresultDecoder
- the decoder for the query result documentscallback
- the callback to be passed the write result
-
getMore
public <T> QueryResult<T> getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
Deprecated.Description copied from interface:Connection
Get more result documents from a cursor.- Specified by:
getMore
in interfaceConnection
- Type Parameters:
T
- the type of the query result documents- Parameters:
namespace
- the namespace to get more documents fromcursorId
- the cursor idnumberToReturn
- the number of documents to returnresultDecoder
- the decoder for the query results- Returns:
- the query results
-
getMoreAsync
public <T> void getMoreAsync(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
Deprecated.Description copied from interface:AsyncConnection
Get more result documents from a cursor asynchronously.- Specified by:
getMoreAsync
in interfaceAsyncConnection
- Type Parameters:
T
- the type of the query result documents- Parameters:
namespace
- the namespace to get more documents fromcursorId
- the cursor idnumberToReturn
- the number of documents to returnresultDecoder
- the decoder for the query result documentscallback
- the callback to be passed the query result
-
killCursor
public void killCursor(java.util.List<java.lang.Long> cursors)
Deprecated.Description copied from interface:Connection
Kills the given list of cursors.- Specified by:
killCursor
in interfaceConnection
- Parameters:
cursors
- the cursors
-
killCursor
public void killCursor(MongoNamespace namespace, java.util.List<java.lang.Long> cursors)
Deprecated.Description copied from interface:Connection
Kills the given list of cursors.- Specified by:
killCursor
in interfaceConnection
- Parameters:
namespace
- the namespace to in which the cursors livecursors
- the cursors
-
killCursorAsync
public void killCursorAsync(java.util.List<java.lang.Long> cursors, SingleResultCallback<java.lang.Void> callback)
Deprecated.Description copied from interface:AsyncConnection
Asynchronously Kills the given list of cursors.- Specified by:
killCursorAsync
in interfaceAsyncConnection
- Parameters:
cursors
- the cursorscallback
- the callback that is called once the cursors have been killed
-
killCursorAsync
public void killCursorAsync(MongoNamespace namespace, java.util.List<java.lang.Long> cursors, SingleResultCallback<java.lang.Void> callback)
Deprecated.Description copied from interface:AsyncConnection
Asynchronously Kills the given list of cursors.- Specified by:
killCursorAsync
in interfaceAsyncConnection
- Parameters:
namespace
- the namespace in which the cursors livecursors
- the cursorscallback
- the callback that is called once the cursors have been killed
-
getCount
public int getCount()
Deprecated.Description copied from interface:ReferenceCounted
Gets the current reference count, which starts at 0.- Specified by:
getCount
in interfaceReferenceCounted
- Returns:
- the current count, which must be greater than or equal to 0
-
-