org.fcrepo.server.storage
Class DOReaderCache

java.lang.Object
  extended by java.lang.Thread
      extended by org.fcrepo.server.storage.DOReaderCache
All Implemented Interfaces:
Runnable

public class DOReaderCache
extends Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DOReaderCache(int maxReaders, int maxCachedSeconds)
           
 
Method Summary
 void close()
           
 DOReader get(String pid)
          Get a DOReader from the cache.
 void put(DOReader reader)
          Add a DOReader to the cache.
 void remove(String pid)
          Remove a DOReader from the cache.
 void run()
          Until closed, check for and remove any expired entries every second.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DOReaderCache

public DOReaderCache(int maxReaders,
                     int maxCachedSeconds)
Method Detail

run

public void run()
Until closed, check for and remove any expired entries every second.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

remove

public void remove(String pid)
Remove a DOReader from the cache. If it doesn't exist in the cache, do nothing.


put

public void put(DOReader reader)
Add a DOReader to the cache. If it already exists in the cache, refresh the DOReader in the cache.


get

public DOReader get(String pid)
Get a DOReader from the cache. If it doesn't exist in the cache, return null. If it does exist, set its time to the current time and return it.


close

public void close()


Copyright © 2011 DuraSpace. All Rights Reserved.