Class FutureFunctionality

  • Direct Known Subclasses:
    ComponentFutureFunctionality

    public class FutureFunctionality
    extends java.lang.Object
    Default future functionality.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DROP_INTERMEDIATE_RESULT
      Marker for an intermediate result to be dropped.
      protected java.util.logging.Logger logger
      The logger used for notification failure warnings (if any).
      protected jadex.commons.IResultCommand<java.util.logging.Logger,​java.lang.Void> loggerfetcher  
      protected boolean undone  
    • Constructor Summary

      Constructors 
      Constructor Description
      FutureFunctionality​(jadex.commons.IResultCommand<java.util.logging.Logger,​java.lang.Void> loggerfetcher)  
      FutureFunctionality​(java.util.logging.Logger logger)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void connectDelegationFuture​(jadex.commons.future.Future target, jadex.commons.future.IFuture source)
      Connect a delegation future with the source.
      static <T> jadex.commons.future.Future<T> getDelegationFuture​(jadex.commons.future.IFuture<T> orig, FutureFunctionality func)  
      static jadex.commons.future.Future<?> getDelegationFuture​(java.lang.Class<?> clazz, FutureFunctionality func)  
      protected java.util.logging.Logger getLogger()
      Get the logger.
      void handleAfterIntermediateResult​(java.lang.Object result)
      Perform code after an intermediate result has been added.
      void handleBackwardCommand​(java.lang.Object info)
      Optionally augment backward command behavior.
      void handleException​(java.lang.Exception exception)
      Optionally augment exception behavior.
      void handleFinished​(java.util.Collection<java.lang.Object> results)
      Optionally alter finished behavior.
      java.lang.Object handleIntermediateResult​(java.lang.Object result)
      Optionally alter a result.
      void handlePull()
      Optionally augment pull behavior.
      java.lang.Object handleResult​(java.lang.Object result)
      Optionally alter a result.
      void handleTerminated​(java.lang.Exception reason)
      Optionally augment termination behavior.
      boolean isUndone​(boolean undone)
      Optionally alter the undone flag.
      protected void logException​(java.lang.Exception e, java.lang.Exception userex, boolean terminable, boolean undone, boolean async)
      Log an exception.
      void scheduleBackward​(jadex.commons.ICommand<java.lang.Void> code)
      Schedule backward in result direction, i.e.
      <T> void scheduleForward​(jadex.commons.ICommand<T> code, T arg)
      Schedule forward in result direction, i.e.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DROP_INTERMEDIATE_RESULT

        public static final java.lang.String DROP_INTERMEDIATE_RESULT
        Marker for an intermediate result to be dropped.
        See Also:
        Constant Field Values
      • logger

        protected java.util.logging.Logger logger
        The logger used for notification failure warnings (if any).
      • loggerfetcher

        protected jadex.commons.IResultCommand<java.util.logging.Logger,​java.lang.Void> loggerfetcher
      • undone

        protected boolean undone
    • Constructor Detail

      • FutureFunctionality

        public FutureFunctionality​(java.util.logging.Logger logger)
      • FutureFunctionality

        public FutureFunctionality​(jadex.commons.IResultCommand<java.util.logging.Logger,​java.lang.Void> loggerfetcher)
    • Method Detail

      • getLogger

        protected java.util.logging.Logger getLogger()
        Get the logger.
      • logException

        protected void logException​(java.lang.Exception e,
                                    java.lang.Exception userex,
                                    boolean terminable,
                                    boolean undone,
                                    boolean async)
        Log an exception.
      • scheduleForward

        public <T> void scheduleForward​(jadex.commons.ICommand<T> code,
                                        T arg)
        Schedule forward in result direction, i.e. from callee to caller, e.g. update timer to avoid timeouts.
      • scheduleBackward

        public void scheduleBackward​(jadex.commons.ICommand<java.lang.Void> code)
        Schedule backward in result direction, i.e. from caller to callee, e.g. future termination.
      • isUndone

        public boolean isUndone​(boolean undone)
        Optionally alter the undone flag.
      • handleResult

        public java.lang.Object handleResult​(java.lang.Object result)
                                      throws java.lang.Exception
        Optionally alter a result.
        Throws:
        java.lang.Exception
      • handleIntermediateResult

        public java.lang.Object handleIntermediateResult​(java.lang.Object result)
                                                  throws java.lang.Exception
        Optionally alter a result.
        Throws:
        java.lang.Exception
      • handleAfterIntermediateResult

        public void handleAfterIntermediateResult​(java.lang.Object result)
                                           throws java.lang.Exception
        Perform code after an intermediate result has been added.
        Throws:
        java.lang.Exception
      • handleFinished

        public void handleFinished​(java.util.Collection<java.lang.Object> results)
                            throws java.lang.Exception
        Optionally alter finished behavior.
        Throws:
        java.lang.Exception
      • handleException

        public void handleException​(java.lang.Exception exception)
        Optionally augment exception behavior.
      • handleTerminated

        public void handleTerminated​(java.lang.Exception reason)
        Optionally augment termination behavior.
      • handleBackwardCommand

        public void handleBackwardCommand​(java.lang.Object info)
        Optionally augment backward command behavior.
      • handlePull

        public void handlePull()
        Optionally augment pull behavior.
      • getDelegationFuture

        public static <T> jadex.commons.future.Future<T> getDelegationFuture​(jadex.commons.future.IFuture<T> orig,
                                                                             FutureFunctionality func)
      • getDelegationFuture

        public static jadex.commons.future.Future<?> getDelegationFuture​(java.lang.Class<?> clazz,
                                                                         FutureFunctionality func)
      • connectDelegationFuture

        public static void connectDelegationFuture​(jadex.commons.future.Future target,
                                                   jadex.commons.future.IFuture source)
        Connect a delegation future with the source. Add delegation listener on the source (+ termination handling).