org.hd.d.pg2k.test.dev
Class SystemVariablesTest.EventValueRequestMonitor
java.lang.Object
org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter
org.hd.d.pg2k.test.dev.SystemVariablesTest.EventValueRequestMonitor
- All Implemented Interfaces:
- SimpleExhibitPipelineIF, BasicVarMgrInterface, SimpleVariablePipelineIF
- Enclosing class:
- SystemVariablesTest
static final class SystemVariablesTest.EventValueRequestMonitor
- extends SimpleExhibitPipelineFilter
Observe upstream accesses to event values.
This can optionally veto redundant reads that indicate that a cacheing stage
is not working properly.
The EventVariableValue.equals() and hashCode() methods allow
us to simply keep a Set of authorised values returned;
any duplicate is an error.
|
Field Summary |
private java.util.Set<EventVariableValue> |
authValueSeen
Set of authoritative responses so far passed downstream; never null. |
private boolean |
vetoRedundantReads
If true, veto attempts to read authoritative values more than once, ie redunantly. |
| Methods inherited from class org.hd.d.pg2k.svrCore.datasource.SimpleExhibitPipelineFilter |
destroy, getAllExhibitImmutableData, getAllExhibitProperties, getGenProps, getGenSecProps, getProperties, getRawFile, getStaticAttr, getThumbnails, getVariable, getVariables, poll, setVariable, setVariables, syncVariables |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
vetoRedundantReads
private final boolean vetoRedundantReads
- If true, veto attempts to read authoritative values more than once, ie redunantly.
authValueSeen
private final java.util.Set<EventVariableValue> authValueSeen
- Set of authoritative responses so far passed downstream; never null.
SystemVariablesTest.EventValueRequestMonitor
SystemVariablesTest.EventValueRequestMonitor(SimpleExhibitPipelineIF upstream,
boolean vetoRedundantReads)
- Construct instance wrapped round upstream source.
- Parameters:
upstream - datasource; never nullvetoRedundantReads - if true, veto attempts to read authoritative values
more than once, ie redunantly;
should be safe to use only behind a cache stage
getEventValue
public EventVariableValue getEventValue(SimpleVariableDefinition def,
EventPeriod intervalSelector,
boolean current)
- Intercept event requests and look for incorrect redundancy.
- Specified by:
getEventValue in interface BasicVarMgrInterface- Overrides:
getEventValue in class SimpleExhibitPipelineFilter
- Parameters:
def - event definition (must be for an event); never nullintervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx valuescurrent - if true the current event set is returned,
else the previous complete set is returned
- Returns:
- requested event set; may be null if requested set not available
getEventValues
public EventVariableValue[] getEventValues(SimpleVariableDefinition def,
EventPeriod intervalSelector,
long intervalNumber,
java.util.BitSet whichValues)
- Intercept event requests and look for incorrect redundancy.
- Specified by:
getEventValues in interface BasicVarMgrInterface- Overrides:
getEventValues in class SimpleExhibitPipelineFilter
- Parameters:
def - event definition (must be for an event); never nullintervalSelector - one of EVENT_INTERVAL_SELECTOR_xxx valuesintervalNumber - a time (as from System.currentTimeMillis())
which identifies the first interval for which data is potentially
required; if too far in the past or future then possibly no data
will be available,
zero is used to access the "all" bucketwhichValues - each true bit represents a slot for which data is
required, bit 0 indicating data from the slot within which
firstIntervalTime is located, bit 1 the previous slot, etc;
null is treated as the common case equivalent to just bit 0 set
- Returns:
- as many of the requested values as available,
at least long enough to return all the available values,
with [0] corresponding to bit 0 in the BitSet;
may contain nulls or be zero-length but is never null
Copyright (c) 1996-2009, Damon Hart-Davis. All rights reserved.