|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.das2.system.RequestProcessor
public final class RequestProcessor
Utility class for synchronous execution.
This class maintains a pool of threads that are used to execute arbitrary
code. This class also serves as a central place to catch and handle
unchecked exceptions.
The invokeLater(java.lang.Runnable)
method is similar to the
SwingUtilities SwingUtilities.invokeLater(java.lang.Runnable)
method, except that the request is not executed on the event thread.
The invokeLater(java.lang.Runnable, java.lang.Object)
,
the invokeAfter(java.lang.Runnable, java.lang.Object)
,
and the waitFor(java.lang.Object)
methods are designed to work
together. Both of the first two methods execute code asynchronously with
respect to the calling thread. Multiple requests made with a call to
invokeLater that specified the same lock can execute at the same time,
but not while a request made with the invokeAfter with the same lock
is processing. Any requests made before an invokeAfter request with the
same lock will finish before that invokeAfter request begins. An
invokeAfter request will finish before any requests with the same lock made
after that invokeAfter request begins. The waitFor(java.lang.Object)
method will cause the calling thread to block until all requests with the
specified lock finish.
Method Summary | |
---|---|
static void |
invokeAfter(java.lang.Runnable run,
java.lang.Object lock)
Executes run.run() asynchronously on a thread from the thread pool. |
static void |
invokeLater(java.lang.Runnable run)
Executes run.run() asynchronously on a thread from the thread pool. |
static void |
invokeLater(java.lang.Runnable run,
java.lang.Object lock)
Executes run.run() asynchronously on a thread from the thread pool. |
static void |
waitFor(java.lang.Object lock)
Blocks until all tasks with the same lock have finished. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void invokeLater(java.lang.Runnable run)
run
- the task to be executed.public static void invokeLater(java.lang.Runnable run, java.lang.Object lock)
invokeAfter(java.lang.Runnable, java.lang.Object)
with the same
lock have finished.
run
- the taks to be executed.lock
- associates run with other tasks.public static void invokeAfter(java.lang.Runnable run, java.lang.Object lock)
invokeAfter(java.lang.Runnable, java.lang.Object)
or
invokeLater(java.lang.Runnable, java.lang.Object)
with the same
lock have finished.
run
- the taks to be executed.lock
- associates run with other tasks.public static void waitFor(java.lang.Object lock) throws java.lang.InterruptedException
lock
-
java.lang.InterruptedException
- if the current thread is
interrupted while waiting.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |