Allow users of the PersistingUnit to set the desired result from the invoke method rather than having to also override handleSuccess.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6508 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -79,6 +79,8 @@ public abstract class PersistingUnit extends Invoker.Unit
|
|||||||
{
|
{
|
||||||
if (_listener instanceof InvocationService.ConfirmListener) {
|
if (_listener instanceof InvocationService.ConfirmListener) {
|
||||||
reportRequestProcessed();
|
reportRequestProcessed();
|
||||||
|
} else if (_listener instanceof InvocationService.ResultListener && _resultSet) {
|
||||||
|
reportRequestProcessed(_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +150,19 @@ public abstract class PersistingUnit extends Invoker.Unit
|
|||||||
return this + " failed.";
|
return this + " failed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the service listener is a ResultListener and this method is called, then the given
|
||||||
|
* result will be passed along to the listener on success.
|
||||||
|
*/
|
||||||
|
protected void setResult (Object result)
|
||||||
|
{
|
||||||
|
_resultSet = true;
|
||||||
|
_result = result;
|
||||||
|
}
|
||||||
|
|
||||||
protected InvocationService.InvocationListener _listener;
|
protected InvocationService.InvocationListener _listener;
|
||||||
protected Exception _error;
|
protected Exception _error;
|
||||||
protected Object[] _args;
|
protected Object[] _args;
|
||||||
|
protected boolean _resultSet;
|
||||||
|
protected Object _result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user