com.sun.grizzly.threadpool
Class DefaultScheduleThreadPool

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by java.util.concurrent.ScheduledThreadPoolExecutor
              extended by com.sun.grizzly.threadpool.DefaultScheduleThreadPool
All Implemented Interfaces:
ExtendedThreadPool, Thread.UncaughtExceptionHandler, Executor, ExecutorService, ScheduledExecutorService

public class DefaultScheduleThreadPool
extends ScheduledThreadPoolExecutor
implements ExtendedThreadPool, Thread.UncaughtExceptionHandler

Thread Pool implementation, based on ScheduledThreadPoolExecutor

Author:
Alexey Stashok

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
 
Field Summary
protected  AttributeBuilder attributeBuilder
          AttributeBuilder to index WorkerThread attributes
 
Constructor Summary
DefaultScheduleThreadPool()
           
DefaultScheduleThreadPool(int corePoolSize)
           
 
Method Summary
protected  void afterExecute(Runnable r, Throwable t)
           
protected  void beforeExecute(Thread t, Runnable r)
           
 AttributeBuilder getAttributeBuilder()
           
 int getMaxQueuedTasksCount()
           
 String getName()
           
 int getQueuedTasksCount()
           
 int getQueueSize()
          Returns the number of tasks, which are currently waiting in the queue.
 void setAttributeBuilder(AttributeBuilder attributeBuilder)
           
 void setMaxQueuedTasksCount(int maxTasksCount)
           
 void setName(String name)
           
 void start()
           
 void stop()
           
 void uncaughtException(Thread thread, Throwable throwable)
           
 
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
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, 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 com.sun.grizzly.threadpool.ExtendedThreadPool
getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getTaskCount, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize
 
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
 

Field Detail

attributeBuilder

protected AttributeBuilder attributeBuilder
AttributeBuilder to index WorkerThread attributes

Constructor Detail

DefaultScheduleThreadPool

public DefaultScheduleThreadPool()

DefaultScheduleThreadPool

public DefaultScheduleThreadPool(int corePoolSize)
Method Detail

getQueuedTasksCount

public int getQueuedTasksCount()

getMaxQueuedTasksCount

public int getMaxQueuedTasksCount()

setMaxQueuedTasksCount

public void setMaxQueuedTasksCount(int maxTasksCount)

getName

public String getName()
Specified by:
getName in interface ExtendedThreadPool

setName

public void setName(String name)
Specified by:
setName in interface ExtendedThreadPool

getQueueSize

public int getQueueSize()
Description copied from interface: ExtendedThreadPool
Returns the number of tasks, which are currently waiting in the queue.

Specified by:
getQueueSize in interface ExtendedThreadPool
Returns:
the number of tasks, which are currently waiting in the queue.

start

public void start()

stop

public void stop()

getAttributeBuilder

public AttributeBuilder getAttributeBuilder()
Specified by:
getAttributeBuilder in interface ExtendedThreadPool

setAttributeBuilder

public void setAttributeBuilder(AttributeBuilder attributeBuilder)
Specified by:
setAttributeBuilder in interface ExtendedThreadPool

uncaughtException

public void uncaughtException(Thread thread,
                              Throwable throwable)
Specified by:
uncaughtException in interface Thread.UncaughtExceptionHandler

beforeExecute

protected void beforeExecute(Thread t,
                             Runnable r)
Overrides:
beforeExecute in class ThreadPoolExecutor

afterExecute

protected void afterExecute(Runnable r,
                            Throwable t)
Overrides:
afterExecute in class ThreadPoolExecutor


Copyright © 2009 SUN Microsystems. All Rights Reserved.