com.twitter.common.thrift.callers
Class DebugCaller

java.lang.Object
  extended by com.twitter.common.thrift.callers.DebugCaller
All Implemented Interfaces:
Caller

public class DebugCaller
extends Object

A caller that reports debugging information about calls.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.twitter.common.thrift.callers.Caller
Caller.ResultCapture, Caller.WrappedMethodCallback
 
Constructor Summary
DebugCaller(Caller decoratedCaller, boolean async)
          Creates a new debug caller.
 
Method Summary
 Object call(Method method, Object[] args, org.apache.thrift.async.AsyncMethodCallback callback, Amount<Long,Time> connectTimeoutOverride)
          Invokes a method on an object, using the given arguments.
protected  Object invoke(Method method, Object[] args, org.apache.thrift.async.AsyncMethodCallback callback, Caller.ResultCapture capture, Amount<Long,Time> connectTimeoutOverride)
          Convenience method for invoking the method and shunting the capture into the callback if the call is asynchronous.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugCaller

public DebugCaller(Caller decoratedCaller,
                   boolean async)
Creates a new debug caller.

Parameters:
decoratedCaller - The caller to decorate with debug information.
async - Whether the caller is asynchronous.
Method Detail

call

public Object call(Method method,
                   Object[] args,
                   @Nullable
                   org.apache.thrift.async.AsyncMethodCallback callback,
                   @Nullable
                   Amount<Long,Time> connectTimeoutOverride)
            throws Throwable
Description copied from interface: Caller
Invokes a method on an object, using the given arguments. The method call may be asynchronous, in which case callback will be non-null.

Parameters:
method - The method being invoked.
args - The arguments to call method with.
callback - The callback to use if the method is asynchronous.
connectTimeoutOverride - Optional override for the default connection timeout.
Returns:
The return value from invoking the method.
Throws:
Throwable - Exception, as prescribed by the method's contract.

invoke

protected final Object invoke(Method method,
                              Object[] args,
                              @Nullable
                              org.apache.thrift.async.AsyncMethodCallback callback,
                              @Nullable
                              Caller.ResultCapture capture,
                              @Nullable
                              Amount<Long,Time> connectTimeoutOverride)
                       throws Throwable
Convenience method for invoking the method and shunting the capture into the callback if the call is asynchronous.

Parameters:
method - The method being invoked.
args - The arguments to call method with.
callback - The callback to use if the method is asynchronous.
capture - The result capture to notify of the call result.
connectTimeoutOverride - Optional override for the default connection timeout.
Returns:
The return value from invoking the method.
Throws:
Throwable - Exception, as prescribed by the method's contract.