| java.lang.Object com.gargoylesoftware.htmlunit.ThreadManager
ThreadManager | public class ThreadManager (Code) | | INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
This is a class that provides thread handling services to internal clients
as well as exposes some of the status of these threads to the public API.
version: $Revision: 2132 $ author: Brad Clarke author: Marc Guillemot author: Daniel Gredler |
Method Summary | |
public int | activeCount() | public void | interruptAll() INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Attempts to stop running threads. | public boolean | joinAll(long maxWaitMillis) Wait for any executing background threads to complete.
Parameters: maxWaitMillis - The maximum time that should be waited, in milliseconds.This is not an exact time but will be fairly close. | public int | startThread(Runnable job, String label) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Starts a new job on a background thread. | public void | stopThread(int threadID) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Stops a thread that was started in this thread manager.
Note: this does not immediately stop the thread, only interrupt
it and remove it from being tracked by this manager. | public String | toString() |
activeCount | public int activeCount()(Code) | | The number of tracked threads. |
interruptAll | public void interruptAll()(Code) | | INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Attempts to stop running threads.
|
joinAll | public boolean joinAll(long maxWaitMillis)(Code) | | Wait for any executing background threads to complete.
Parameters: maxWaitMillis - The maximum time that should be waited, in milliseconds.This is not an exact time but will be fairly close. true if all threads expired in the specified time |
startThread | public int startThread(Runnable job, String label)(Code) | | INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Starts a new job on a background thread. Threads started by this method
are always considered daemon threads and will not prevent the JVM from
shutting down. For our purposes the JUnit test is the only thread that
matters and the background threads are just there to keep the HtmlUnit
objects as up to date as possible.
Parameters: job - The job to start Parameters: label - a job description ID of the new thread, suitable for use in JavaScript and requiredwhen calling ThreadManager.stopThread(int) |
stopThread | public void stopThread(int threadID)(Code) | | INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Stops a thread that was started in this thread manager.
Note: this does not immediately stop the thread, only interrupt
it and remove it from being tracked by this manager. The thread
is responsible for handling being interrupted properly and shutting
itself down.
Parameters: threadID - the ID of the thread to stop |
|
|