public class DefaultServerConnection extends java.lang.Object implements Connection, AsyncConnection
| Constructor and Description |
|---|
DefaultServerConnection(InternalConnection wrapped,
ProtocolExecutor protocolExecutor,
ClusterConnectionMode clusterConnectionMode) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
command(java.lang.String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder)
Execute the command.
|
<T> T |
command(java.lang.String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext)
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)
Executes the command, consuming as much of the
SplittablePayload as possible. |
<T> void |
commandAsync(java.lang.String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder,
SingleResultCallback<T> callback)
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)
Executes the command, consuming as much of the
SplittablePayload as possible. |
<T> void |
commandAsync(java.lang.String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext,
SingleResultCallback<T> callback)
Execute the command.
|
WriteConcernResult |
delete(MongoNamespace namespace,
boolean ordered,
DeleteRequest deleteRequest)
Delete the documents using the delete wire protocol and apply the write concern.
|
void |
deleteAsync(MongoNamespace namespace,
boolean ordered,
DeleteRequest deleteRequest,
SingleResultCallback<WriteConcernResult> callback)
Delete the documents using the delete wire protocol and apply the write concern asynchronously.
|
int |
getCount()
Gets the current reference count, which starts at 0.
|
ConnectionDescription |
getDescription()
Gets the description of the connection.
|
<T> QueryResult<T> |
getMore(MongoNamespace namespace,
long cursorId,
int numberToReturn,
Decoder<T> resultDecoder)
Get more result documents from a cursor.
|
<T> void |
getMoreAsync(MongoNamespace namespace,
long cursorId,
int numberToReturn,
Decoder<T> resultDecoder,
SingleResultCallback<QueryResult<T>> callback)
Get more result documents from a cursor asynchronously.
|
WriteConcernResult |
insert(MongoNamespace namespace,
boolean ordered,
InsertRequest insertRequest)
Insert the documents using the insert wire protocol and apply the write concern.
|
void |
insertAsync(MongoNamespace namespace,
boolean ordered,
InsertRequest insertRequest,
SingleResultCallback<WriteConcernResult> callback)
Insert the documents using the insert wire protocol and apply the write concern asynchronously.
|
void |
killCursor(java.util.List<java.lang.Long> cursors)
Kills the given list of cursors.
|
void |
killCursor(MongoNamespace namespace,
java.util.List<java.lang.Long> cursors)
Kills the given list of cursors.
|
void |
killCursorAsync(java.util.List<java.lang.Long> cursors,
SingleResultCallback<java.lang.Void> callback)
Asynchronously Kills the given list of cursors.
|
void |
killCursorAsync(MongoNamespace namespace,
java.util.List<java.lang.Long> cursors,
SingleResultCallback<java.lang.Void> callback)
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)
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)
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)
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)
Execute the query asynchronously.
|
void |
release()
Release a reference to this object.
|
DefaultServerConnection |
retain()
Retain an additional reference to this object.
|
WriteConcernResult |
update(MongoNamespace namespace,
boolean ordered,
UpdateRequest updateRequest)
Update the documents using the update wire protocol and apply the write concern.
|
void |
updateAsync(MongoNamespace namespace,
boolean ordered,
UpdateRequest updateRequest,
SingleResultCallback<WriteConcernResult> callback)
Update the documents using the update wire protocol and apply the write concern asynchronously.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCountpublic DefaultServerConnection(InternalConnection wrapped, ProtocolExecutor protocolExecutor, ClusterConnectionMode clusterConnectionMode)
public DefaultServerConnection retain()
ReferenceCountedretain in interface ReferenceCountedretain in interface AsyncConnectionretain in interface Connectionpublic void release()
ReferenceCountedrelease in interface ReferenceCountedpublic ConnectionDescription getDescription()
ConnectiongetDescription in interface AsyncConnectiongetDescription in interface Connectionpublic WriteConcernResult insert(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest)
Connectioninsert in interface Connectionnamespace - the namespaceordered - whether the writes are orderedinsertRequest - the insert requestpublic void insertAsync(MongoNamespace namespace, boolean ordered, InsertRequest insertRequest, SingleResultCallback<WriteConcernResult> callback)
AsyncConnectioninsertAsync in interface AsyncConnectionnamespace - the namespaceordered - whether the writes are orderedinsertRequest - the insert requestcallback - the callback to be passed the write resultpublic WriteConcernResult update(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest)
Connectionupdate in interface Connectionnamespace - the namespaceordered - whether the writes are orderedupdateRequest - the update requestpublic void updateAsync(MongoNamespace namespace, boolean ordered, UpdateRequest updateRequest, SingleResultCallback<WriteConcernResult> callback)
AsyncConnectionupdateAsync in interface AsyncConnectionnamespace - the namespaceordered - whether the writes are orderedupdateRequest - the update requestcallback - the callback to be passed the write resultpublic WriteConcernResult delete(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest)
Connectiondelete in interface Connectionnamespace - the namespaceordered - whether the writes are ordereddeleteRequest - the delete requestpublic void deleteAsync(MongoNamespace namespace, boolean ordered, DeleteRequest deleteRequest, SingleResultCallback<WriteConcernResult> callback)
AsyncConnectiondeleteAsync in interface AsyncConnectionnamespace - the namespaceordered - whether the writes are ordereddeleteRequest - the delete requestcallback - the callback to be passed the write resultpublic <T> T command(java.lang.String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder)
Connectioncommand in interface ConnectionT - the type of the resultdatabase - 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 resultpublic <T> T command(java.lang.String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext)
Connectioncommand in interface ConnectionT - the type of the resultdatabase - 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 contextpublic <T> T command(java.lang.String database,
BsonDocument command,
FieldNameValidator commandFieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext,
boolean responseExpected,
SplittablePayload payload,
FieldNameValidator payloadFieldNameValidator)
ConnectionSplittablePayload as possible.command in interface ConnectionT - the type of the resultdatabase - 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 documentspublic <T> void commandAsync(java.lang.String database,
BsonDocument command,
boolean slaveOk,
FieldNameValidator fieldNameValidator,
Decoder<T> commandResultDecoder,
SingleResultCallback<T> callback)
AsyncConnectioncommandAsync in interface AsyncConnectionT - the type of the resultdatabase - 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 resultpublic <T> void commandAsync(java.lang.String database,
BsonDocument command,
FieldNameValidator fieldNameValidator,
ReadPreference readPreference,
Decoder<T> commandResultDecoder,
SessionContext sessionContext,
SingleResultCallback<T> callback)
AsyncConnectioncommandAsync in interface AsyncConnectionT - the type of the resultdatabase - 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 resultpublic <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)
AsyncConnectionSplittablePayload as possible.commandAsync in interface AsyncConnectionT - the type of the resultdatabase - 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 resultpublic <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)
Connectionquery in interface ConnectionT - the query result document typenamespace - 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 documentspublic <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)
Connectionquery in interface ConnectionT - the query result document typenamespace - 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 documentspublic <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)
AsyncConnectionqueryAsync in interface AsyncConnectionT - the query result document typenamespace - 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 resultpublic <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)
AsyncConnectionqueryAsync in interface AsyncConnectionT - the query result document typenamespace - 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 resultpublic <T> QueryResult<T> getMore(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder)
ConnectiongetMore in interface ConnectionT - the type of the query result documentsnamespace - the namespace to get more documents fromcursorId - the cursor idnumberToReturn - the number of documents to returnresultDecoder - the decoder for the query resultspublic <T> void getMoreAsync(MongoNamespace namespace, long cursorId, int numberToReturn, Decoder<T> resultDecoder, SingleResultCallback<QueryResult<T>> callback)
AsyncConnectiongetMoreAsync in interface AsyncConnectionT - the type of the query result documentsnamespace - 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 resultpublic void killCursor(java.util.List<java.lang.Long> cursors)
ConnectionkillCursor in interface Connectioncursors - the cursorspublic void killCursor(MongoNamespace namespace, java.util.List<java.lang.Long> cursors)
ConnectionkillCursor in interface Connectionnamespace - the namespace to in which the cursors livecursors - the cursorspublic void killCursorAsync(java.util.List<java.lang.Long> cursors,
SingleResultCallback<java.lang.Void> callback)
AsyncConnectionkillCursorAsync in interface AsyncConnectioncursors - the cursorscallback - the callback that is called once the cursors have been killedpublic void killCursorAsync(MongoNamespace namespace, java.util.List<java.lang.Long> cursors, SingleResultCallback<java.lang.Void> callback)
AsyncConnectionkillCursorAsync in interface AsyncConnectionnamespace - the namespace in which the cursors livecursors - the cursorscallback - the callback that is called once the cursors have been killedpublic int getCount()
ReferenceCountedgetCount in interface ReferenceCountedCopyright © 2010 - 2023 Adobe. All Rights Reserved