public class

RefQueueWorker

extends Object
implements Runnable
java.lang.Object
   ↳ org.apache.http.impl.conn.tsccm.RefQueueWorker

Class Overview

A worker thread for processing queued references. References 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

Fields
protected final RefQueueHandler refHandler The handler for the references found.
protected final ReferenceQueue<?> refQueue The reference queue to monitor.
protected Thread workerThread The thread executing this handler.
Public Constructors
RefQueueWorker(ReferenceQueue<?> queue, RefQueueHandler handler)
Instantiates a new worker to listen for lost connections.
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
From interface java.lang.Runnable

Fields

protected final RefQueueHandler refHandler

Since: API Level 1

The handler for the references found.

protected final ReferenceQueue<?> refQueue

Since: API Level 1

The reference queue to monitor.

protected Thread workerThread

Since: API Level 1

The thread executing this handler. This attribute is also used as a shutdown indicator.

Public Constructors

public RefQueueWorker (ReferenceQueue<?> queue, RefQueueHandler handler)

Since: API Level 1

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 ()

Since: API Level 1

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 ()

Since: API Level 1

Shuts down this worker. It can be re-started afterwards by another call to run().

public String toString ()

Since: API Level 1

Obtains a description of this worker.

Returns
  • a descriptive string for this worker