|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
stella.parameter.AbstractParameter
stella.parameter.AbstractCachedParameter
public abstract class AbstractCachedParameter
An abstract base class providing the functionalibility of a
parameter that can cache its value, if getting is too expensive to be
commenced at any time. The KEY_CACHE points to the time (in ms)
the cached value stays valid.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyContainer |
|---|
PropertyContainer.URLResource |
| Field Summary | |
|---|---|
private Object |
cache
The cached value. |
private static long |
DEFCACHE
The default cache-valid time. |
static String |
KEY_CACHE
The cache-valid time. |
private long |
update
The time of laast cache update. |
| Fields inherited from class stella.parameter.AbstractParameter |
|---|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES |
| Fields inherited from interface util.PropertyBearing |
|---|
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
protected |
AbstractCachedParameter(Map prop)
Constructs a new status requestor. |
| Method Summary | |
|---|---|
Object |
get()
Gets this parameter value. |
Object |
getCache()
Returns the cached value, regardless of validity. |
String |
getCacheFormatted()
Returns the formatted cache entry. |
protected abstract Object |
getUncached()
This method is called to deliver uncached values. |
Object |
set(Object newcache)
Sets the cache value. |
| Methods inherited from class stella.parameter.AbstractParameter |
|---|
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, register, rescanned, setName, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.PropertyBearing |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getLocalized, getProperties, getProperty, getResource, getResourceAsStream, getResources, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Field Detail |
|---|
public static final String KEY_CACHE
private static final long DEFCACHE
private Object cache
private long update
| Constructor Detail |
|---|
protected AbstractCachedParameter(Map prop)
#KEY_COMMAND class
is not found or cannot be used to instantiate a CommandEvent.
The cache time and the disable flag are defaulted.
| Method Detail |
|---|
public Object get()
#urge command is sent to the
registered command launcher #server. The method now waits on
the error event returned from the server. As soon as this error event
is received in the #registerError method, the cache is updated
and the value returned.#KEY_DISABLE
flag is introduced. If this is set to true, command sending is
prevented,
and the cache value is returned. This is only useful, if
at least two parameters listen to the same status event. Then, only
the parameter with the shortest cache time should carry a non-disabled
flag. It is important to avoid dead-lock situations by using different
cache times on these parameters. Keep in mind that all parameters will
be updated at the highest frequency, regardless
public Object getCache()
public String getCacheFormatted()
public Object set(Object newcache)
protected abstract Object getUncached()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||