|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvoldemort.store.socket.clientrequest.BlockingClientRequest<T>
T - Type of data that is returned by the requestpublic class BlockingClientRequest<T>
BlockingClientRequest is used to implement blocking IO using the non-blocking
IO-based ClientRequest logic. Essentially it wraps a vanilla
ClientRequest and adds an method on which the caller will
wait for completion (either success or failure).
| Constructor Summary | |
|---|---|
BlockingClientRequest(ClientRequest<T> delegate,
long timeoutMs)
|
|
| Method Summary | |
|---|---|
boolean |
await()
|
void |
complete()
Called by the ClientRequestExecutor once all the processing
(normal or abnormal) has occurred on the ClientRequest object. |
boolean |
formatRequest(java.io.DataOutputStream outputStream)
This eventually calls into a nested RequestFormat instance's
writeXxx method. |
T |
getResult()
Once completed has been called, this will return the result of the request or thrown an error if the request wasn't completed. |
boolean |
isComplete()
Returns true if ClientRequest.complete() was called. |
boolean |
isCompleteResponse(java.nio.ByteBuffer buffer)
isCompleteResponse determines if the response that the ClientRequestExecutor's received thus far is inclusive of the
entire response. |
boolean |
isTimedOut()
Returns true if ClientRequestExecutor timed out. |
void |
parseResponse(java.io.DataInputStream inputStream)
Parses the response from the server to turn it into a result. |
void |
timeOut()
Called by the ClientRequestExecutor after it has timed out. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockingClientRequest(ClientRequest<T> delegate,
long timeoutMs)
| Method Detail |
|---|
public void complete()
ClientRequestClientRequestExecutor once all the processing
(normal or abnormal) has occurred on the ClientRequest object.
This exists mainly to implement blocking operations whereby we need to
have a mechanism to unblock the caller waiting for the response.
This is used internally by the ClientRequest logic and should not
be invoked by users of the sub-system.
complete in interface ClientRequest<T>public boolean isComplete()
ClientRequesttrue if ClientRequest.complete() was called.
isComplete in interface ClientRequest<T>true if completed, false otherwise
public boolean await()
throws java.lang.InterruptedException
java.lang.InterruptedException
public T getResult()
throws VoldemortException,
java.io.IOException
ClientRequest
getResult in interface ClientRequest<T>VoldemortException
java.io.IOExceptionpublic boolean isCompleteResponse(java.nio.ByteBuffer buffer)
ClientRequestClientRequestExecutor's received thus far is inclusive of the
entire response. This relies on the RequestFormat instance's
isCompleteXxxResponse methods.
This is used internally by the ClientRequest logic and should not
be invoked by users of the sub-system.
isCompleteResponse in interface ClientRequest<T>buffer - ByteBuffer containing the data received thus far
public void parseResponse(java.io.DataInputStream inputStream)
ClientRequestClientRequest.getResult() is called.
This is used internally by the ClientRequest logic and should not
be invoked by users of the sub-system.
parseResponse in interface ClientRequest<T>inputStream - InputStream from which to read the responsepublic boolean formatRequest(java.io.DataOutputStream outputStream)
ClientRequestRequestFormat instance's
writeXxx method. The ClientRequest actually buffers all I/O, so the data
written via formatRequest is actually inserted into a ByteBuffer
which is later sent over the wire to the server.
This is used internally by the ClientRequest logic and should not
be invoked by users of the sub-system.
formatRequest in interface ClientRequest<T>outputStream - Write the request to this output streampublic void timeOut()
ClientRequestClientRequestExecutor after it has timed out. This
is different from the complete call, since the timeout event needs to be
notified to the caller in a special way.
This is used internally by the ClientRequest logic and should not
be invoked by users of the sub-system.
timeOut in interface ClientRequest<T>public boolean isTimedOut()
ClientRequesttrue if ClientRequestExecutor timed out.
isTimedOut in interface ClientRequest<T>true if timed out, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||