de.fzj.unicore.wsrflite
Class ResourcePool

java.lang.Object
  extended by de.fzj.unicore.wsrflite.ResourcePool

public class ResourcePool
extends Object

Resource pool providing centralized thread/execution management Offers scheduled execution, and an execution queue.
In the simplest form:
Runnable task=...; ResourcePool.getExecutorService().execute(task);

Since:
1.8.5
Author:
schuller
See Also:
ExecutorService, ScheduledExecutorService

Field Summary
static String CORE_POOL_SIZE
          property key for setting the core thread pool size for the scheduled execution service
static String EXEC_CORE_POOL_SIZE
          property key for setting the minimum thread pool size for the scheduled execution service
static String EXEC_MAX_POOL_SIZE
          property key for setting the maximum thread pool size for the scheduled execution service
static String EXEC_POOL_TIMEOUT
          property key for setting the timeout in millis for removing idle threads
static String POOL_TIMEOUT
          property key for setting the timeout in millis for removing idle threads
 
Method Summary
protected static void configure()
          Configure the pool.
protected static void configureExecutor()
           
protected static void configureScheduler()
           
static int getExecutorActiveThreadCount()
           
static int getExecutorCorePoolSize()
           
static int getExecutorMaxPoolSize()
           
static ExecutorService getExecutorService()
          get a ExecutorService for executing tasks
static int getScheduledExecutorActiveThreadCount()
          get the number of currently active threads in the scheduler pool
static int getScheduledExecutorCorePoolSize()
          get the current minimum pool size of the scheduler pool
static int getScheduledExecutorMaxPoolSize()
          get the current maximum pool size of the scheduler pool
static ScheduledExecutorService getScheduledExecutorService()
          get a ScheduledExecutorService for executing tasks at a given schedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CORE_POOL_SIZE

public static final String CORE_POOL_SIZE
property key for setting the core thread pool size for the scheduled execution service

See Also:
Constant Field Values

POOL_TIMEOUT

public static final String POOL_TIMEOUT
property key for setting the timeout in millis for removing idle threads

See Also:
Constant Field Values

EXEC_CORE_POOL_SIZE

public static final String EXEC_CORE_POOL_SIZE
property key for setting the minimum thread pool size for the scheduled execution service

See Also:
Constant Field Values

EXEC_MAX_POOL_SIZE

public static final String EXEC_MAX_POOL_SIZE
property key for setting the maximum thread pool size for the scheduled execution service

See Also:
Constant Field Values

EXEC_POOL_TIMEOUT

public static final String EXEC_POOL_TIMEOUT
property key for setting the timeout in millis for removing idle threads

See Also:
Constant Field Values
Method Detail

getScheduledExecutorService

public static ScheduledExecutorService getScheduledExecutorService()
get a ScheduledExecutorService for executing tasks at a given schedule

Returns:

getExecutorService

public static ExecutorService getExecutorService()
get a ExecutorService for executing tasks

Returns:
ExecutorService

configure

protected static void configure()
Configure the pool. Properties are read from the Kernel properties.


configureScheduler

protected static void configureScheduler()

configureExecutor

protected static void configureExecutor()

getScheduledExecutorCorePoolSize

public static int getScheduledExecutorCorePoolSize()
get the current minimum pool size of the scheduler pool


getScheduledExecutorMaxPoolSize

public static int getScheduledExecutorMaxPoolSize()
get the current maximum pool size of the scheduler pool


getScheduledExecutorActiveThreadCount

public static int getScheduledExecutorActiveThreadCount()
get the number of currently active threads in the scheduler pool


getExecutorCorePoolSize

public static int getExecutorCorePoolSize()

getExecutorMaxPoolSize

public static int getExecutorMaxPoolSize()

getExecutorActiveThreadCount

public static int getExecutorActiveThreadCount()


Copyright © 2010. All Rights Reserved.