public class PeriodicHelper extends Helper
periodicTrigger()
and then waiting for a fixed time. Rule sets which employ the helper class can attach rules to the periodic
trigger method in order to perform operations which should happen at regular intervalsx. This is useful,
for example, for rule sets which collect statistical information. A periodically triggered rule can read and
then rezero a set of stats counters, allowing it to provide regular interval statistics.
The basic way to use this class is to employ attach a rule to method periodicTrigger()
. The rule will
be triggered at 10 second intervals. If the period needs to be altered then a rule attached to method
getPeriod()
can be used to return an alternative value. getPeriod()
is called once when the
periodic trigger thread is created. If the wait interval needs to be recomputed before each wait then a rule
attached to method resetPeriod(long)
can be used to return the desired value. The input argument is
the value returned by the call to getPeriod()
.Modifier and Type | Field | Description |
---|---|---|
static long |
DEFAULT_PERIOD |
the default period which the helper will wait for between calls to periodicTrigger in milliseconds.
|
Constructor | Description |
---|---|
PeriodicHelper(Rule rule) |
Modifier and Type | Method | Description |
---|---|---|
static void |
activated() |
helper activation method which creates a periodic helper thread to perform periodic calls to the trigger
method.
|
static void |
deactivated() |
helper deactivation method which shuts down the periodic helper thread.
|
protected long |
getPeriod() |
a method which is called when the periodic helper thread is started to compute the interval in milliseconds
for which the thread should wait between calls to the trigger method which by default returns the default
interval of 10 seconds.
|
protected void |
periodicTrigger() |
a method which is called at regular intervals by the periodic helper thread to trigger rule processing.
|
protected long |
resetPeriod(long initialPeriod) |
a method which is called when the periodic helper thread is about to wait which by default returns the
input value.
|
addCountDown, callerCheck, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerEquals, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, callerMatches, clear, clearLinks, clearLinks, closeTrace, countDown, createCountDown, createCounter, createCounter, createJoin, createLinkMap, createRendezvous, createRendezvous, createTimer, debug, decrementCounter, delay, deleteCounter, deleteLinkMap, deleteRendezvous, deleteTimer, err, errTraceException, flag, flagged, formatAllStacks, formatAllStacks, formatAllStacks, formatAllStacks, formatStack, formatStack, formatStack, formatStack, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetween, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackBetweenMatches, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackMatching, formatStackRange, formatThreadStack, formatThreadStack, formatThreadStack, formatThreadStack, getCountDown, getElapsedTimeFromTimer, getObjectSize, getRendezvous, getStack, incrementCounter, incrementCounter, installed, isCountDown, isJoin, isRendezvous, joinEnlist, joinWait, joinWait, killJVM, killJVM, killThread, link, link, linked, linked, linkNames, linkNames, linkValues, linkValues, matchIndex, noisy, noisyTraceException, openTrace, openTrace, out, outTraceException, printFrame, printlnFrame, readCounter, readCounter, rendezvous, rendezvous, resetTimer, setTriggering, signalKill, signalKill, signalThrow, signalThrow, signalWake, signalWake, toString, trace, trace, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceAllStacks, traceClose, traceln, traceln, traceOpen, traceOpen, traceStack, traceStack, traceStack, traceStack, traceStack, traceStack, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetween, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackBetweenMatches, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackMatching, traceStackRange, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, traceThreadStack, triggerIndex, uninstalled, unlink, unlink, verbose, verboseTraceException, waitFor, waitFor, waiting
public static final long DEFAULT_PERIOD
public PeriodicHelper(Rule rule)
protected void periodicTrigger()
protected long getPeriod()
protected long resetPeriod(long initialPeriod)
initialPeriod
- the initial wait time returned by getPeriod when the periodic thread was createdpublic static void activated()
public static void deactivated()
Copyright © 2018. All rights reserved.