com.planet_ink.coffee_mud.core.threads
Class CMThreadPoolExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by com.planet_ink.coffee_mud.core.threads.CMThreadPoolExecutor
All Implemented Interfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService

public class CMThreadPoolExecutor
extends java.util.concurrent.ThreadPoolExecutor


Nested Class Summary
protected static class CMThreadPoolExecutor.CMArrayBlockingQueue<E>
           
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
java.util.concurrent.ThreadPoolExecutor.AbortPolicy, java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardOldestPolicy, java.util.concurrent.ThreadPoolExecutor.DiscardPolicy
 
Field Summary
protected  java.util.Map<java.lang.Runnable,java.lang.Thread> active
           
protected  long lastRejectTime
           
protected  java.lang.String poolName
           
protected  int queueSize
           
protected  int rejectCount
           
protected  CMThreadFactory threadFactory
           
protected  long timeoutMillis
           
 
Constructor Summary
CMThreadPoolExecutor(java.lang.String poolName, int corePoolSize, int maximumPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit unit, long timeoutMins, int queueSize)
           
 
Method Summary
protected  void afterExecute(java.lang.Runnable r, java.lang.Throwable t)
           
protected  void beforeExecute(java.lang.Thread t, java.lang.Runnable r)
           
 void execute(java.lang.Runnable r)
           
 int getActiveCount()
           
 java.util.Collection<CMRunnable> getTimeoutOutRuns(int maxToKill)
           
 boolean isActive(java.lang.Runnable r)
           
 boolean isActiveOrQueued(java.lang.Runnable r)
           
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, 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 class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

protected java.util.Map<java.lang.Runnable,java.lang.Thread> active

timeoutMillis

protected long timeoutMillis

threadFactory

protected CMThreadFactory threadFactory

queueSize

protected int queueSize

poolName

protected java.lang.String poolName

lastRejectTime

protected volatile long lastRejectTime

rejectCount

protected volatile int rejectCount
Constructor Detail

CMThreadPoolExecutor

public CMThreadPoolExecutor(java.lang.String poolName,
                            int corePoolSize,
                            int maximumPoolSize,
                            long keepAliveTime,
                            java.util.concurrent.TimeUnit unit,
                            long timeoutMins,
                            int queueSize)
Method Detail

beforeExecute

protected void beforeExecute(java.lang.Thread t,
                             java.lang.Runnable r)
Overrides:
beforeExecute in class java.util.concurrent.ThreadPoolExecutor

afterExecute

protected void afterExecute(java.lang.Runnable r,
                            java.lang.Throwable t)
Overrides:
afterExecute in class java.util.concurrent.ThreadPoolExecutor

getActiveCount

public int getActiveCount()
Overrides:
getActiveCount in class java.util.concurrent.ThreadPoolExecutor

isActive

public boolean isActive(java.lang.Runnable r)

isActiveOrQueued

public boolean isActiveOrQueued(java.lang.Runnable r)

execute

public void execute(java.lang.Runnable r)
Specified by:
execute in interface java.util.concurrent.Executor
Overrides:
execute in class java.util.concurrent.ThreadPoolExecutor

getTimeoutOutRuns

public java.util.Collection<CMRunnable> getTimeoutOutRuns(int maxToKill)