Package 

Interface StreamObservable

    • Method Summary

      Modifier and Type Method Description
      abstract Result<StreamSubscription> subscribe(T listener, StreamSubscriptionManager.Options options) Adds listener to the active set and returns a handle that can later be used to unregister it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • subscribe

         abstract Result<StreamSubscription> subscribe(T listener, StreamSubscriptionManager.Options options)

        Adds listener to the active set and returns a handle that can later be used to unregister it.

        The returned StreamSubscription is idempotent:

        • Calling cancel() multiple times is safe.

        • After cancel() completes, the listener is guaranteed to be absent from subsequent forEach iterations.

        Retention:

        • When options.retention is Options.Retention.AUTO_REMOVE (default), you can omit calling cancel(). Once your code drops all references to the listener, it is removed automatically and will no longer receive events.

        • When options.retention is Options.Retention.KEEP_UNTIL_CANCELLED, you must call cancel() (or invoke clear) to stop events.

        Parameters:
        listener - The listener to register.
        options - Retention options; defaults to automatic removal when the listener is no longer referenced.