org.springframework.util.concurrent

Class ListenableFutureCallbackRegistry<T>

  • java.lang.Object
    • org.springframework.util.concurrent.ListenableFutureCallbackRegistry<T>
  • Type Parameters:
    T - the callback result type


    public class ListenableFutureCallbackRegistry<T>
    extends java.lang.Object
    Helper class for ListenableFuture implementations that maintains a of success and failure callbacks and helps to notify them.

    Inspired by com.google.common.util.concurrent.ExecutionList.

    Since:
    4.0
    Author:
    Arjen Poutsma, Sebastien Deleuze, Rossen Stoyanchev
    • Constructor Detail

      • ListenableFutureCallbackRegistry

        public ListenableFutureCallbackRegistry()
    • Method Detail

      • addCallback

        public void addCallback(ListenableFutureCallback<? super T> callback)
        Add the given callback to this registry.
        Parameters:
        callback - the callback to add
      • addSuccessCallback

        public void addSuccessCallback(SuccessCallback<? super T> callback)
        Add the given success callback to this registry.
        Parameters:
        callback - the success callback to add
        Since:
        4.1
      • addFailureCallback

        public void addFailureCallback(FailureCallback callback)
        Add the given failure callback to this registry.
        Parameters:
        callback - the failure callback to add
        Since:
        4.1
      • failure

        public void failure(java.lang.Throwable ex)
        Trigger a FailureCallback.onFailure(Throwable) call on all added callbacks with the given Throwable.
        Parameters:
        ex - the exception to trigger the callbacks with