marf.util
Class ExpandedThreadGroup

java.lang.Object
  extended by java.lang.ThreadGroup
      extended by marf.util.ExpandedThreadGroup
All Implemented Interfaces:
java.lang.Thread.UncaughtExceptionHandler

public class ExpandedThreadGroup
extends java.lang.ThreadGroup

Provides some useful extensions to java.lang.ThreadGroup one would normally expect to be in a "group".

Maintains local references to the group-belonging threads for extra group control in a form of a Vector.

$Id: ExpandedThreadGroup.java,v 1.15 2007/12/23 06:29:47 mokhov Exp $

Since:
0.3.0.1
Version:
$Revision: 1.15 $
Author:
Serguei Mokhov

Field Summary
protected  java.util.Vector oGroup
          Local references to the threads belonging to this group.
 
Constructor Summary
ExpandedThreadGroup(ExpandedThreadGroup poParent, java.lang.String pstrName)
          Mimics parent's constructor.
ExpandedThreadGroup(java.lang.String pstrName)
          Mimics parent's constructor.
ExpandedThreadGroup(java.lang.ThreadGroup poParent, java.lang.String pstrName)
          ThreadGroup and name constructor inherited from the parent.
 
Method Summary
 void addThread(java.lang.Thread poThread)
          Adds specified thread to the local reference list.
 java.lang.Thread[] enumerate(boolean pbActiveThreads)
          Provides an enumeration that allocates a new array and populates it with currently active threads with ThreadGroup's enumerate().
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 void join()
          Wait for all the threads in the group to terminate.
 void start()
          Starts all non-started threads in this group.
 
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, uncaughtException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

oGroup

protected java.util.Vector oGroup
Local references to the threads belonging to this group.

Constructor Detail

ExpandedThreadGroup

public ExpandedThreadGroup(java.lang.ThreadGroup poParent,
                           java.lang.String pstrName)
ThreadGroup and name constructor inherited from the parent.

Parameters:
poParent - Parent group
pstrName - Group's name

ExpandedThreadGroup

public ExpandedThreadGroup(java.lang.String pstrName)
Mimics parent's constructor.

Parameters:
pstrName - Group's name

ExpandedThreadGroup

public ExpandedThreadGroup(ExpandedThreadGroup poParent,
                           java.lang.String pstrName)
Mimics parent's constructor.

Parameters:
poParent - Parent group
pstrName - Group's name
Method Detail

start

public void start()
Starts all non-started threads in this group.


join

public void join()
          throws java.lang.InterruptedException
Wait for all the threads in the group to terminate.

Throws:
java.lang.InterruptedException - if one of the threads is interrupted or a thread group has been started

enumerate

public java.lang.Thread[] enumerate(boolean pbActiveThreads)
Provides an enumeration that allocates a new array and populates it with currently active threads with ThreadGroup's enumerate().

Parameters:
pbActiveThreads - if only active threads needed, false if all
Returns:
array of threads belonging to this group

addThread

public void addThread(java.lang.Thread poThread)
Adds specified thread to the local reference list.

Parameters:
poThread - thread object to add

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string


SourceForge Logo