edu.ucsb.adl.middleware
Class CacheLoaderThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--edu.ucsb.adl.middleware.CacheLoaderThread
All Implemented Interfaces:
java.lang.Runnable

public final class CacheLoaderThread
extends java.lang.Thread

Background thread that preloads a metadata cache.

This class is implemented as a kind of macro on top of the identifiers and metadata middleware services. As such, it suffers from three limitations:

Put another way, the fact that limitations such as the above arise can be seen as a limitation of the middleware architecture as a whole.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/CacheLoaderThread.java,v 1.1 2006/06/30 06:45:51 gjanee Exp $

$Log: CacheLoaderThread.java,v $ Revision 1.1 2006/06/30 06:45:51 gjanee Initial revision

Author:
Greg Janée
Alexandria Digital Library

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CacheLoaderThread(edu.ucsb.adl.middleware.Global global, javax.servlet.ServletRequest request, java.lang.String collection, java.lang.String view, java.lang.String cacheDirectory)
          Creates the thread.
 
Method Summary
 java.lang.String getCollection()
          Returns the collection the thread is operating on.
 java.lang.String getException()
          Returns the exception that prematurely terminated the thread's processing.
 java.lang.String getStatus()
          Returns the thread's current state.
 java.lang.String getView()
          Returns the metadata view the thread is operating on.
 void run()
           
 void stopASAP()
          Requests that the thread stop as soon as possible.
 
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
 

Constructor Detail

CacheLoaderThread

public CacheLoaderThread(edu.ucsb.adl.middleware.Global global,
                         javax.servlet.ServletRequest request,
                         java.lang.String collection,
                         java.lang.String view,
                         java.lang.String cacheDirectory)
                  throws InternalErrorException
Creates the thread.

Parameters:
global - The global object representing this instance of the middleware.
request - The servlet request to use to invoke the middleware services.
collection - The collection, e.g., "adl_catalog".
view - The metadata view, e.g., "adl:bucket".
cacheDirectory - The cache directory pathname.
Throws:
InternalErrorException - If any error occurs.
Method Detail

stopASAP

public void stopASAP()
Requests that the thread stop as soon as possible.


getStatus

public java.lang.String getStatus()
Returns the thread's current state. This method may be invoked even after the thread has finished.

Returns:
The current state.

getCollection

public java.lang.String getCollection()
Returns the collection the thread is operating on. This method may be invoked even after the thread has finished.

Returns:
The collection.

getView

public java.lang.String getView()
Returns the metadata view the thread is operating on. This method may be invoked even after the thread has finished.

Returns:
The view.

getException

public java.lang.String getException()
Returns the exception that prematurely terminated the thread's processing. This method may be invoked even after the thread has finished.

Returns:
The exception, or null.

run

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