|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.framework.concurrent.Executor
public class Executor
The Executor
is deegree's central place to:
The Executor
class is realized as a singleton and uses a cached thread pool
internally to minimize overhead for acquiring the necessary Thread
instances and to
manage the number of concurrent threads.
ExecutorService
,
ExecutionFinishedListener
Method Summary | ||
---|---|---|
static Executor |
getInstance()
Returns the only instance of this class (singleton pattern). |
|
|
performAsynchronously(java.util.concurrent.Callable<T> task,
ExecutionFinishedListener<T> finishedListener)
Performs a task asynchronously (in an independent thread) without any time limit. |
|
|
performAsynchronously(java.util.concurrent.Callable<T> task,
ExecutionFinishedListener<T> finishedListener,
long timeout)
Performs a task asynchronously (in an independent thread) with a given time limit. |
|
|
performSynchronously(java.util.concurrent.Callable<T> task,
long timeout)
Performs a task synchronously with a given timeout. |
|
|
performSynchronously(java.util.List<java.util.concurrent.Callable<T>> tasks)
Performs several tasks synchronously in parallel threads. |
|
|
performSynchronously(java.util.List<java.util.concurrent.Callable<T>> tasks,
long timeout)
Performs several tasks synchronously with a given timeout in parallel threads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Executor getInstance()
public <T> void performAsynchronously(java.util.concurrent.Callable<T> task, ExecutionFinishedListener<T> finishedListener)
T
- type of return valuetask
- task to be performed (specified in the Callable.call()
method)finishedListener
- notified when the method call finishes (succesfully or abnormally), may be nullpublic <T> void performAsynchronously(java.util.concurrent.Callable<T> task, ExecutionFinishedListener<T> finishedListener, long timeout)
T
- type of return valuetask
- task to be performed (specified in the Callable.call()
} method)finishedListener
- notified when the method call finishes (succesfully or abnormally), may be nulltimeout
- maximum time allowed for execution in millisecondspublic <T> T performSynchronously(java.util.concurrent.Callable<T> task, long timeout) throws java.util.concurrent.CancellationException, java.lang.InterruptedException, java.lang.Throwable
T
- type of return valuetask
- tasks to be performed (specified in the Callable.call()
method)timeout
- maximum time allowed for execution in milliseconds
java.util.concurrent.CancellationException
- if the execution time exceeds the specified timeout / thread has been cancelled
java.lang.InterruptedException
- if interrupted while waiting, in which case unfinished tasks are cancelled
java.lang.Throwable
- if the tasks throws an exception itselfpublic <T> java.util.List<ExecutionFinishedEvent<T>> performSynchronously(java.util.List<java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException
This method does not return before all tasks are finished (successfully or abnormally). For
each given Callable
, an independent thread is used. For each task, an
ExecutionFinishedEvent
is generated and returned.
T
- the result type of the callablestasks
- tasks to be performed (specified in the Callable.call()
methods)
java.lang.InterruptedException
- if the current thread was interrupted while waitingpublic <T> java.util.List<ExecutionFinishedEvent<T>> performSynchronously(java.util.List<java.util.concurrent.Callable<T>> tasks, long timeout) throws java.lang.InterruptedException
This method does not return before all tasks are finished (successfully or abnormally). For
each given Callable
, an independent thread is used. For each task, an
ExecutionFinishedEvent
is generated and returned.
T
- the result type of the taskstasks
- tasks to be performed (specified in the Callable.call()
methods)timeout
- maximum time allowed for execution (in milliseconds)
java.lang.InterruptedException
- if the current thread was interrupted while waiting
|
deegree 2.5 (2011/06/29 09:44 build-8-official) | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org