Interface Callback<T>

All Superinterfaces:
Serializable
All Known Subinterfaces:
IPromise<T>
All Known Implementing Classes:
CallbackRefSerializer.MyRemotedCallback, CallbackWrapper, Promise

public interface Callback<T> extends Serializable
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
    Modifier and Type
    Field
    Description
    static final String
    use value as error to indicate more messages are to come (else remoting will close channel).
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    same as complete(null,null)
    void
    complete(T result, Object error)
    set result or error. error might also contain flow indicators to signal end/continue of stream when remoting.
    default void
    signal end of streamed objects (required for remoteref housekeeping if actors run remotely) same as complete( null, null );
    default boolean
    relevant for remoted callback's
    default Callback
    pipe(T result)
    invalid for Promises!.
    default void
    reject(Object error)
    signal an error to sender.
    default void
    same as complete(null,null) and resolve(null)
    default void
    resolve(T result)
    pass a result object to the sender.
  • Field Details

    • CONT

      static final String CONT
      use value as error to indicate more messages are to come (else remoting will close channel).
      See Also:
  • Method Details

    • complete

      void complete(T result, Object error)
      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

      default void reject(Object error)
      signal an error to sender. Will automatically "close" the callback if remoted. same as complete( null, error );
      Parameters:
      error -
    • resolve

      default void resolve(T result)
      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

      default Callback pipe(T result)
      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