com.smaxe.me.core
Class AsyncWorker

java.lang.Object
  extended by com.smaxe.me.core.AsyncWorker
All Implemented Interfaces:
Executor, ExecutorService

public final class AsyncWorker
extends java.lang.Object
implements ExecutorService

AsyncWorker - ExecutorService implementation that executes tasks one by one asynchronously, i.e. in the separate thread.

Author:
Andrei Sochirca

Constructor Summary
AsyncWorker()
          Constructor.
AsyncWorker(java.lang.String name)
          Creates Worker.
AsyncWorker(java.lang.String name, int priority)
          Constructor.
 
Method Summary
 void execute(java.lang.Runnable task)
          Executes the given task at some time in the future.
 void shutdown()
          Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncWorker

public AsyncWorker(java.lang.String name,
                   int priority)
Constructor.

Parameters:
name - worker name
priority - worker thread priority

AsyncWorker

public AsyncWorker(java.lang.String name)
Creates Worker.

Parameters:
name - worker name

AsyncWorker

public AsyncWorker()
Constructor.

Method Detail

execute

public void execute(java.lang.Runnable task)
Description copied from interface: Executor
Executes the given task at some time in the future. The task may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Specified by:
execute in interface Executor
Parameters:
task - task to execute

shutdown

public void shutdown()
Description copied from interface: ExecutorService
Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down.

Specified by:
shutdown in interface ExecutorService