com.sun.grizzly.util
Class DefaultThreadPool
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
com.sun.grizzly.util.DefaultThreadPool
- All Implemented Interfaces:
- ExtendedThreadPool, Thread.UncaughtExceptionHandler, Executor, ExecutorService
public class DefaultThreadPool
- extends ThreadPoolExecutor
- implements ExecutorService, ExtendedThreadPool, Thread.UncaughtExceptionHandler
Thread Pool implementation, based on ThreadPoolExecutor
- Author:
- Alexey Stashok
Methods inherited from class java.util.concurrent.ThreadPoolExecutor |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated |
Methods inherited from interface java.util.concurrent.ExecutorService |
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submit |
Methods inherited from interface com.sun.grizzly.util.ExtendedThreadPool |
getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getTaskCount, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize |
DEFAULT_MIN_THREAD_COUNT
public static int DEFAULT_MIN_THREAD_COUNT
DEFAULT_MAX_THREAD_COUNT
public static int DEFAULT_MAX_THREAD_COUNT
DEFAULT_MAX_TASKS_QUEUED
public static int DEFAULT_MAX_TASKS_QUEUED
DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT
public static int DEFAULT_IDLE_THREAD_KEEPALIVE_TIMEOUT
name
protected String name
maxTasksCount
protected int maxTasksCount
workerThreadCounter
protected AtomicInteger workerThreadCounter
priority
protected int priority
- Threads priority
initialByteBufferSize
protected int initialByteBufferSize
- The initial ByteBuffer size for newly created WorkerThread instances
byteBufferType
protected ByteBufferFactory.ByteBufferType byteBufferType
- The
ByteBufferFactory.ByteBufferType
DefaultThreadPool
public DefaultThreadPool()
DefaultThreadPool
public DefaultThreadPool(int corePoolSize,
int maximumPoolSize,
int maxTasksCount,
long keepAliveTime,
TimeUnit unit)
getQueuedTasksCount
public int getQueuedTasksCount()
getMaxQueuedTasksCount
public int getMaxQueuedTasksCount()
- Specified by:
getMaxQueuedTasksCount
in interface ExtendedThreadPool
setMaxQueuedTasksCount
public void setMaxQueuedTasksCount(int maxTasksCount)
- Specified by:
setMaxQueuedTasksCount
in interface ExtendedThreadPool
getName
public String getName()
- Specified by:
getName
in interface ExtendedThreadPool
setName
public void setName(String name)
- Specified by:
setName
in interface ExtendedThreadPool
getPriority
public int getPriority()
setPriority
public void setPriority(int priority)
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.
getByteBufferType
public ByteBufferFactory.ByteBufferType getByteBufferType()
setByteBufferType
public void setByteBufferType(ByteBufferFactory.ByteBufferType byteBufferType)
getInitialByteBufferSize
public int getInitialByteBufferSize()
setInitialByteBufferSize
public void setInitialByteBufferSize(int initialByteBufferSize)
start
public void start()
stop
public void stop()
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
toString
public String toString()
- Overrides:
toString
in class Object
injectToStringAttributes
protected void injectToStringAttributes(StringBuilder sb)
Copyright © 2008 SUN Microsystems. All Rights Reserved.