Class TerminableIntermediateFuture<E>

    • Field Detail

      • bcommands

        protected java.util.Map<ICommand<java.lang.Object>,​IFilter<java.lang.Object>> bcommands
        The list of backward commands.
    • Constructor Detail

      • TerminableIntermediateFuture

        public TerminableIntermediateFuture()
        Create a new future.
      • TerminableIntermediateFuture

        public TerminableIntermediateFuture​(java.lang.Exception exception)
        Create a future that is already done (failed).
        Parameters:
        exception - The exception.
      • TerminableIntermediateFuture

        public TerminableIntermediateFuture​(ITerminationCommand terminate)
        Create a new future.
        Parameters:
        terminate - The runnable to be executed in case of termination.
    • Method Detail

      • terminate

        public void terminate()
        Terminate the future. The exception will be set to FutureTerminatedException.
        Specified by:
        terminate in interface ITerminableFuture<E>
      • terminate

        public void terminate​(java.lang.Exception reason)
        Terminate the future and supply a custom reason.
        Specified by:
        terminate in interface ITerminableFuture<E>
      • getTerminationCommand

        public ITerminationCommand getTerminationCommand()
        Get the terminate.
        Returns:
        The terminate.
      • setTerminationCommand

        public void setTerminationCommand​(ITerminationCommand terminate)
        Set the terminate.
        Parameters:
        terminate - The terminate to set.
      • sendBackwardCommand

        public void sendBackwardCommand​(java.lang.Object info)
        Send a backward command in direction of the source.
        Specified by:
        sendBackwardCommand in interface IBackwardCommandFuture
        Parameters:
        info - The command info.
      • addBackwardCommand

        public void addBackwardCommand​(IFilter<java.lang.Object> filter,
                                       ICommand<java.lang.Object> command)
        Add a backward command with a filter. Whenever the future receives an info it will check all registered filters.
      • removeBackwardCommand

        public void removeBackwardCommand​(ICommand<java.lang.Object> command)
        Add a command with a filter. Whenever the future receives an info it will check all registered filters.