Package jadex.future

Interface ITerminationCommand

All Known Implementing Classes:
TerminationCommand
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ITerminationCommand
A command to customize termination of a terminable future.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Check if termination is allowed.
    void
    Called after termination was performed.
  • Method Details

    • checkTermination

      default boolean checkTermination(Exception reason)
      Check if termination is allowed. Called before termination is performed. Note that due to race conditions, the future may already be finished when this method executes. If false is returned, the termination request is ignored.
      Parameters:
      reason - The reason supplied for termination.
      Returns:
      True, if termination should proceed.
    • terminated

      void terminated(Exception reason)
      Called after termination was performed. Guaranteed to be called only once for each future and only if the termination finished the future (i.e. is not called when the future was already finished).
      Parameters:
      reason - The reason supplied for termination.