Top Inners Fields Constructors Methods
org.jboss.threads

public final Class JBossScheduledThreadPoolExecutor

extends ScheduledThreadPoolExecutor
Class Inheritance
Imports
java.util.concurrent.RejectedExecutionHandler, .ScheduledThreadPoolExecutor, .ThreadFactory, .ThreadPoolExecutor, .TimeUnit, java.util.concurrent.atomic.AtomicInteger

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final AtomicInteger
private final Runnable

Constructor Summary

AccessConstructor and Description
public
JBossScheduledThreadPoolExecutor(int corePoolSize, final Runnable terminationTask)

public
JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, final Runnable terminationTask)

public
JBossScheduledThreadPoolExecutor(int corePoolSize, RejectedExecutionHandler handler, final Runnable terminationTask)

public
JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, final Runnable terminationTask)

Method Summary

Modifier and TypeMethod and Description
public int
public long
public int
public int
public int
public int
public RejectedExecutionHandler
getRejectedExecutionHandler()

Overrides java.util.concurrent.ThreadPoolExecutor.getRejectedExecutionHandler.

Returns the current handler for unexecutable tasks.
public void
setKeepAliveTime(final long milliseconds)

public void
setKeepAliveTime(final long
the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.
time
,
final TimeUnit
the time unit of the time argument
unit
)

Overrides java.util.concurrent.ThreadPoolExecutor.setKeepAliveTime.

Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated.
public void
setMaxThreads(final int newSize)

public void
setRejectedExecutionHandler(final RejectedExecutionHandler
the new handler
handler
)

Overrides java.util.concurrent.ThreadPoolExecutor.setRejectedExecutionHandler.

Sets a new handler for unexecutable tasks.
protected void
terminated()

Overrides java.util.concurrent.ThreadPoolExecutor.terminated.

Method invoked when the Executor has terminated.
Inherited from java.util.concurrent.ScheduledThreadPoolExecutor:
decorateTaskdecorateTaskexecutegetContinueExistingPeriodicTasksAfterShutdownPolicygetExecuteExistingDelayedTasksAfterShutdownPolicygetQueuegetRemoveOnCancelPolicyscheduleschedulescheduleAtFixedRatescheduleWithFixedDelaysetContinueExistingPeriodicTasksAfterShutdownPolicysetExecuteExistingDelayedTasksAfterShutdownPolicysetRemoveOnCancelPolicyshutdownshutdownNowsubmitsubmitsubmit

Field Detail

rejectCountback to summary
private final AtomicInteger rejectCount
terminationTaskback to summary
private final Runnable terminationTask

Constructor Detail

JBossScheduledThreadPoolExecutorback to summary
public JBossScheduledThreadPoolExecutor(int corePoolSize, final Runnable terminationTask)
JBossScheduledThreadPoolExecutorback to summary
public JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, final Runnable terminationTask)
JBossScheduledThreadPoolExecutorback to summary
public JBossScheduledThreadPoolExecutor(int corePoolSize, RejectedExecutionHandler handler, final Runnable terminationTask)
JBossScheduledThreadPoolExecutorback to summary
public JBossScheduledThreadPoolExecutor(int corePoolSize, ThreadFactory threadFactory, RejectedExecutionHandler handler, final Runnable terminationTask)

Method Detail

getCurrentThreadCountback to summary
public int getCurrentThreadCount()
getKeepAliveTimeback to summary
public long getKeepAliveTime()
getLargestThreadCountback to summary
public int getLargestThreadCount()
getMaxThreadsback to summary
public int getMaxThreads()
getQueueSizeback to summary
public int getQueueSize()
getRejectedCountback to summary
public int getRejectedCount()
getRejectedExecutionHandlerback to summary
public RejectedExecutionHandler getRejectedExecutionHandler()

Overrides java.util.concurrent.ThreadPoolExecutor.getRejectedExecutionHandler.

Doc from java.util.concurrent.ThreadPoolExecutor.getRejectedExecutionHandler.

Returns the current handler for unexecutable tasks.

Returns:RejectedExecutionHandler

the current handler

setKeepAliveTimeback to summary
public void setKeepAliveTime(final long milliseconds)
setKeepAliveTimeback to summary
public void setKeepAliveTime(final long time, final TimeUnit unit)

Overrides java.util.concurrent.ThreadPoolExecutor.setKeepAliveTime.

Doc from java.util.concurrent.ThreadPoolExecutor.setKeepAliveTime.

Sets the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated. Threads that wait this amount of time without processing a task will be terminated if there are more than the core number of threads currently in the pool, or if this pool allows core thread timeout. This overrides any value set in the constructor.

Parameters
time:long

the time to wait. A time value of zero will cause excess threads to terminate immediately after executing tasks.

unit:TimeUnit

the time unit of the time argument

setMaxThreadsback to summary
public void setMaxThreads(final int newSize)
setRejectedExecutionHandlerback to summary
public void setRejectedExecutionHandler(final RejectedExecutionHandler handler)

Overrides java.util.concurrent.ThreadPoolExecutor.setRejectedExecutionHandler.

Doc from java.util.concurrent.ThreadPoolExecutor.setRejectedExecutionHandler.

Sets a new handler for unexecutable tasks.

Parameters
handler:RejectedExecutionHandler

the new handler

terminatedback to summary
protected void terminated()

Overrides java.util.concurrent.ThreadPoolExecutor.terminated.

Doc from java.util.concurrent.ThreadPoolExecutor.terminated.

Method invoked when the Executor has terminated. Default implementation does nothing.

Note

To properly nest multiple overridings, subclasses should generally invoke super.terminated within this method.

org.jboss.threads back to summary

private final Class JBossScheduledThreadPoolExecutor.CountingRejectHandler

extends Object
implements RejectedExecutionHandler
Class Inheritance
  • java.lang.Object
  • org.jboss.threads.JBossScheduledThreadPoolExecutor.CountingRejectHandler
All Implemented Interfaces
java.util.concurrent.RejectedExecutionHandler

Field Summary

Modifier and TypeField and Description
private final RejectedExecutionHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public RejectedExecutionHandler
public void
rejectedExecution(final Runnable
the runnable task requested to be executed
r
,
final ThreadPoolExecutor
the executor attempting to execute this task
executor
)

Implements java.util.concurrent.RejectedExecutionHandler.rejectedExecution.

Method that may be invoked by a ThreadPoolExecutor when execute cannot accept a task.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final RejectedExecutionHandler delegate

Constructor Detail

CountingRejectHandlerback to summary
public CountingRejectHandler(final RejectedExecutionHandler delegate)

Method Detail

getDelegateback to summary
public RejectedExecutionHandler getDelegate()
rejectedExecutionback to summary
public void rejectedExecution(final Runnable r, final ThreadPoolExecutor executor)

Implements java.util.concurrent.RejectedExecutionHandler.rejectedExecution.

Doc from java.util.concurrent.RejectedExecutionHandler.rejectedExecution.

Method that may be invoked by a ThreadPoolExecutor when execute cannot accept a task. This may occur when no more threads or queue slots are available because their bounds would be exceeded, or upon shutdown of the Executor.

In the absence of other alternatives, the method may throw an unchecked RejectedExecutionException, which will be propagated to the caller of execute.

Parameters
r:Runnable

the runnable task requested to be executed

executor:ThreadPoolExecutor

the executor attempting to execute this task