Keel 2.1RC2

examples.util.concurrent
Class AsynchronousManager

java.lang.Object
  extended byexamples.util.concurrent.AsynchronousManager

public class AsynchronousManager
extends java.lang.Object

Manages the thread pool for all the asynchronous invocations.

Author:

Field Summary
protected static AsynchronousManager INSTANCE
           
protected  boolean m_initialized
           
protected  PooledExecutor m_threadPool
           
 
Constructor Summary
protected AsynchronousManager()
          Private constructor.
 
Method Summary
protected  void createBoundedThreadPool(int threadPoolMaxSize, int threadPoolMinSize, int threadPoolInitSize, int keepAliveTime, boolean waitWhenBlocked)
          Creates a bounded thread pool.
protected  void createDynamicThreadPool(int threadPoolMinSize, int threadPoolInitSize, int keepAliveTime)
          Creates a dynamic thread pool.
 void execute(java.lang.Runnable task)
          Executes a task in a thread from the thread pool.
static AsynchronousManager getInstance()
          Returns the one A only AsynchronousManager instance.
 void initialize(Definition definition)
          Initializes the thread pool.
protected  boolean notInitialized()
          Checks if the service has been initialized.
 void stop()
          Closes down the thread pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

protected static final AsynchronousManager INSTANCE

m_threadPool

protected PooledExecutor m_threadPool

m_initialized

protected boolean m_initialized
Constructor Detail

AsynchronousManager

protected AsynchronousManager()
Private constructor.

Method Detail

execute

public void execute(java.lang.Runnable task)
Executes a task in a thread from the thread pool.

Parameters:
task - the task to execute (Runnable)

getInstance

public static AsynchronousManager getInstance()
Returns the one A only AsynchronousManager instance.

Returns:
the asynchronous manager

initialize

public void initialize(Definition definition)
Initializes the thread pool.


stop

public void stop()
Closes down the thread pool.


createBoundedThreadPool

protected void createBoundedThreadPool(int threadPoolMaxSize,
                                       int threadPoolMinSize,
                                       int threadPoolInitSize,
                                       int keepAliveTime,
                                       boolean waitWhenBlocked)
Creates a bounded thread pool.

Parameters:
threadPoolMaxSize -
threadPoolMinSize -
threadPoolInitSize -
keepAliveTime -
waitWhenBlocked -

createDynamicThreadPool

protected void createDynamicThreadPool(int threadPoolMinSize,
                                       int threadPoolInitSize,
                                       int keepAliveTime)
Creates a dynamic thread pool.

Parameters:
threadPoolMinSize -
threadPoolInitSize -
keepAliveTime -

notInitialized

protected boolean notInitialized()
Checks if the service has been initialized.

Returns:
boolean

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.