Package org.apache.thrift.async
Class TAsyncMethodCall<T>
- java.lang.Object
-
- org.apache.thrift.async.TAsyncMethodCall<T>
-
- Type Parameters:
T-
public abstract class TAsyncMethodCall<T> extends java.lang.ObjectEncapsulates an async method call Need to generate: - private void write_args(TProtocol protocol) - public T getResult() throws, , ...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTAsyncMethodCall.State
-
Field Summary
Fields Modifier and Type Field Description protected TAsyncClientclientprotected TNonblockingTransporttransport
-
Constructor Summary
Constructors Modifier Constructor Description protectedTAsyncMethodCall(TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport, AsyncMethodCallback<T> callback, boolean isOneway)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TAsyncClientgetClient()protected java.nio.ByteBuffergetFrameBuffer()protected longgetSequenceId()protected longgetStartTime()protected TAsyncMethodCall.StategetState()longgetTimeoutTimestamp()booleanhasTimeout()protected booleanisFinished()protected voidonError(java.lang.Exception e)protected voidprepareMethodCall()Initialize buffers.protected voidtransition(java.nio.channels.SelectionKey key)Transition to next state, doing whatever work is required.protected abstract voidwrite_args(TProtocol protocol)
-
-
-
Field Detail
-
transport
protected final TNonblockingTransport transport
-
client
protected final TAsyncClient client
-
-
Constructor Detail
-
TAsyncMethodCall
protected TAsyncMethodCall(TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport, AsyncMethodCallback<T> callback, boolean isOneway)
-
-
Method Detail
-
getState
protected TAsyncMethodCall.State getState()
-
isFinished
protected boolean isFinished()
-
getStartTime
protected long getStartTime()
-
getSequenceId
protected long getSequenceId()
-
getClient
public TAsyncClient getClient()
-
hasTimeout
public boolean hasTimeout()
-
getTimeoutTimestamp
public long getTimeoutTimestamp()
-
write_args
protected abstract void write_args(TProtocol protocol) throws TException
- Throws:
TException
-
prepareMethodCall
protected void prepareMethodCall() throws TExceptionInitialize buffers.- Throws:
TException- if buffer initialization fails
-
getFrameBuffer
protected java.nio.ByteBuffer getFrameBuffer()
-
transition
protected void transition(java.nio.channels.SelectionKey key)
Transition to next state, doing whatever work is required. Since this method is only called by the selector thread, we can make changes to our select interests without worrying about concurrency.- Parameters:
key-
-
onError
protected void onError(java.lang.Exception e)
-
-