|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.epl.variable.VersionedValueList<T>
public class VersionedValueList<T>
A self-cleaning list of versioned-values.
The current and prior version are held for lock-less read access in a transient variable.
The list relies on transient as well as a read-lock to guard against concurrent modification. However a read lock is only taken when a list of old versions must be updated.
When a high watermark is reached, the list on write access removes old versions up to the number of milliseconds compared to current write timestamp.
If an older version is requested then held by the list, the list can either throw an exception or return the current value.
Constructor Summary | |
---|---|
VersionedValueList(java.lang.String name,
int initialVersion,
T initialValue,
long timestamp,
long millisecondLifetimeOldVersions,
java.util.concurrent.locks.Lock readLock,
int highWatermark,
boolean errorWhenNotFound)
Ctor. |
Method Summary | |
---|---|
java.lang.Object |
addValue(int version,
T value,
long timestamp)
Add a value and version to the list, returning the prior value of the variable. |
protected CurrentValue<T> |
getCurrentAndPriorValue()
Returns the current and prior version. |
java.lang.String |
getName()
Returns the name of the value stored. |
protected java.util.ArrayList<VersionedValue<T>> |
getOlderVersions()
Returns the list of old versions, for testing purposes. |
T |
getVersion(int versionAndOlder)
Retrieve a value for the given version or older then then given version. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VersionedValueList(java.lang.String name, int initialVersion, T initialValue, long timestamp, long millisecondLifetimeOldVersions, java.util.concurrent.locks.Lock readLock, int highWatermark, boolean errorWhenNotFound)
name
- variable nameinitialVersion
- first version numberinitialValue
- first valuetimestamp
- timestamp of first versionmillisecondLifetimeOldVersions
- number of milliseconds after which older versions get expired and removedreadLock
- for coordinating update to old versionshighWatermark
- when the number of old versions reached high watermark, the list inspects size on every writeerrorWhenNotFound
- true if an exception should be throw if the requested version cannot be found,
or false if the engine should log a warningMethod Detail |
---|
public java.lang.String getName()
public T getVersion(int versionAndOlder)
The implementaton only locks the read lock if an older version the the prior version is requested.
versionAndOlder
- the version we are looking for
public java.lang.Object addValue(int version, T value, long timestamp)
version
- for the value to addvalue
- to addtimestamp
- the time associated with the version
protected CurrentValue<T> getCurrentAndPriorValue()
protected java.util.ArrayList<VersionedValue<T>> getOlderVersions()
public java.lang.String toString()
toString
in class java.lang.Object
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |