com.gc.iotools.stream.base
Class ExecutorServiceFactory

java.lang.Object
  extended by com.gc.iotools.stream.base.ExecutorServiceFactory

public final class ExecutorServiceFactory
extends Object

This class is responsible of instantiating the right executor given an ExecutionModel.

Since:
1.0.2
Version:
$Id: ExecutorServiceFactory.java 463 2011-01-21 23:54:17Z dvd.smnt@gmail.com $
Author:
Davide Simonetti

Method Summary
static ExecutorService getExecutor(ExecutionModel tmodel)
          Getter for the field executor.
static void init()
           Call this method to initialize the ExecutorService that is used in STATIC_THREAD_POOL execution mode.
static void setDefaultThreadPoolExecutor(ExecutorService executor)
           Sets the default ExecutorService returned when this class is invoked with ExecutionModel.STATIC_THREAD_POOL.
static void shutDown()
           Call this method to finalize the execution queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getExecutor

public static ExecutorService getExecutor(ExecutionModel tmodel)

Getter for the field executor.

Parameters:
tmodel - a ExecutionModel object.
Returns:
a ExecutorService object.

init

public static void init()

Call this method to initialize the ExecutorService that is used in STATIC_THREAD_POOL execution mode.

See Also:
ExecutionModel.STATIC_THREAD_POOL, setDefaultThreadPoolExecutor(ExecutorService)

setDefaultThreadPoolExecutor

public static void setDefaultThreadPoolExecutor(ExecutorService executor)

Sets the default ExecutorService returned when this class is invoked with ExecutionModel.STATIC_THREAD_POOL.

It can also be used to initialize the class (for instance for use into a web application).

Parameters:
executor - ExecutorService for the STATIC_THREAD_POOL model.

shutDown

public static void shutDown()

Call this method to finalize the execution queue.

It is mandatory when you use this library in a container, otherwise the container doesn't terminate gracefully (for instance you can call it in a web application context listener ContextListener.shutdown() ).



Copyright © 2008-2011. All Rights Reserved.