Package jadex.future

Class TerminableDelegationFuture<E>

java.lang.Object
jadex.future.Future<E>
jadex.future.TerminableDelegationFuture<E>
All Implemented Interfaces:
IBackwardCommandFuture, IForwardCommandFuture, IFuture<E>, ITerminableFuture<E>, Supplier<E>

public class TerminableDelegationFuture<E> extends Future<E> implements ITerminableFuture<E>
A terminable delegation future can be used when a termination future should be delegated. This kind of future needs to be connected to the termination source (another delegation or a real future). Termination calls are forwarded to the termination source. The future remembers when terminate() was called in unconnected state and forwards the request as soon as the connection is established.
  • Field Details

  • Constructor Details

    • TerminableDelegationFuture

      public TerminableDelegationFuture()
      Create a new future.
    • TerminableDelegationFuture

      public TerminableDelegationFuture(ITerminableFuture<E> src)
      Create a new future.
  • Method Details

    • setTerminationSource

      public void setTerminationSource(ITerminableFuture<E> src)
      Set the termination source.
    • 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(Exception reason)
      Terminate the future and supply a custom reason.
      Specified by:
      terminate in interface ITerminableFuture<E>
    • delegateFrom

      public void delegateFrom(IFuture<E> source)
      Delegate the result and exception from another future.
      Overrides:
      delegateFrom in class Future<E>
      Parameters:
      source - The source future.
    • sendBackwardCommand

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