com.ibm.gcs.component
Class GCSThreadGroup
java.lang.Object
|
+--java.lang.ThreadGroup
|
+--com.ibm.gcs.component.GCSThreadGroup
- public class GCSThreadGroup
- extends java.lang.ThreadGroup
This is the basic ThreadGroup
model for GCS.
It is a set of GCSThread
,
with a GCSThreadGroupEvent
model for interrupting
and stopping the group in a synchronized manner.
The "GCSThreaded
" Crawler
and
Summarizer
each have their own GCSThreadGroup of worker threads.
Method Summary |
static void |
handleEvents()
handles any waiting GCSThreadGroupEvent s |
void |
interrupt(java.lang.String caller)
interrupts this thread |
void |
interruptAndJoin(ScheduleException ex)
interrupts and kill each thread in this thread group. |
void |
Join()
waits for this thread group to die |
void |
start()
starts all the threads in this threadgroup. |
int |
threadCountUpdate(boolean working)
updates the count of the number of working threads. |
void |
uncaughtException(java.lang.Thread thread,
java.lang.Throwable uncaughtException)
handles an uncaught exception that has killed a thread
by KILLING GCS!!! |
Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
awakeCount
public int awakeCount
GCSThreadGroup
public GCSThreadGroup(java.lang.String name,
GCSThreaded threaded,
int numThreads,
Gatherer gatherer)
- (constructor)
start
public final void start()
throws java.lang.SecurityException
- starts all the threads in this threadgroup.
(A barrier is created here, if additional threads get added later this will be a problem!)
Join
public final void Join()
- waits for this thread group to die
interruptAndJoin
public void interruptAndJoin(ScheduleException ex)
- interrupts and kill each thread in this thread group.
This works by adding an event to the event buffer, which the thread
picks up when it wakes up (and throws a ScheduleException).
To wake up the the thread from its sleep, keep interrupting it until
it handles the event.
- Parameters:
ex
- ScheduleException
to throw after interrupting this thread
interrupt
public void interrupt(java.lang.String caller)
- interrupts this thread
handleEvents
public static void handleEvents()
- handles any waiting
GCSThreadGroupEvent
s
uncaughtException
public void uncaughtException(java.lang.Thread thread,
java.lang.Throwable uncaughtException)
- handles an uncaught exception that has killed a thread
by KILLING GCS!!!
- Overrides:
uncaughtException
in class java.lang.ThreadGroup
threadCountUpdate
public int threadCountUpdate(boolean working)
- updates the count of the number of working threads.
NOTE: this is NOT synchronized itself to prevent deadlock,
but should be called only from within synchronized methods
(such as the gatherer status update methods).
(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.