Class FreeMemory

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ControlActor, ErrorHandler, InputConsumer, Serializable, Comparable

    public class FreeMemory
    extends AbstractSink
    implements ControlActor
    Attempts to free up memory of the sub-flow that it belongs to.
    This actor is useful in case when sub-flows are only executed once, but still keep their data-structures and gobble up unnecessary memory. One scenario is having a adams.flow.control.Branch actor with lots of sequences as branches, which only get executed once.
    The parent must implement adams.flow.core.SubFlowWrapUp in order for this to work.
    CAUTION: Behind the scenes, all actors below this actor's parent will call their wrapUp() methods to conserve space. Therefore, use this actor with caution, as it will basically reset the actors.

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


    Valid options are:

    -D <int> (property: debugLevel)
        The greater the number the more additional info the scheme may output to 
        the console (0 = off).
        default: 0
        minimum: 0
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: FreeMemory
     
    -annotation <adams.core.base.BaseText> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
     
    -stop-flow-on-error (property: stopFlowOnError)
        If set to true, the flow gets stopped in case this actor encounters an error;
         useful for critical actors.
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • FreeMemory

        public FreeMemory()
    • Method Detail

      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        adams.flow.core.Unknown.class
      • setUp

        public String setUp()
        Initializes the item for flow execution. Also calls the reset() method first before anything else.
        Specified by:
        setUp in interface Actor
        Overrides:
        setUp in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message
        See Also:
        AbstractActor.reset()
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message