com.isti.util
Class IstiNotifyThread

java.lang.Object
  extended by java.lang.Thread
      extended by com.isti.util.IstiThread
          extended by com.isti.util.IstiNotifyThread
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ExtendedArchiveManager.AbstractWorkerThread, FileDownloader, FileMonPollingThread, IstiMessageCachedArchive.AddMessageWorkerThread, QWWebSvcsConnector.MessageFetchingThread, QWWebSvcsConnector.WebServicesConnectThread, QWWebSvcsConnector.WebServicesDisconnectThread, StatusCheckingThread

public class IstiNotifyThread
extends IstiThread

Class IstiThread extends 'Thread' to add wait/notify and terminate functionality. Subclasses should use the 'waitForNotify()' method to perform thread-sleep delays.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class com.isti.util.IstiThread
DEFAULT_TERMINATE_WAIT_TIME, terminateFlag
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IstiNotifyThread(java.lang.Runnable target, java.lang.String name)
          Allocates a new IstiNotifyThread object.
IstiNotifyThread(java.lang.String name)
          Allocates a new IstiNotifyThread object.
IstiNotifyThread(java.lang.ThreadGroup group, java.lang.Runnable target, java.lang.String name)
          Allocates a new IstiNotifyThread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.
IstiNotifyThread(java.lang.ThreadGroup group, java.lang.String name)
          Allocates a new IstiNotifyThread object.
 
Method Summary
static void sleep(long millis)
          Deprecated. Use 'waitForNotify()' instead.
 void terminate()
          Performs a thread-notify and terminates this thread if the thread is not terminated and alive.
 
Methods inherited from class com.isti.util.IstiThread
clearThreadWaitNotifyFlag, isTerminated, nextThreadNum, notifyThread, start, terminate, waitForNotify, waitForNotify, waitForTerminate, waitForTerminate, wasStarted
 
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, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IstiNotifyThread

public IstiNotifyThread(java.lang.Runnable target,
                        java.lang.String name)
Allocates a new IstiNotifyThread object. This constructor has the same effect as IstiNotifyThread(null, target, name).

Parameters:
target - the object whose run method is called.
name - the name of the new thread.

IstiNotifyThread

public IstiNotifyThread(java.lang.String name)
Allocates a new IstiNotifyThread object. This constructor has the same effect as IstiNotifyThread(null, null, name).

Parameters:
name - the name of the new thread.

IstiNotifyThread

public IstiNotifyThread(java.lang.ThreadGroup group,
                        java.lang.Runnable target,
                        java.lang.String name)
Allocates a new IstiNotifyThread object so that it has target as its run object, has the specified name as its name, and belongs to the thread group referred to by group.

If group is null, the group is set to be the same ThreadGroup as the thread that is creating the new thread.

If there is a security manager, its checkAccess method is called with the ThreadGroup as its argument. This may result in a SecurityException.

If the target argument is not null, the run method of the target is called when this thread is started. If the target argument is null, this thread's run method is called when this thread is started.

The priority of the newly created thread is set equal to the priority of the thread creating it, that is, the currently running thread. The method setPriority may be used to change the priority to a new value.

The newly created thread is initially marked as being a daemon thread if and only if the thread creating it is currently marked as a daemon thread. The method setDaemon may be used to change whether or not a thread is a daemon.

Parameters:
group - the thread group.
target - the object whose run method is called.
name - the name of the new thread.
Throws:
java.lang.SecurityException - if the current thread cannot create a thread in the specified thread group.

IstiNotifyThread

public IstiNotifyThread(java.lang.ThreadGroup group,
                        java.lang.String name)
Allocates a new IstiNotifyThread object. This constructor has the same effect as IstiNotifyThread(group, null, name)

Parameters:
group - the thread group.
name - the name of the new thread.
Throws:
java.lang.SecurityException - if the current thread cannot create a thread in the specified thread group.
Method Detail

terminate

public void terminate()
Performs a thread-notify and terminates this thread if the thread is not terminated and alive.

Overrides:
terminate in class IstiThread

sleep

public static void sleep(long millis)
                  throws java.lang.InterruptedException
Deprecated. Use 'waitForNotify()' instead.

This method is deprecated because it will not be interrupted by the 'notifyThread()' method. The 'waitForNotify()' method should be used instead for thread-sleep delays. Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds. The thread does not lose ownership of any monitors.

Parameters:
millis - the length of time to sleep in milliseconds.
Throws:
java.lang.InterruptedException - if another thread has interrupted the current thread. The interrupted status of the current thread is cleared when this exception is thrown.
See Also:
Object.notify()