com.alipay.remoting.rpc
Class DefaultInvokeFuture

java.lang.Object
  extended by com.alipay.remoting.rpc.DefaultInvokeFuture
All Implemented Interfaces:
InvokeFuture

public class DefaultInvokeFuture
extends Object
implements InvokeFuture

The default implementation of InvokeFuture.


Constructor Summary
DefaultInvokeFuture(int invokeId, InvokeCallbackListener callbackListener, InvokeCallback callback, byte protocol, CommandFactory commandFactory)
          Constructor.
DefaultInvokeFuture(int invokeId, InvokeCallbackListener callbackListener, InvokeCallback callback, byte protocol, CommandFactory commandFactory, InvokeContext invokeContext)
           
 
Method Summary
 void addTimeout(io.netty.util.Timeout timeout)
          Add timeout for the future.
 void cancelTimeout()
          Cancel the timeout.
 RemotingCommand createConnectionClosedResponse(InetSocketAddress responseHost)
          Create a remoting command response when connection closed
 void executeInvokeCallback()
          Execute the callback.
 ClassLoader getAppClassLoader()
           
 Throwable getCause()
          Get the cause of exception of the future.
 InvokeCallback getInvokeCallback()
          Get the application callback of the future.
 InvokeContext getInvokeContext()
          get invoke context
 byte getProtocolCode()
          Get the protocol code of command.
 int invokeId()
          Get the id of the invocation.
 boolean isDone()
          Whether the future is done.
 void putResponse(RemotingCommand response)
          Put the response to the future.
 void setCause(Throwable cause)
          Set the cause if exception caught.
 void setInvokeContext(InvokeContext invokeContext)
          set invoke context
 void tryAsyncExecuteInvokeCallbackAbnormally()
          Asynchronous execute the callback abnormally.
 ResponseCommand waitResponse()
          Wait response with unlimit timeout
 ResponseCommand waitResponse(long timeoutMillis)
          Wait response with timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInvokeFuture

public DefaultInvokeFuture(int invokeId,
                           InvokeCallbackListener callbackListener,
                           InvokeCallback callback,
                           byte protocol,
                           CommandFactory commandFactory)
Constructor.

Parameters:
invokeId -
callbackListener -
callback -
protocol -

DefaultInvokeFuture

public DefaultInvokeFuture(int invokeId,
                           InvokeCallbackListener callbackListener,
                           InvokeCallback callback,
                           byte protocol,
                           CommandFactory commandFactory,
                           InvokeContext invokeContext)
Parameters:
invokeId -
callbackListener -
callback -
protocol -
invokeContext -
Method Detail

waitResponse

public ResponseCommand waitResponse(long timeoutMillis)
                             throws InterruptedException
Description copied from interface: InvokeFuture
Wait response with timeout.

Specified by:
waitResponse in interface InvokeFuture
Returns:
Throws:
InterruptedException
See Also:
InvokeFuture.waitResponse(long)

waitResponse

public ResponseCommand waitResponse()
                             throws InterruptedException
Description copied from interface: InvokeFuture
Wait response with unlimit timeout

Specified by:
waitResponse in interface InvokeFuture
Returns:
Throws:
InterruptedException
See Also:
InvokeFuture.waitResponse(long)

createConnectionClosedResponse

public RemotingCommand createConnectionClosedResponse(InetSocketAddress responseHost)
Description copied from interface: InvokeFuture
Create a remoting command response when connection closed

Specified by:
createConnectionClosedResponse in interface InvokeFuture
Returns:

putResponse

public void putResponse(RemotingCommand response)
Description copied from interface: InvokeFuture
Put the response to the future.

Specified by:
putResponse in interface InvokeFuture
See Also:
InvokeFuture.putResponse(com.alipay.remoting.RemotingCommand)

isDone

public boolean isDone()
Description copied from interface: InvokeFuture
Whether the future is done.

Specified by:
isDone in interface InvokeFuture
Returns:
See Also:
InvokeFuture.isDone()

getAppClassLoader

public ClassLoader getAppClassLoader()
Specified by:
getAppClassLoader in interface InvokeFuture
Returns:
application classloader

invokeId

public int invokeId()
Description copied from interface: InvokeFuture
Get the id of the invocation.

Specified by:
invokeId in interface InvokeFuture
Returns:
See Also:
InvokeFuture.invokeId()

executeInvokeCallback

public void executeInvokeCallback()
Description copied from interface: InvokeFuture
Execute the callback.

Specified by:
executeInvokeCallback in interface InvokeFuture

getInvokeCallback

public InvokeCallback getInvokeCallback()
Description copied from interface: InvokeFuture
Get the application callback of the future.

Specified by:
getInvokeCallback in interface InvokeFuture
Returns:
See Also:
InvokeFuture.getInvokeCallback()

addTimeout

public void addTimeout(io.netty.util.Timeout timeout)
Description copied from interface: InvokeFuture
Add timeout for the future.

Specified by:
addTimeout in interface InvokeFuture
See Also:
InvokeFuture.addTimeout(io.netty.util.Timeout)

cancelTimeout

public void cancelTimeout()
Description copied from interface: InvokeFuture
Cancel the timeout.

Specified by:
cancelTimeout in interface InvokeFuture
See Also:
InvokeFuture.cancelTimeout()

setCause

public void setCause(Throwable cause)
Description copied from interface: InvokeFuture
Set the cause if exception caught.

Specified by:
setCause in interface InvokeFuture
See Also:
InvokeFuture.setCause(java.lang.Throwable)

getCause

public Throwable getCause()
Description copied from interface: InvokeFuture
Get the cause of exception of the future.

Specified by:
getCause in interface InvokeFuture
Returns:
See Also:
InvokeFuture.getCause()

getProtocolCode

public byte getProtocolCode()
Description copied from interface: InvokeFuture
Get the protocol code of command.

Specified by:
getProtocolCode in interface InvokeFuture
Returns:
See Also:
InvokeFuture.getProtocolCode()

setInvokeContext

public void setInvokeContext(InvokeContext invokeContext)
Description copied from interface: InvokeFuture
set invoke context

Specified by:
setInvokeContext in interface InvokeFuture
See Also:
InvokeFuture.getInvokeContext()

getInvokeContext

public InvokeContext getInvokeContext()
Description copied from interface: InvokeFuture
get invoke context

Specified by:
getInvokeContext in interface InvokeFuture
Returns:
See Also:
InvokeFuture.setInvokeContext(InvokeContext)

tryAsyncExecuteInvokeCallbackAbnormally

public void tryAsyncExecuteInvokeCallbackAbnormally()
Description copied from interface: InvokeFuture
Asynchronous execute the callback abnormally.

Specified by:
tryAsyncExecuteInvokeCallbackAbnormally in interface InvokeFuture
See Also:
InvokeFuture.tryAsyncExecuteInvokeCallbackAbnormally()


Copyright © 2018. All rights reserved.