T
- type of result for AsyncCallback.onSuccess(Object)
if the operation completed
successfully.public abstract class Handler<T>
extends java.lang.Object
implements java.util.concurrent.Callable<T>
Typically an RPC service implementation will extend this class and use Guice injection to manage its state. For example:
class Foo extends Handler<Result> { interface Factory { Foo create(... args ...); } @Inject Foo(state, @Assisted args) { ... } Result get() throws Exception { ... } }
Constructor and Description |
---|
Handler() |
Modifier and Type | Method and Description |
---|---|
abstract T |
call()
Compute the operation result.
|
void |
to(com.google.gwtjsonrpc.common.AsyncCallback<T> callback)
Run the operation and pass the result to the callback.
|
static <T> Handler<T> |
wrap(java.util.concurrent.Callable<T> r) |
public static <T> Handler<T> wrap(java.util.concurrent.Callable<T> r)
public final void to(com.google.gwtjsonrpc.common.AsyncCallback<T> callback)
callback
- callback to receive the result of call()
.public abstract T call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<T>
VoidResult.INSTANCE
if there is no
meaningful return value for the operation.java.lang.Exception
- the operation failed. The caller will log the exception and the stack trace,
if it is worth logging on the server side.