Class Aggregate

  • All Implemented Interfaces:
    Runnable

    public class Aggregate
    extends TimerTask
    An instance of this class is created to manage each aggregation group, and it holds the aggregation properties and the messages collected during aggregation. This class also times out itself after the timeout expires it
    • Constructor Detail

      • Aggregate

        public Aggregate​(SynapseEnvironment synEnv,
                         String corelation,
                         long timeoutMillis,
                         int min,
                         int max,
                         AggregateMediator mediator,
                         FaultHandler faultHandler)
        Save aggregation properties and timeout
        Parameters:
        corelation - representing the corelation name of the messages in the aggregate
        timeoutMillis - the timeout duration in milliseconds
        min - the minimum number of messages to be aggregated
        max - the maximum number of messages to be aggregated
        mediator -
        faultHandler -
    • Method Detail

      • addMessage

        public boolean addMessage​(MessageContext synCtx)
        Add a message to the interlan message list
        Parameters:
        synCtx - message to be added into this aggregation group
        Returns:
        true if the message was added or false if not
      • isComplete

        public boolean isComplete​(SynapseLog synLog)
        Has this aggregation group completed?
        Parameters:
        synLog - the Synapse log to use
        Returns:
        boolean true if aggregation is complete
      • getTimeoutMillis

        public long getTimeoutMillis()
      • setTimeoutMillis

        public void setTimeoutMillis​(long timeoutMillis)
      • getMinCount

        public int getMinCount()
      • setMinCount

        public void setMinCount​(int minCount)
      • getMaxCount

        public int getMaxCount()
      • setMaxCount

        public void setMaxCount​(int maxCount)
      • getCorrelation

        public String getCorrelation()
      • setCorrelation

        public void setCorrelation​(String correlation)
      • getExpiryTimeMillis

        public long getExpiryTimeMillis()
      • setExpiryTimeMillis

        public void setExpiryTimeMillis​(long expiryTimeMillis)
      • clear

        public void clear()
        Clear references in Aggregate Timer Task This need to be called when aggregation is completed. Task is not eligible for gc until it reach the execution time, even though it is cancelled. So we need to remove references from task to other objects to allow them to be garbage collected
      • getLock

        public boolean getLock()
      • releaseLock

        public void releaseLock()
      • isCompleted

        public boolean isCompleted()
      • setCompleted

        public void setCompleted​(boolean completed)