public final class MultipleCursorCallback extends AbstractReplyCallback<Collection<MongoIterator<Document>>> implements AddressAware
ERROR_CODE_FIELD, ERROR_MESSAGE_FIELDS
Constructor and Description |
---|
MultipleCursorCallback(Client client,
CursorableMessage message,
Callback<Collection<MongoIterator<Document>>> results)
Create a new CursorCallback.
|
Modifier and Type | Method and Description |
---|---|
protected MongoDbException |
asError(Reply reply,
int okValue,
int errorNumber,
String errorMessage)
Creates an exception from the parsed reply fields.
|
protected Collection<MongoIterator<Document>> |
convert(Reply reply)
Converts the
Reply into the final response type. |
String |
getAddress()
Returns the server the original request was sent to.
|
protected void |
handle(Reply reply)
Called once the
Reply has been validated. |
void |
setAddress(String address)
Sets the value of the server the original request was sent to.
|
exception, getForwardCallback, isLightWeight
asError, asError, asError, asString, callback, checkForError, toInt, verify
public MultipleCursorCallback(Client client, CursorableMessage message, Callback<Collection<MongoIterator<Document>>> results)
client
- The client interface to the server.message
- The original query.results
- The callback to update once the first set of results are
ready.public String getAddress()
public void setAddress(String address)
setAddress
in interface AddressAware
address
- The new value for the server the original request was sent to.protected MongoDbException asError(Reply reply, int okValue, int errorNumber, String errorMessage)
Overridden to add the Query
to the exception.
asError
in class AbstractValidatingReplyCallback
reply
- The raw reply.okValue
- The 'ok' field.errorNumber
- The 'errno' field.errorMessage
- The 'errmsg' field.AbstractValidatingReplyCallback.asError(Reply, int, int, String)
protected Collection<MongoIterator<Document>> convert(Reply reply) throws MongoDbException
Reply
into the final response type.
Overridden to construct a MongoIteratorImpl
around the reply.
convert
in class AbstractReplyCallback<Collection<MongoIterator<Document>>>
reply
- The reply to convert.MongoDbException
- On a failure converting the reply. Generally, the
AbstractValidatingReplyCallback.verify(Reply)
method should be used to report
errors.AbstractReplyCallback.convert(Reply)
protected void handle(Reply reply)
Reply
has been validated.
Overriden to convert
and then pass the converted
reply to the forward callback
.
Overridden to check if the server address has been set and if so then
pass the converted reply to the forward
callback
. Otherwise the call is dropped.
handle
in class AbstractReplyCallback<Collection<MongoIterator<Document>>>
reply
- The Reply
to be handled.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.