Class TerminableFuture<E>

    • Field Detail

      • bcommands

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

      • TerminableFuture

        public TerminableFuture()
        Create a new future.
      • TerminableFuture

        public TerminableFuture​(ITerminationCommand terminate)
        Create a future that is already done.
        Parameters:
        result - The result, if any.
    • 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>
      • 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.
      • setTerminationCommand

        public void setTerminationCommand​(ITerminationCommand terminate)
        Set the termination command.
        Parameters:
        terminate - The termination command.