public class ElementAttributes extends java.lang.Object implements IElementAttributes, java.io.Serializable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
long |
createTime
The creation time.
|
java.util.ArrayList |
eventHandlers
The list of Event handlers to use.
|
boolean |
IS_ETERNAL
You can turn off expiration by setting this to true.
|
boolean |
IS_LATERAL
Is this item laterally distributable
|
boolean |
IS_REMOTE
Can this item be sent to the remote cache
|
boolean |
IS_SPOOL
Can this item be flushed to disk
|
long |
lastAccessTime
The last access time.
|
long |
maxIdleTimeSeconds
The maximum time an entry can be idle.
|
long |
maxLifeSeconds
Max life seconds
|
int |
size
The byte size of the field.
|
| Modifier | Constructor and Description |
|---|---|
|
ElementAttributes()
Constructor for the IElementAttributes object
|
protected |
ElementAttributes(ElementAttributes attr)
Constructor for the IElementAttributes object
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElementEventHandler(IElementEventHandler eventHandler)
Adds a ElementEventHandler.
|
void |
addElementEventHandlers(java.util.ArrayList eventHandlers)
Sets the eventHandlers of the IElementAttributes object.
|
java.lang.Object |
clone2()
Deep clone the attributes.
|
IElementAttributes |
copy()
Copies the attributes, including references to event handlers.
|
long |
getCreateTime()
Gets the createTime attribute of the IAttributes object.
|
java.util.ArrayList |
getElementEventHandlers()
Gets the elementEventHandlers.
|
long |
getIdleTime()
Gets the idleTime attribute of the IAttributes object.
|
boolean |
getIsEternal()
You can turn off expiration by setting this to true.
|
boolean |
getIsLateral()
Is this item laterally distributable.
|
boolean |
getIsRemote()
Can this item be sent to the remote cache
|
boolean |
getIsSpool()
Can this item be spooled to disk
|
long |
getLastAccessTime()
Gets the LastAccess attribute of the IAttributes object.
|
long |
getMaxLifeSeconds()
Sets the maxLife attribute of the IAttributes object.
|
int |
getSize()
Gets the size attribute of the IAttributes object
|
long |
getTimeToLiveSeconds()
Gets the time left to live of the IAttributes object.
|
void |
setCreateTime()
Sets the createTime attribute of the IElementAttributes object
|
void |
setIdleTime(long idle)
Sets the idleTime attribute of the IAttributes object.
|
void |
setIsEternal(boolean val)
Sets the isEternal attribute of the ElementAttributes object.
|
void |
setIsLateral(boolean val)
Sets the isLateral attribute of the IElementAttributes object
|
void |
setIsRemote(boolean val)
Sets the isRemote attribute of the ElementAttributes object
|
void |
setIsSpool(boolean val)
Sets the isSpool attribute of the IElementAttributes object
|
void |
setLastAccessTimeNow()
Sets the LastAccessTime as now of the IElementAttributes object
|
void |
setMaxLifeSeconds(long mls)
Sets the maxLife attribute of the IAttributes object.
|
void |
setSize(int size)
Size in bytes.
|
java.lang.String |
toString()
For logging and debugging the element IElementAttributes.
|
public boolean IS_SPOOL
public boolean IS_LATERAL
public boolean IS_REMOTE
public boolean IS_ETERNAL
public long maxLifeSeconds
public long maxIdleTimeSeconds
public int size
public long createTime
public long lastAccessTime
public transient java.util.ArrayList eventHandlers
TODO we need to check that when an item is passed to a non-local cache that if the local cache had a copy with event handlers, that those handlers are used.
public ElementAttributes()
protected ElementAttributes(ElementAttributes attr)
attr - public IElementAttributes copy()
copy in interface IElementAttributespublic java.lang.Object clone2()
public void setMaxLifeSeconds(long mls)
setMaxLifeSeconds in interface IElementAttributesmls - The new MaxLifeSeconds valuepublic long getMaxLifeSeconds()
If this is exceeded the element will not be returned, instead it will be removed. It will be removed on retrieval, or removed actively if the memory shrinker is turned on.
getMaxLifeSeconds in interface IElementAttributespublic void setIdleTime(long idle)
If this is exceeded the element will not be returned, instead it will be removed. It will be removed on retrieval, or removed actively if the memory shrinker is turned on.
setIdleTime in interface IElementAttributesidle - The new idleTime valuepublic void setSize(int size)
setSize in interface IElementAttributessize - The new size valuepublic int getSize()
getSize in interface IElementAttributespublic long getCreateTime()
This should be the current time in milliseconds returned by the sysutem call when the element is put in the cache.
Putting an item in the cache overrides any existing items.
getCreateTime in interface IElementAttributespublic void setCreateTime()
public long getIdleTime()
getIdleTime in interface IElementAttributespublic long getTimeToLiveSeconds()
This is the (max life + create time) - current time.
getTimeToLiveSeconds in interface IElementAttributespublic long getLastAccessTime()
getLastAccessTime in interface IElementAttributespublic void setLastAccessTimeNow()
setLastAccessTimeNow in interface IElementAttributespublic boolean getIsSpool()
By default this is true.
getIsSpool in interface IElementAttributespublic void setIsSpool(boolean val)
By default this is true.
setIsSpool in interface IElementAttributesval - The new isSpool valuepublic boolean getIsLateral()
By default this is true.
getIsLateral in interface IElementAttributespublic void setIsLateral(boolean val)
By default this is true.
setIsLateral in interface IElementAttributesval - The new isLateral valuepublic boolean getIsRemote()
getIsRemote in interface IElementAttributespublic void setIsRemote(boolean val)
setIsRemote in interface IElementAttributesval - The new isRemote valuepublic boolean getIsEternal()
getIsEternal in interface IElementAttributespublic void setIsEternal(boolean val)
setIsEternal in interface IElementAttributesval - The new isEternal valuepublic void addElementEventHandler(IElementEventHandler eventHandler)
The alternative would be to register handlers for each event. Or maybe The handler interface should have a method to return whether it cares about certain events.
addElementEventHandler in interface IElementAttributeseventHandler - The ElementEventHandler to be added to the list.public void addElementEventHandlers(java.util.ArrayList eventHandlers)
This add the references to the local list. Subsequent changes in the caller's list will not be reflected.
addElementEventHandlers in interface IElementAttributeseventHandlers - List of IElementEventHandler objectspublic java.util.ArrayList getElementEventHandlers()
getElementEventHandlers in interface IElementAttributespublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2002-2013 Apache Software Foundation. All Rights Reserved.