public class SerialClientImpl extends AbstractClient
ClientImpl
to always try to use the same
connection.Modifier and Type | Field and Description |
---|---|
protected static boolean |
ASSERTIONS_ENABLED
If true then assertions have been enabled for the class.
|
MAX_DOCUMENT_SIZE
Constructor and Description |
---|
SerialClientImpl(ClientImpl client)
Create a new SerialClientImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the client.
|
protected Connection |
findConnection(Message message1,
Message message2)
Tries to reuse the last connection used.
|
ClusterStats |
getClusterStats()
Returns the meta-data on the current cluster.
|
ClusterType |
getClusterType()
Returns the type of cluster the client is connected to.
|
MongoClientConfiguration |
getConfig()
Returns the configuration being used by the logical MongoDB connection.
|
Durability |
getDefaultDurability()
Returns the
Durability from the MongoClientConfiguration . |
ReadPreference |
getDefaultReadPreference()
Returns the
ReadPreference from the
MongoClientConfiguration . |
MongoIterator<Document> |
restart(DocumentAssignable cursorDocument)
Restarts an iterator that was previously saved.
|
MongoCursorControl |
restart(StreamCallback<Document> results,
DocumentAssignable cursorDocument)
Restarts a document stream from a cursor that was previously saved.
|
send, send
protected static final boolean ASSERTIONS_ENABLED
public SerialClientImpl(ClientImpl client)
client
- The delegate client for accessing connections.public void close()
Overridden to close all of the open connections.
Overridden to close all of the open connections.
close
in interface Client
close
in class AbstractClient
Closeable.close()
public ClusterStats getClusterStats()
Overridden to return the cluster stats from the delegate client.
public ClusterType getClusterType()
Overridden to return the ClusterType
of delegate
ClientImpl
.
public MongoClientConfiguration getConfig()
Overridden to return the configuration used when the client was constructed.
public Durability getDefaultDurability()
Durability
from the MongoClientConfiguration
.
Overridden to return the configurations default durability.
MongoClientConfiguration
.Client.getDefaultDurability()
public ReadPreference getDefaultReadPreference()
ReadPreference
from the
MongoClientConfiguration
.
Overridden to return the configurations default read preference.
MongoClientConfiguration
.Client.getDefaultReadPreference()
public MongoIterator<Document> restart(DocumentAssignable cursorDocument) throws IllegalArgumentException
Overridden to forward to the delegate client.
cursorDocument
- The document containing the state of the cursor.IllegalArgumentException
- If the document does not contain a valid cursor state.Client.restart(DocumentAssignable)
public MongoCursorControl restart(StreamCallback<Document> results, DocumentAssignable cursorDocument) throws IllegalArgumentException
Overridden to forward to the delegate client.
results
- Callback that will be notified of the results of the cursor.cursorDocument
- The document containing the state of the cursor.MongoCursorControl
to control the cursor streaming
documents to the caller. This includes the ability to stop the
cursor and persist its state.IllegalArgumentException
- If the document does not contain a valid cursor state.Client.restart(StreamCallback, DocumentAssignable)
protected Connection findConnection(Message message1, Message message2) throws MongoDbException
ClientImpl
and the result cached for future requests.findConnection
in class AbstractClient
message1
- The first message that will be sent. The connection return
should be compatible with all of the messages
ReadPreference
.message2
- The second message that will be sent. The connection return
should be compatible with all of the messages
ReadPreference
. May be null
.MongoDbException
- On a failure to talk to the MongoDB servers.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.