public class ElementAttributes extends Object implements IElementAttributes
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(List<IElementEventHandler> eventHandlers)
Sets the eventHandlers of the IElementAttributes object.
|
IElementAttributes |
clone()
Clone object
|
long |
getCreateTime()
Gets the createTime attribute of the IAttributes object.
|
ArrayList<IElementEventHandler> |
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
By default this is true.
|
long |
getLastAccessTime()
Gets the LastAccess attribute of the IAttributes object.
|
long |
getMaxLife()
Sets the maxLife attribute of the IAttributes object.
|
int |
getSize()
Gets the size attribute of the IAttributes object
|
long |
getTimeFactorForMilliseconds() |
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
By default this is true.
|
void |
setIsRemote(boolean val)
Sets the isRemote attribute of the ElementAttributes object
|
void |
setIsSpool(boolean val)
Sets the isSpool attribute of the IElementAttributes object
By default this is true.
|
void |
setLastAccessTime(long time)
only for use from test code
|
void |
setLastAccessTimeNow()
Sets the LastAccessTime as now of the IElementAttributes object
|
void |
setMaxLife(long mls)
Sets the maxLife attribute of the IAttributes object.
|
void |
setSize(int size)
Size in bytes.
|
void |
setTimeFactorForMilliseconds(long factor) |
String |
toString()
For logging and debugging the element IElementAttributes.
|
public ElementAttributes()
protected ElementAttributes(ElementAttributes attr)
attr
- public void setMaxLife(long mls)
setMaxLife
in interface IElementAttributes
mls
- The new MaxLifeSeconds valuepublic long getMaxLife()
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.
getMaxLife
in interface IElementAttributes
public 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 IElementAttributes
idle
- The new idleTime valuepublic void setSize(int size)
setSize
in interface IElementAttributes
size
- The new size valuepublic int getSize()
getSize
in interface IElementAttributes
public 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 IElementAttributes
public void setCreateTime()
public long getIdleTime()
getIdleTime
in interface IElementAttributes
public long getTimeToLiveSeconds()
This is the (max life + create time) - current time.
getTimeToLiveSeconds
in interface IElementAttributes
public long getLastAccessTime()
getLastAccessTime
in interface IElementAttributes
public void setLastAccessTimeNow()
setLastAccessTimeNow
in interface IElementAttributes
public void setLastAccessTime(long time)
public boolean getIsSpool()
By default this is true.
getIsSpool
in interface IElementAttributes
public void setIsSpool(boolean val)
By default this is true.
setIsSpool
in interface IElementAttributes
val
- The new isSpool valuepublic boolean getIsLateral()
By default this is true.
getIsLateral
in interface IElementAttributes
public void setIsLateral(boolean val)
By default this is true.
setIsLateral
in interface IElementAttributes
val
- The new isLateral valuepublic boolean getIsRemote()
getIsRemote
in interface IElementAttributes
public void setIsRemote(boolean val)
setIsRemote
in interface IElementAttributes
val
- The new isRemote valuepublic boolean getIsEternal()
getIsEternal
in interface IElementAttributes
public void setIsEternal(boolean val)
setIsEternal
in interface IElementAttributes
val
- 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 IElementAttributes
eventHandler
- The ElementEventHandler to be added to the list.public void addElementEventHandlers(List<IElementEventHandler> eventHandlers)
This add the references to the local list. Subsequent changes in the caller's list will not be reflected.
addElementEventHandlers
in interface IElementAttributes
eventHandlers
- List of IElementEventHandler objectspublic long getTimeFactorForMilliseconds()
getTimeFactorForMilliseconds
in interface IElementAttributes
public void setTimeFactorForMilliseconds(long factor)
setTimeFactorForMilliseconds
in interface IElementAttributes
public ArrayList<IElementEventHandler> getElementEventHandlers()
getElementEventHandlers
in interface IElementAttributes
public IElementAttributes clone()
IElementAttributes
clone
in interface IElementAttributes
clone
in class Object
Object.clone()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.