org.w3c.www.protocol.http.cache
Class SimpleCacheSweeper

java.lang.Object
  extended by java.lang.Thread
      extended by org.w3c.www.protocol.http.cache.CacheSweeper
          extended by org.w3c.www.protocol.http.cache.SimpleCacheSweeper
All Implemented Interfaces:
java.lang.Runnable

public class SimpleCacheSweeper
extends CacheSweeper


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  int state
           
 
Fields inherited from class org.w3c.www.protocol.http.cache.CacheSweeper
STATE_CLEAN_GENERATIONS, STATE_CLEAN_STORED, STATE_FORCE_CLEAN_GENERATIONS, STATE_FORCE_CLEAN_STORED
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SimpleCacheSweeper()
           
 
Method Summary
protected  long collectCached(CacheGeneration generation, long bytes, boolean check)
          collect the existing resources
protected  long collectCached(long bytes, boolean check)
          collect the existing resources
protected  void collectStored()
          collect the still stored resources in the whole cache It will NOT block the cache during the process
protected  void collectStored(CacheGeneration generation)
          collect the still stored resources
 void garbageCollect()
          Run the garbage collector.
 void initialize(CacheFilter filter)
          initialize the sweeper
 void run()
           
protected  void setState(int state)
          change the state of the Sweeper
 void signal()
          Used to trigger a signal
 void waitSignal()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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

state

protected int state
Constructor Detail

SimpleCacheSweeper

public SimpleCacheSweeper()
Method Detail

signal

public void signal()
Used to trigger a signal

Specified by:
signal in class CacheSweeper

waitSignal

public void waitSignal()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

garbageCollect

public void garbageCollect()
Run the garbage collector.


setState

protected void setState(int state)
change the state of the Sweeper

Specified by:
setState in class CacheSweeper
Parameters:
an - integer, setting the new cache state

collectStored

protected void collectStored(CacheGeneration generation)
collect the still stored resources

Specified by:
collectStored in class CacheSweeper
Parameters:
generation, - the CacheGeneration to clean

collectStored

protected void collectStored()
collect the still stored resources in the whole cache It will NOT block the cache during the process

Specified by:
collectStored in class CacheSweeper

collectCached

protected long collectCached(CacheGeneration generation,
                             long bytes,
                             boolean check)
collect the existing resources

Specified by:
collectCached in class CacheSweeper
Parameters:
generation, - the CacheGeneration to clean
bytes, - a long. The number of bytes to collect
check, - a boolean. If true, then only the stale resources will be removed
Returns:
a long, the number of collected bytes

collectCached

protected long collectCached(long bytes,
                             boolean check)
collect the existing resources

Specified by:
collectCached in class CacheSweeper
Parameters:
bytes, - a long. The number of bytes to collect
check, - a boolean. If true, then only the stale resources will be removed
Returns:
a long, the number of collected bytes

initialize

public void initialize(CacheFilter filter)
initialize the sweeper

Specified by:
initialize in class CacheSweeper