public abstract class AbstractCachedParameter extends AbstractParameter
KEY_CACHE points to the time (in ms)
the cached value stays valid.PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
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.
|
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCachedParameter(Map<String,String> prop)
Constructs a new status requestor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, init, overrideDefaultName, register, rescanned, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String KEY_CACHE
private static final long DEFCACHE
private Object cache
private long update
protected AbstractCachedParameter(Map<String,String> prop)
#KEY_COMMAND class
is not found or cannot be used to instantiate a CommandEvent.
The cache time and the disable flag are defaulted.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, regardlesspublic Object getCache()
public String getCacheFormatted()
public Object set(Object newcache)
protected abstract Object getUncached()