Package org.nustaq.kontraktor
Interface Callback<T>
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
IPromise<T>
- All Known Implementing Classes:
CallbackRefSerializer.MyRemotedCallback,CallbackWrapper,Promise
Typically used to receive/stream results from outside the actor.
The underlying mechanics scans method arguments and schedules calls on the call back into the calling actors thread.
Note that the callback invocation is added as a message to the end of the calling actor.
e.g. actor.method( arg, new Callbacl() { public void complete(T result, Object error ) { ..runs in caller thread.. } }
The only valid method on receiver side is to implement 'complete'.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcomplete()same as complete(null,null)voidset result or error. error might also contain flow indicators to signal end/continue of stream when remoting.default voidfinish()signal end of streamed objects (required for remoteref housekeeping if actors run remotely) same as complete( null, null );default booleanrelevant for remoted callback'sdefault Callbackinvalid for Promises!.default voidsignal an error to sender.default voidresolve()same as complete(null,null) and resolve(null)default voidpass a result object to the sender.
-
Field Details
-
CONT
use value as error to indicate more messages are to come (else remoting will close channel).- See Also:
-
-
Method Details
-
complete
set result or error. error might also contain flow indicators to signal end/continue of stream when remoting. (Actor.FIN Actor.CONT)- Parameters:
result-error-
-
complete
default void complete()same as complete(null,null) -
resolve
default void resolve()same as complete(null,null) and resolve(null) -
reject
signal an error to sender. Will automatically "close" the callback if remoted. same as complete( null, error );- Parameters:
error-
-
resolve
pass a result object to the sender. This can be called only once (connection to sender will be closed afterwards). same as complete( result, null );- Parameters:
result-
-
pipe
invalid for Promises!. can be called more than once on Callback's in order to stream objects to the sender. same as complete( result, CONT );- Parameters:
result-
-
finish
default void finish()signal end of streamed objects (required for remoteref housekeeping if actors run remotely) same as complete( null, null ); -
isTerminated
default boolean isTerminated()relevant for remoted callback's- Returns:
- true if the client owning this remote callback proxy has disconnected
-