public abstract class AbstractClient extends Object implements Client
Client
implementations.MAX_DOCUMENT_SIZE
Constructor and Description |
---|
AbstractClient()
Creates a new AbstractClient.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the client.
|
protected abstract Connection |
findConnection(Message message1,
Message message2)
Locates a
Connection to send a message on. |
void |
send(Message message1,
Message message2,
ReplyCallback replyCallback)
Sends a message on the connection.
|
void |
send(Message message,
ReplyCallback replyCallback)
Sends a message on the connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClusterStats, getClusterType, getConfig, getDefaultDurability, getDefaultReadPreference, restart, restart
public void close()
Overridden to close all of the open connections.
close
in interface Client
Closeable.close()
public void send(Message message1, Message message2, ReplyCallback replyCallback) throws MongoDbException
Overridden to locate the a connection to send the messages and then forward the messages to that connection.
send
in interface Client
message1
- The first message to send on the connection.message2
- The second message to send on the connection.replyCallback
- The callback to notify of responses to the message2
.
May be null
.MongoDbException
- On an error sending the message.public void send(Message message, ReplyCallback replyCallback) throws MongoDbException
Overridden to locate the a connection to send the message and then forward the message to that connection.
send
in interface Client
message
- The message to send on the connection.replyCallback
- The callback to notify of responses to the messages. May be
null
.MongoDbException
- On an error sending the message.protected abstract Connection findConnection(Message message1, Message message2) throws MongoDbException
Connection
to send a message on.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
.Connection
to send a message on.MongoDbException
- In the case of an error finding a Connection
.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.