org.jboss.threads
Class SimpleQueueExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.jboss.threads.SimpleQueueExecutor
All Implemented Interfaces:
java.util.concurrent.Executor, java.util.concurrent.ExecutorService, ThreadPoolExecutorMBean

public final class SimpleQueueExecutor
extends java.util.concurrent.AbstractExecutorService
implements java.util.concurrent.ExecutorService, ThreadPoolExecutorMBean

An executor which uses a regular queue to hold tasks. The executor may be tuned at runtime in many ways.


Constructor Summary
SimpleQueueExecutor(java.lang.String name, int corePoolSize, int maxPoolSize, long keepAliveTime, java.util.concurrent.TimeUnit keepAliveTimeUnit, java.util.Queue<java.lang.Runnable> queue, java.util.concurrent.ThreadFactory threadFactory, RejectionPolicy rejectionPolicy, java.util.concurrent.Executor handoffExecutor)
           
 
Method Summary
 boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
           
 void destroy()
           
 void execute(java.lang.Runnable task)
           
 int getCorePoolSize()
           
 int getCurrentPoolSize()
           
 long getKeepAliveTime()
           
 int getLargestPoolSize()
           
 int getMaxPoolSize()
           
 java.lang.String getName()
           
 int getRejectedCount()
           
 RejectionPolicy getRejectionPolicy()
           
 boolean isAllowCoreThreadTimeout()
           
 boolean isShutdown()
           
 boolean isTerminated()
           
 void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout)
           
 void setCorePoolSize(int corePoolSize)
           
 void setKeepAliveTime(long milliseconds)
           
 void setKeepAliveTime(long keepAliveTime, java.util.concurrent.TimeUnit keepAliveTimeUnit)
           
 void setMaxPoolSize(int maxPoolSize)
           
 void setRejectionPolicy(RejectionPolicy newPolicy, java.util.concurrent.Executor handoffExecutor)
           
 void shutdown()
           
 java.util.List<java.lang.Runnable> shutdownNow()
           
 void stop()
           
 
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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.ExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit
 

Constructor Detail

SimpleQueueExecutor

public SimpleQueueExecutor(java.lang.String name,
                           int corePoolSize,
                           int maxPoolSize,
                           long keepAliveTime,
                           java.util.concurrent.TimeUnit keepAliveTimeUnit,
                           java.util.Queue<java.lang.Runnable> queue,
                           java.util.concurrent.ThreadFactory threadFactory,
                           RejectionPolicy rejectionPolicy,
                           java.util.concurrent.Executor handoffExecutor)
Method Detail

execute

public void execute(java.lang.Runnable task)
             throws java.util.concurrent.RejectedExecutionException
Specified by:
execute in interface java.util.concurrent.Executor
Throws:
java.util.concurrent.RejectedExecutionException

shutdown

public void shutdown()
Specified by:
shutdown in interface java.util.concurrent.ExecutorService

shutdownNow

public java.util.List<java.lang.Runnable> shutdownNow()
Specified by:
shutdownNow in interface java.util.concurrent.ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface java.util.concurrent.ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface java.util.concurrent.ExecutorService

awaitTermination

public boolean awaitTermination(long timeout,
                                java.util.concurrent.TimeUnit unit)
                         throws java.lang.InterruptedException
Specified by:
awaitTermination in interface java.util.concurrent.ExecutorService
Throws:
java.lang.InterruptedException

isAllowCoreThreadTimeout

public boolean isAllowCoreThreadTimeout()
Specified by:
isAllowCoreThreadTimeout in interface ThreadPoolExecutorMBean

setAllowCoreThreadTimeout

public void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout)
Specified by:
setAllowCoreThreadTimeout in interface ThreadPoolExecutorMBean

getCorePoolSize

public int getCorePoolSize()
Specified by:
getCorePoolSize in interface ThreadPoolExecutorMBean

setCorePoolSize

public void setCorePoolSize(int corePoolSize)
Specified by:
setCorePoolSize in interface ThreadPoolExecutorMBean

getMaxPoolSize

public int getMaxPoolSize()
Specified by:
getMaxPoolSize in interface ThreadPoolExecutorMBean

setMaxPoolSize

public void setMaxPoolSize(int maxPoolSize)
Specified by:
setMaxPoolSize in interface ThreadPoolExecutorMBean

getKeepAliveTime

public long getKeepAliveTime()
Specified by:
getKeepAliveTime in interface ThreadPoolExecutorMBean

setKeepAliveTime

public void setKeepAliveTime(long keepAliveTime,
                             java.util.concurrent.TimeUnit keepAliveTimeUnit)

setKeepAliveTime

public void setKeepAliveTime(long milliseconds)
Specified by:
setKeepAliveTime in interface ThreadPoolExecutorMBean

getRejectionPolicy

public RejectionPolicy getRejectionPolicy()

setRejectionPolicy

public void setRejectionPolicy(RejectionPolicy newPolicy,
                               java.util.concurrent.Executor handoffExecutor)

stop

public void stop()

destroy

public void destroy()

getName

public java.lang.String getName()
Specified by:
getName in interface ThreadPoolExecutorMBean

getCurrentPoolSize

public int getCurrentPoolSize()
Specified by:
getCurrentPoolSize in interface ThreadPoolExecutorMBean

getLargestPoolSize

public int getLargestPoolSize()
Specified by:
getLargestPoolSize in interface ThreadPoolExecutorMBean

getRejectedCount

public int getRejectedCount()
Specified by:
getRejectedCount in interface ThreadPoolExecutorMBean


Copyright © 2011. All Rights Reserved.