|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.apache.jcs.engine.memory.shrinking.ShrinkerThread
A background memory shrinker. Memory problems and concurrent modification exception caused by acting directly on an iterator of the underlying memory cache should have been solved.
Field Summary | |
(package private) boolean |
alive
Flag that indicates if the thread is still alive |
private MemoryCache |
cache
The MemoryCache instance which this shrinker is watching |
private static org.apache.commons.logging.Log |
log
|
private long |
maxMemoryIdleTime
Maximum memory idle time for the whole cache |
private long |
shrinkerInterval
The time to sleep between shrink runs |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
ShrinkerThread(MemoryCache cache)
Constructor for the ShrinkerThread object. |
Method Summary | |
private boolean |
checkForRemoval(ICacheElement cacheElement,
long now)
Check if either lifetime or idletime has expired for the provided event, and remove it from the cache if so. |
private void |
handleElementEvents(ICacheElement cacheElement,
int eventType)
Handle any events registered for the given element of the given event type. |
void |
kill()
Graceful shutdown after this round of processing. |
void |
run()
Main processing method for the ShrinkerThread object |
protected void |
shrink()
This method is called when the thread wakes up. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final org.apache.commons.logging.Log log
private final MemoryCache cache
private final long shrinkerInterval
private final long maxMemoryIdleTime
boolean alive
Constructor Detail |
public ShrinkerThread(MemoryCache cache)
cache
- The MemoryCache which the new shrinker should watch.Method Detail |
public void kill()
public void run()
protected void shrink()
private boolean checkForRemoval(ICacheElement cacheElement, long now) throws java.io.IOException
cacheElement
- Element to check for expirationnow
- Time to consider expirations relative to
java.io.IOException
private void handleElementEvents(ICacheElement cacheElement, int eventType) throws java.io.IOException
cacheElement
- Element to handle events foreventType
- Type of event to handle
java.io.IOException
- If an error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |