|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.eviction.BaseEvictionAlgorithm
public abstract class BaseEvictionAlgorithm
Abstract Event Processing Eviction Algorithm. This class is used to implement basic event processing for Eviction Algorithms. To extend this abstract class to make an Eviction Algorithm, implement the abstract methods and a policy.
Field Summary | |
---|---|
protected boolean |
allowTombstones
|
protected CacheSPI<?,?> |
cache
|
protected Configuration |
configuration
|
protected EvictionActionPolicy |
evictionActionPolicy
|
protected EvictionAlgorithmConfig |
evictionAlgorithmConfig
|
protected EvictionQueue |
evictionQueue
Contains NodeEntry instances. |
protected BlockingQueue<Fqn> |
recycleQueue
Contains Fqn instances. |
protected Fqn |
regionFqn
|
Constructor Summary | |
---|---|
protected |
BaseEvictionAlgorithm()
|
Method Summary | |
---|---|
void |
assignToRegion(Fqn fqn,
CacheSPI<?,?> cache,
EvictionAlgorithmConfig evictionAlgorithmConfig,
Configuration configuration)
Assigns the algorithm instance to a specific region. |
boolean |
canIgnoreEvent(EvictionEvent.Type eventType)
Tests whether the algorithm would ignore certain event types on certain Fqns. |
protected void |
emptyRecycleQueue()
Empty the Recycle Queue. |
protected void |
evict(NodeEntry ne)
|
protected boolean |
evictCacheNode(Fqn fqn)
Evict a node from cache. |
EvictionActionPolicy |
getEvictionActionPolicy()
|
EvictionAlgorithmConfig |
getEvictionAlgorithmConfig()
|
EvictionQueue |
getEvictionQueue()
Get the underlying EvictionQueue implementation. |
protected EvictionEvent |
getNextInQueue(BlockingQueue<EvictionEvent> queue)
|
void |
initialize()
Invoked by the region manager when the enclosing region is initialized. |
protected boolean |
isNodeInUseAndNotTimedOut(NodeEntry ne)
|
protected boolean |
isYoungerThanMinimumTimeToLive(NodeEntry entry)
Tests whether a node entry is younger than the minimum time to live - if one is configured. |
void |
process(BlockingQueue<EvictionEvent> eventQueue)
Process the given eviction event queue. |
protected void |
processAddedElement(EvictionEvent evictedEventNode)
|
protected void |
processAddedNodes(EvictionEvent evictedEventNode)
Convenience method, which calls processAddedNodes(EvictionEvent, int) using values in the
evictedEventNode for number of added elements and the resetElementCount flag. |
protected void |
processAddedNodes(EvictionEvent evictedEventNode,
int numAddedElements)
|
protected void |
processMarkInUseNodes(Fqn fqn,
long inUseTimeout)
|
protected void |
processQueues(BlockingQueue<EvictionEvent> queue)
Event processing for Evict/Add/Visiting of nodes. |
protected void |
processRemovedElement(EvictionEvent evictedEventNode)
|
protected void |
processRemovedNodes(EvictionEvent evictedEventNode)
Remove a node from cache. |
protected void |
processUnmarkInUseNodes(Fqn fqn)
|
protected void |
processVisitedNodes(EvictionEvent evictedEventNode)
Visit a node in cache. |
protected void |
prune()
|
void |
resetEvictionQueue()
Reset the whole eviction queue. |
void |
setEvictionActionPolicy(EvictionActionPolicy evictionActionPolicy)
Sets the eviction action policy, so the algorithm knows what to do when a node is to be evicted. |
protected abstract EvictionQueue |
setupEvictionQueue()
This method will create an EvictionQueue implementation and prepare it for use. |
protected abstract boolean |
shouldEvictNode(NodeEntry ne)
This method will check whether the given node should be evicted or not. |
String |
toString()
Returns debug information. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.jboss.cache.eviction.EvictionAlgorithm |
---|
getConfigurationClass |
Field Detail |
---|
protected EvictionActionPolicy evictionActionPolicy
protected EvictionAlgorithmConfig evictionAlgorithmConfig
protected BlockingQueue<Fqn> recycleQueue
protected EvictionQueue evictionQueue
protected boolean allowTombstones
protected Configuration configuration
protected Fqn regionFqn
protected CacheSPI<?,?> cache
Constructor Detail |
---|
protected BaseEvictionAlgorithm()
Method Detail |
---|
protected abstract EvictionQueue setupEvictionQueue() throws EvictionException
EvictionException
- if there are problemsEvictionQueue
protected abstract boolean shouldEvictNode(NodeEntry ne)
ne
- NodeEntry to test eviction for.
public void initialize()
EvictionAlgorithm
initialize
in interface EvictionAlgorithm
public EvictionActionPolicy getEvictionActionPolicy()
public void setEvictionActionPolicy(EvictionActionPolicy evictionActionPolicy)
EvictionAlgorithm
setEvictionActionPolicy
in interface EvictionAlgorithm
evictionActionPolicy
- to setpublic EvictionAlgorithmConfig getEvictionAlgorithmConfig()
public void assignToRegion(Fqn fqn, CacheSPI<?,?> cache, EvictionAlgorithmConfig evictionAlgorithmConfig, Configuration configuration)
EvictionAlgorithm
assignToRegion
in interface EvictionAlgorithm
fqn
- of the region to be assigned tocache
- cache referenceevictionAlgorithmConfig
- configuration for the current algorithm instance.configuration
- for the entire cache.public boolean canIgnoreEvent(EvictionEvent.Type eventType)
EvictionAlgorithm
canIgnoreEvent
in interface EvictionAlgorithm
eventType
- event type to test for
public void process(BlockingQueue<EvictionEvent> eventQueue) throws EvictionException
process
in interface EvictionAlgorithm
eventQueue
- queue containing eviction events
EvictionException
public void resetEvictionQueue()
EvictionAlgorithm
resetEvictionQueue
in interface EvictionAlgorithm
public EvictionQueue getEvictionQueue()
getEvictionQueue
in interface EvictionAlgorithm
EvictionQueue
protected EvictionEvent getNextInQueue(BlockingQueue<EvictionEvent> queue)
protected void processQueues(BlockingQueue<EvictionEvent> queue) throws EvictionException
queue
- queue to inspect
EvictionException
- in the event of problemsprotected void evict(NodeEntry ne)
protected boolean evictCacheNode(Fqn fqn)
fqn
- node corresponds to this fqn
protected void processMarkInUseNodes(Fqn fqn, long inUseTimeout) throws EvictionException
EvictionException
protected void processUnmarkInUseNodes(Fqn fqn) throws EvictionException
EvictionException
protected void processAddedNodes(EvictionEvent evictedEventNode) throws EvictionException
processAddedNodes(EvictionEvent, int)
using values in the
evictedEventNode for number of added elements and the resetElementCount flag.
evictedEventNode
- an evictedEventNode to process
EvictionException
- on problemsprotected void processAddedNodes(EvictionEvent evictedEventNode, int numAddedElements) throws EvictionException
EvictionException
protected void processRemovedNodes(EvictionEvent evictedEventNode) throws EvictionException
EvictionException
protected void processVisitedNodes(EvictionEvent evictedEventNode) throws EvictionException
EvictionException
protected void processRemovedElement(EvictionEvent evictedEventNode) throws EvictionException
EvictionException
protected void processAddedElement(EvictionEvent evictedEventNode) throws EvictionException
EvictionException
protected void emptyRecycleQueue() throws EvictionException
EvictionException
protected boolean isNodeInUseAndNotTimedOut(NodeEntry ne)
protected void prune() throws EvictionException
EvictionException
public String toString()
toString
in class Object
protected boolean isYoungerThanMinimumTimeToLive(NodeEntry entry)
entry
- the node entry being examined
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |