Class Overview
A worker thread for processing queued references.
Reference
s can be
queued
automatically by the garbage collector.
If that feature is used, a daemon thread should be executing
this worker. It will pick up the queued references and pass them
on to a handler for appropriate processing.
Summary
Public Methods |
void
|
run()
The main loop of this worker.
|
void
|
shutdown()
Shuts down this worker.
|
String
|
toString()
Obtains a description of this worker.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.lang.Runnable
abstract
void
|
run()
Starts executing the active part of the class' code.
|
|
Fields
The handler for the references found.
The reference queue to monitor.
protected
Thread
workerThread
The thread executing this handler.
This attribute is also used as a shutdown indicator.
Public Constructors
Instantiates a new worker to listen for lost connections.
Parameters
queue
| the queue on which to wait for references |
handler
| the handler to pass the references to
|
Public Methods
public
void
run
()
The main loop of this worker.
If initialization succeeds, this method will only return
after shutdown()
. Only one thread can
execute the main loop at any time.
public
void
shutdown
()
Shuts down this worker.
It can be re-started afterwards by another call to run()
.
public
String
toString
()
Obtains a description of this worker.
Returns
- a descriptive string for this worker