|
Forward Computing and Control Pty. Ltd. Threads Package V1.0.3 2005/04/11 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.EventObject
au.com.forward.threads.ThreadEvent
public class ThreadEvent
This class encapsulates a Thread
termination event.
See ThreadReturn
for more details.
This class contains the source thread, the type of termination and the return Object
or Throwable
.  It is used as the argument to the ThreadListener
methods.
Mods: 8th March 2003 - added implements Serializable added processing for Object arg.
Field Summary | |
---|---|
static int |
ERROR
This type indicates there was some error in the thread execution or monitoring. |
static int |
INTERRUPTED
This type indicates the thread saved either an InterruptedException or
a ClosedByInterruptException . |
static int |
RETURN
This type indicates the thread died normally. |
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
ThreadEvent(java.lang.Thread source,
java.lang.Object obj)
The thread died normally and saved this object for return. |
|
ThreadEvent(java.lang.Thread source,
java.lang.Throwable e)
The thread saved some Throwable or some error occurred
during the monitoring. |
Method Summary | |
---|---|
java.lang.Object |
getObject()
Gets the Object saved by the thread. |
java.lang.Thread |
getThread()
Gets the source Thread of this event. |
java.lang.Throwable |
getThrowable()
Gets the Throwable object saved by the thread. |
int |
getType()
Gets the type of this ThreadEvent |
java.lang.String |
toString()
Returns a string containing a description of this ThreadEvent . |
Methods inherited from class java.util.EventObject |
---|
getSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int RETURN
getObject()
returns the object saved by this thread, if any.
getThrowable()
will return null
.
getType()
,
Constant Field Valuespublic static final int INTERRUPTED
InterruptedException
or
a ClosedByInterruptException
.
getThrowable()
returns either InterruptedException
or
ClosedByInterruptException
getObject()
returns the exception as an Object
.
getType()
,
Constant Field Valuespublic static final int ERROR
getThrowable()
returns the associated Throwable
as a Throwable
.
getObject()
returns the associated Throwable
as an Object
.
getType()
,
Constant Field ValuesConstructor Detail |
---|
public ThreadEvent(java.lang.Thread source, java.lang.Object obj)
getType()
will return RETURN
source
- the Thread
being monitored.obj
- the Object
saved by the thread or null
if none saved.public ThreadEvent(java.lang.Thread source, java.lang.Throwable e)
Throwable
or some error occurred
during the monitoring.
getType()
will return INTERRUPTED
if the Throwable
is either InterruptedException
or
ClosedByInterruptException
otherwise it will return ERROR
source
- the Thread
being monitored.e
- the Throwable
describing the error.Method Detail |
---|
public int getType()
ThreadEvent
RETURN
, INTERRUPTED
or ERROR
public java.lang.Thread getThread()
Thread
of this event.
Thread
being monitored.public java.lang.Throwable getThrowable()
Throwable
object saved by the thread.
Returns null
if the thread did not save a Throwable
object.
Throwable
object or null
if none saved.public java.lang.Object getObject()
Object
saved by the thread.
If the thread saved a Throwable
object that object will be returned.
Object
saved by the thread or null
if none saved.public java.lang.String toString()
ThreadEvent
.
toString
in class java.util.EventObject
ThreadEvent
.
|
Forward Computing and Control Pty. Ltd. Threads Package V1.0.3 2005/04/11 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |