Class TimedTee

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, Pausable, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, FlowPauseStateListener, VariableChangeListener, AtomicExecution, Actor, ActorHandler, ActorWithConditionalEquivalent, ActorWithTimedEquivalent, CallableActorUser, ControlActor, ErrorHandler, Flushable, InputConsumer, MutableActorHandler, OptionalCallableActor, OutputProducer, SubFlowWrapUp, TimedActor, Serializable, Comparable

    public class TimedTee
    extends Tee
    implements TimedActor
    Allows to tap into the flow and tee-off tokens.
    Times how long the sub-flow execution takes and sends the time in milli-seconds (as double) in a adams.flow.container.TimingContainer container to the specified callable actor.

    Input/output:
    - accepts:
       adams.flow.core.Unknown
    - generates:
       adams.flow.core.Unknown


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: TimedTee
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this 
        actor encounters an error; the error gets propagated; useful for critical 
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing 
        actor handler must have this enabled as well.
        default: false
     
    -finish-before-stopping <boolean> (property: finishBeforeStopping)
        If enabled, actor first finishes processing all data before stopping.
        default: false
     
    -asynchronous <boolean> (property: asynchronous)
        If enabled, the sub-actors get executed asynchronously rather than the flow 
        waiting for them to finish before proceeding with execution.
        default: false
     
    -tee <adams.flow.core.Actor> [-tee ...] (property: actors)
        The actors to siphon-off the tokens to.
        default: 
     
    -timing-enabled <boolean> (property: timingEnabled)
        If enabled, then the actors performs timing on its execution.
        default: true
     
    -prefix <java.lang.String> (property: prefix)
        The prefix to store in the timing container; automatically expands variables.
        default: 
     
    -callable <adams.flow.core.CallableActorReference> (property: callableName)
        The name of the callable actor to use.
        default: unknown
     
    -optional <boolean> (property: optional)
        If enabled, then the callable actor is optional, ie no error is raised if 
        not found, merely ignored.
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • BACKUP_CALLABLEACTOR

        public static final String BACKUP_CALLABLEACTOR
        the key for backing up the callable actor.
        See Also:
        Constant Field Values
      • BACKUP_CONFIGURED

        public static final String BACKUP_CONFIGURED
        the key for backing up the configured state.
        See Also:
        Constant Field Values
      • m_TimingEnabled

        protected boolean m_TimingEnabled
        whether timing is enabled.
      • m_Prefix

        protected String m_Prefix
        the prefix to use.
      • m_CallableActor

        protected Actor m_CallableActor
        the callable actor.
      • m_Configured

        protected boolean m_Configured
        whether the callable actor has been configured.
      • m_Optional

        protected boolean m_Optional
        whether the callable actor is optional.
      • m_StopWatch

        protected transient org.apache.commons.lang.time.StopWatch m_StopWatch
        the stopwatch for timing.
    • Constructor Detail

      • TimedTee

        public TimedTee()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class AbstractTee
      • setTimingEnabled

        public void setTimingEnabled​(boolean value)
        Sets whether to perform timing on its execution.
        Parameters:
        value - true if timing enabled
      • getTimingEnabled

        public boolean getTimingEnabled()
        Returns whether to perform timing on its execution.
        Returns:
        true if timing enabled
      • timingEnabledTipText

        public String timingEnabledTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPrefix

        public void setPrefix​(String value)
        Sets the prefix to store in the timing container.
        Parameters:
        value - the prefix
      • getPrefix

        public String getPrefix()
        Returns the prefix to store in the timing container.
        Returns:
        the prefix
      • prefixTipText

        public String prefixTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • callableNameTipText

        public String callableNameTipText()
        Returns the tip text for this property.
        Specified by:
        callableNameTipText in interface TimedActor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOptional

        public void setOptional​(boolean value)
        Sets whether the callable actor is optional.
        Specified by:
        setOptional in interface OptionalCallableActor
        Parameters:
        value - true if optional
      • getOptional

        public boolean getOptional()
        Returns whether the callable actor is optional.
        Specified by:
        getOptional in interface OptionalCallableActor
        Returns:
        true if optional
      • optionalTipText

        public String optionalTipText()
        Returns the tip text for this property.
        Specified by:
        optionalTipText in interface OptionalCallableActor
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • findCallableActor

        protected Actor findCallableActor()
        Tries to find the callable actor referenced by its callable name.
        Returns:
        the callable actor or null if not found
      • hasCallableActor

        public boolean hasCallableActor()
        Checks whether a reference to the callable actor is currently available.
        Specified by:
        hasCallableActor in interface TimedActor
        Returns:
        true if a reference is available
        See Also:
        getCallableActor()
      • setUpCallableActor

        protected String setUpCallableActor()
        Configures the callable actor.
        Returns:
        null if successful, otherwise error message
      • executeCallableActor

        protected String executeCallableActor​(double msec)
        Executes the callable actor. Derived classes might need to override this method to ensure atomicity.
        Parameters:
        msec - the time in milli-seconds
        Returns:
        null if no error, otherwise error message
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Overrides:
        doExecute in class AbstractTee
        Returns:
        null if everything is fine, otherwise error message
      • isFinished

        public boolean isFinished()
        Returns whether the actor has finished.
        Specified by:
        isFinished in interface Actor
        Overrides:
        isFinished in class AbstractActor
        Returns:
        true if finished
      • wrapUp

        public void wrapUp()
        Cleans up after the execution has finished. Graphical output is left untouched.
        Specified by:
        wrapUp in interface Actor
        Overrides:
        wrapUp in class AbstractTee