|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.util.Invoker.Unit
com.threerings.util.Resulting<T>
public class Resulting<T>
A chainable ResultListener, InvocationListener, and Invoker.Unit all in one. TODO: add some examples of different usages.
| Nested Class Summary | |
|---|---|
protected static class |
Resulting.ReusableInvocationException
|
protected static class |
Resulting.StopException
|
| Nested classes/interfaces inherited from interface com.samskivert.util.ResultListener |
|---|
ResultListener.NOOP<T> |
| Field Summary | |
|---|---|
protected ResultListener<T> |
_chain
|
protected Exception |
_error
|
protected InvocationService.InvocationListener |
_invChain
Our invocation chain, if any. |
protected Logger |
_log
|
protected Object[] |
_logArgs
|
protected T |
_result
|
protected static ThreadLocal<Resulting.ReusableInvocationException> |
INV_EX
|
protected static ThreadLocal<Resulting.StopException> |
STOP
|
static Function<Object,Void> |
TO_VOID
A handy Object->Void function for when you wish to chain to a ResultListener |
| Fields inherited from class com.samskivert.util.Invoker.Unit |
|---|
_name, queueStamp |
| Fields inherited from interface com.samskivert.util.ResultListener |
|---|
NOOP |
| Constructor Summary | |
|---|---|
Resulting(InvocationService.InvocationListener chain)
|
|
Resulting(Resulting<T> chain)
|
|
Resulting(ResultListener<Q> chain,
Function<? super T,? extends Q> xform)
|
|
Resulting(ResultListener<T> chain)
|
|
Resulting(String name)
|
|
Resulting(String name,
InvocationService.InvocationListener chain)
|
|
Resulting(String name,
Logger log,
Object... logArgs)
|
|
Resulting(String name,
Resulting<T> chain)
|
|
Resulting(String name,
ResultListener<Q> chain,
Function<? super T,? extends Q> xform)
|
|
Resulting(String name,
ResultListener<T> chain)
|
|
| Method Summary | |
|---|---|
IntResultListener |
asIntResultListener()
Construct your Resulting |
void |
handleResult()
|
boolean |
invoke()
|
T |
invokePersist()
Override this if you are using a Resulting as an Invoker unit. |
void |
requestCompleted(T result)
Override this to handle a request completion in your own way. |
void |
requestFailed(Exception cause)
Override this to handle a request failed in your own way. |
void |
requestFailed(String error)
Called to report request failure. |
void |
requestProcessed()
Indicates that the request was successfully processed. |
void |
requestProcessed(Object result)
Indicates that the request was successfully processed. |
protected T |
stop()
Call this from your invokePersist() to suppress returning to the dobj thread. |
| Methods inherited from class com.samskivert.util.Invoker.Unit |
|---|
getDetail, getLongThreshold, run, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Function<Object,Void> TO_VOID
protected InvocationService.InvocationListener _invChain
protected ResultListener<T> _chain
protected Logger _log
protected Object[] _logArgs
protected T _result
protected Exception _error
protected static final ThreadLocal<Resulting.ReusableInvocationException> INV_EX
protected static final ThreadLocal<Resulting.StopException> STOP
| Constructor Detail |
|---|
public Resulting(String name)
public Resulting(String name,
Resulting<T> chain)
public Resulting(Resulting<T> chain)
public Resulting(String name,
ResultListener<T> chain)
public Resulting(ResultListener<T> chain)
public Resulting(String name,
InvocationService.InvocationListener chain)
public Resulting(InvocationService.InvocationListener chain)
public Resulting(String name,
ResultListener<Q> chain,
Function<? super T,? extends Q> xform)
public Resulting(ResultListener<Q> chain,
Function<? super T,? extends Q> xform)
public Resulting(String name,
Logger log,
Object... logArgs)
| Method Detail |
|---|
public final IntResultListener asIntResultListener()
public T invokePersist()
throws Exception
Exceptionpublic final boolean invoke()
invoke in class Invoker.Unit
protected final T stop()
throws Resulting.StopException
Resulting.StopException - every time.public final void handleResult()
handleResult in class Invoker.Unitpublic final void requestFailed(String error)
InvocationService.InvocationListener
requestFailed in interface InvocationService.InvocationListenerpublic final void requestProcessed()
InvocationService.ConfirmListener
requestProcessed in interface InvocationService.ConfirmListenerpublic final void requestProcessed(Object result)
InvocationService.ResultListener
requestProcessed in interface InvocationService.ResultListenerpublic void requestFailed(Exception cause)
requestFailed in interface ResultListener<T>public void requestCompleted(T result)
requestCompleted in interface ResultListener<T>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||