public class StateCollector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_PERIOD |
Constructor and Description |
---|
StateCollector(ZoneManager zones) |
StateCollector(ZoneManager zones,
long collectionPeriod) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(StateListener l)
Adds a listener that self-indicates which specific zones
it is interested in from one frame to the next.
|
protected void |
collect()
Called by the background thread to collect all
of the accumulated state since the last collection and
distribute it to the state listeners.
|
protected void |
collectionError(java.lang.Exception e) |
long |
getIdleSleepTime() |
protected java.util.List<StateListener> |
getListeners(ZoneKey key,
boolean create) |
protected void |
initialize()
Called from the background thread when it first starts up.
|
protected void |
publish(StateBlock b) |
protected void |
publishFrame(StateFrame frame)
Adjusts the per-listener zone interest based on latest
listener state, then publishes the state frame to all
interested listeners.
|
void |
removeListener(StateListener l) |
void |
setIdleSleepTime(long millis)
Sets the sleep() time for the state collector's idle periods.
|
void |
shutdown() |
void |
start() |
protected void |
terminate()
Called by the background thread when it is shutting down.
|
protected void |
unwatch(ZoneKey key,
StateListener l) |
protected void |
unwatchAll(StateListener l) |
protected void |
watch(ZoneKey key,
StateListener l) |
public static final long DEFAULT_PERIOD
public StateCollector(ZoneManager zones)
public StateCollector(ZoneManager zones, long collectionPeriod)
public void start()
public void shutdown()
public void addListener(StateListener l)
public void removeListener(StateListener l)
public void setIdleSleepTime(long millis)
public long getIdleSleepTime()
protected java.util.List<StateListener> getListeners(ZoneKey key, boolean create)
protected void watch(ZoneKey key, StateListener l)
protected void unwatch(ZoneKey key, StateListener l)
protected void unwatchAll(StateListener l)
protected void initialize()
protected void publish(StateBlock b)
protected void publishFrame(StateFrame frame)
protected void collect()
protected void terminate()
protected void collectionError(java.lang.Exception e)