Runnable
that handles the object that is added to the queue. In order to create a new service, create an instance of this class and then do: instance.startExecutorService("myService");
. When done call {@link #shutdown()}.
In order to use the service created above, call {@link #submit(EventHandler)}. Register pre- and post- processing listeners by registering your implementation of {@link EventHandler.EventHandlerListener} with{@link #registerListener(EventHandler.EventType,EventHandler.EventHandlerListener)}. Be sure to deregister your listener when done via {@link #unregisterListener(EventHandler.EventType)}.
{@code}void shutdownAndAwaitTermination(ExecutorService pool) pool.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!pool.awaitTermination(60, TimeUnit.SECONDS)) { pool.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!pool.awaitTermination(60, TimeUnit.SECONDS)) System.err.println("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted pool.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }}
Memory consistency effects: Actions in a thread prior to the submission of a {@code Runnable} or {@code Callable} task to an{@code ExecutorService}happen-before any actions taken by that task, which in turn happen-before the result is retrieved via {@code Future.get()}. @since 1.5 @author Doug Lea
Runnable
that handles the object that is added to the queue. In order to create a new service, create an instance of this class and then do: instance.startExecutorService("myService");
. When done call {@link #shutdown()}.
In order to use the service created above, call {@link #submit(EventHandler)}. Register pre- and post- processing listeners by registering your implementation of {@link EventHandler.EventHandlerListener}with {@link #registerListener(EventHandler.EventType,EventHandler.EventHandlerListener)}. Be sure to deregister your listener when done via {@link #unregisterListener(EventHandler.EventType)}.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|