com.eurotech.framework.core.util
Class ExecutorUtil

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by java.util.concurrent.ScheduledThreadPoolExecutor
              extended by com.eurotech.framework.core.util.ExecutorUtil
All Implemented Interfaces:
Executor, ExecutorService, ScheduledExecutorService

public class ExecutorUtil
extends ScheduledThreadPoolExecutor

ExecutorUtil should be used for any asynchronous threads to be kicked off by a bundle/service. ExecutorUtil centralizes the number of threads running in the whole JVM instance by controlling the Thread pool and queuing tasks if resources are not available. TODO: use configuration service/file to parametrize this as sizing may depend on the hardware configuration


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
 
Method Summary
static ExecutorUtil getInstance()
          Returns the ExecutorUtil instance that should be used by all service/bundles when they need to kick off background or asynchronous tasks.
 
Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, remove, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, shutdown, shutdownNow, submit, submit, submit
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
 

Method Detail

getInstance

public static ExecutorUtil getInstance()
Returns the ExecutorUtil instance that should be used by all service/bundles when they need to kick off background or asynchronous tasks.

Returns:
ExecutorUtil


Copyright © 2013. All Rights Reserved.