|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.ArchiveManager com.isti.util.ExtendedArchiveManager
Class ExtendedArchiveManager extends an archive manager to support: optional queuing of archive items. optional purging of archive items. 9/30/2003 -- [KF] Initial version. 10/03/2003 -- [KF] Extend 'IstiThread' instead of 'Thread'. 11/06/2003 -- [KF] Log stack trace for IOException. 01/02/2004 -- [KF] Added polling option that may be used instead of thread interrupt. 3/31/2004 -- [ET] Changed reference to 'saveItemArchiveDate()' to 'checkItemArchiveDate()'. 7/12/2005 -- [ET] Modified to make 'AbstractWorkerThread' class extend 'IstiNotifyThread' to avoid use of thread 'interrupt()' calls that can be problematic under Solaris OS; made worker-thread classes into static member classes of main class. 3/21/2007 -- [ET] Added 'terminateWorkerThreads()' method.
Nested Class Summary | |
protected static class |
ExtendedArchiveManager.AbstractWorkerThread
Class AbstractWorkerThread is a general worker thread for archive managers. |
protected static class |
ExtendedArchiveManager.ArchiveItemWorkerThread
Class ArchiveItemWorkerThread fetches items from the queue and adds them to the archive. |
protected static class |
ExtendedArchiveManager.PurgeWorkerThread
Class PurgeWorkerThread purges items from the archive. |
Nested classes inherited from class com.isti.util.ArchiveManager |
ArchiveManager.ProcessCallBack |
Field Summary | |
protected java.util.Vector |
archiveItemQueueVec
The archive item queue vector. |
protected static ExtendedArchiveManager.ArchiveItemWorkerThread |
archiveItemWTObj
|
protected static java.lang.Object |
archiveItemWTSyncObj
|
protected static ExtendedArchiveManager.PurgeWorkerThread |
purgeWTObj
|
protected static java.lang.Object |
purgeWTSyncObj
|
Constructor Summary | |
ExtendedArchiveManager(java.lang.Class classObj,
java.lang.String archiveFileNameStr)
Creates a new instance of ExtendedArchiveManager to archive instances of the given class. |
|
ExtendedArchiveManager(java.lang.Class classObj,
java.lang.String archiveRootDirName,
java.lang.String archiveFileNameStr)
Creates a new instance of ExtendedArchiveManager to archive instances of the given class. |
Method Summary | |
protected void |
addToWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Adds this archive manager to the worker thread if it has not already been added. |
boolean |
archiveItem(Archivable item)
Inserts an item into the archive. |
protected void |
archiveQueuedItem(Archivable item)
Inserts an item into the archive. |
void |
closeArchive()
Releases resources allocated for this archive manager. |
long |
getArchivePollTime()
Gets the archive poll time. |
long |
getArchivePurgeAge()
Gets the archive purge age in milliseconds. |
boolean |
isArchiveItemQueueEnabled()
Determines if the archive item queue is enabled. |
protected boolean |
purgeArchive(long currentTime)
Purges items and archive files with an archive date older than the purge age if enable. |
protected void |
removeFromWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Removes this archive manager from the worker thread if it was added. |
void |
setArchiveItemQueueEnabled(boolean b)
Enables/disables the archive item queue. |
void |
setArchivePollTime(long archivePollTime)
Sets the archive poll time. |
void |
setArchivePurgeAge(long age)
Sets the archive purge age in milliseconds. |
protected void |
signalWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
Signals the worker thread. |
static void |
terminateWorkerThreads()
Terminates the worker threads started by this archive manager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.Vector archiveItemQueueVec
protected static final java.lang.Object archiveItemWTSyncObj
protected static ExtendedArchiveManager.ArchiveItemWorkerThread archiveItemWTObj
protected static final java.lang.Object purgeWTSyncObj
protected static ExtendedArchiveManager.PurgeWorkerThread purgeWTObj
Constructor Detail |
public ExtendedArchiveManager(java.lang.Class classObj, java.lang.String archiveFileNameStr) throws java.lang.NoSuchMethodException
classObj
- class object representing the class to be archived.archiveFileNameStr
- name to use for the archive file(s).
java.lang.NoSuchMethodException
- if a proper constructor does not exist
for the class.
java.lang.NullPointerException
- If archiveFileNameStr
is null
public ExtendedArchiveManager(java.lang.Class classObj, java.lang.String archiveRootDirName, java.lang.String archiveFileNameStr) throws java.lang.NoSuchMethodException
classObj
- class object representing the class to be archived.archiveRootDirName
- name of root directory in which to place
archive files (and possibly directories), or null to use the
current working directory.archiveFileNameStr
- name to use for the archive file(s).
java.lang.NoSuchMethodException
- if a proper constructor does not exist
for the class.
java.lang.NullPointerException
- If archiveFileNameStr
is null
Method Detail |
public boolean archiveItem(Archivable item) throws java.io.IOException
archiveItem
in class ArchiveManager
item
- the item to be archived.
java.io.IOException
- if the archive file can not be written to.public void closeArchive()
closeArchive
in class ArchiveManager
public long getArchivePurgeAge()
setArchivePurgeAge
public long getArchivePollTime()
public boolean isArchiveItemQueueEnabled()
setArchiveItemQueueEnabled
public void setArchiveItemQueueEnabled(boolean b)
b
- true to enable, false to disable.
NOTE: The archive poll time should be set prior to calling this method
via the 'setArchivePollTime' method.isArchiveItemQueueEnabled
,
setArchivePollTime
public void setArchivePollTime(long archivePollTime)
archivePollTime
- the archive poll time in milliseconds or 0
for interrupts (default).public void setArchivePurgeAge(long age)
age
- the archive purge age in milliseconds (0 for disabled.)getArchivePurgeAge
public static void terminateWorkerThreads()
protected void addToWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.protected void archiveQueuedItem(Archivable item) throws java.io.IOException
item
- the item to be archived.
java.io.IOException
- if the archive file can not be written to.protected void signalWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.protected boolean purgeArchive(long currentTime)
currentTime
- the current time in milliseconds.
setArchivePurgeAge, setArchivePurgeAge
protected void removeFromWorkerThread(ExtendedArchiveManager.AbstractWorkerThread wt)
wt
- the worker thread.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |