|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.concurrent.AbstractExecutorService
org.multiverse.transactional.executors.TransactionalThreadPoolExecutor
public class TransactionalThreadPoolExecutor
A transactional Executor implementation that looks a lot like the
ThreadPoolExecutor.
ThreadPoolExecutor.afterExecute(Runnable, Throwable) but this functionality isn't
provided yet. So the best thing that you can do is wrap the command in a logging Runnable that catches and
logs the exception.
A task executes by a TransactionalThreadPoolExecutor will not automatically receives its own transaction.
| Constructor Summary | |
|---|---|
TransactionalThreadPoolExecutor()
Creates a new TransactionalThreadPoolExecutor with a unbound workqueue and 1 as corePoolSize and maxPoolSize. |
|
TransactionalThreadPoolExecutor(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
Creates a new TransactionalThreadPoolExecutor with the given workQueue and 1 as corePoolSize and maxPoolSize. |
|
TransactionalThreadPoolExecutor(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
int corePoolSize)
Creates a new TransactionalThreadPoolExecutor. |
|
TransactionalThreadPoolExecutor(int poolSize)
Creates a new TransactionalThreadPool with an unbound workqueue and the provided poolSize. |
|
| Method Summary | |
|---|---|
void |
awaitTermination()
Awaits for this TransactionalThreadPoolExecutor to complete. |
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
|
void |
awaitTerminationUninterruptibly()
Awaits for this TransactionalThreadPoolExecutor to complete without the possibility of being interrupted. |
void |
execute(java.lang.Runnable command)
|
int |
getCorePoolSize()
Returns the minimum number of threads in this TransactionalThreadPoolExecutor. |
int |
getCurrentPoolSize()
Returns the current number of threads in this TransactionalThreadPoolExecutor. |
org.multiverse.transactional.executors.TransactionalThreadPoolExecutor.State |
getState()
Returns the State this TransactionalThreadPoolExecutor has. |
java.util.concurrent.ThreadFactory |
getThreadFactory()
Returns the thread factory used to create new threads. |
java.util.concurrent.BlockingQueue<java.lang.Runnable> |
getWorkQueue()
Returns the BlockingQueue this TransactionalThreadPoolExecutor uses to store unprocessed work. |
boolean |
isShutdown()
|
boolean |
isStarted()
|
boolean |
isTerminated()
|
void |
setCorePoolSize(int newCorePoolSize)
Sets the corePoolSize of this TransactionalThreadPoolExecutor. |
void |
setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
Sets the thread factory used to create new threads. |
void |
shutdown()
|
java.util.List<java.lang.Runnable> |
shutdownNow()
|
void |
start()
Starts this TransactionalThreadPoolExecutor. |
| 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 |
| Constructor Detail |
|---|
public TransactionalThreadPoolExecutor()
public TransactionalThreadPoolExecutor(int poolSize)
poolSize - the maximum and core poolsize.
java.lang.IllegalArgumentException - if poolSize smaller than 0.public TransactionalThreadPoolExecutor(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue)
workQueue - the BlockingQueue to store unprocessed work.
java.lang.NullPointerException - if workQueue is null.
public TransactionalThreadPoolExecutor(java.util.concurrent.BlockingQueue<java.lang.Runnable> workQueue,
int corePoolSize)
workQueue - the BlockingQueue to store unprocessed work.corePoolSize - the minimum number of threads in this TransactionalThreadPoolExecutor.
java.lang.NullPointerException - if workQueue is null.
java.lang.IllegalArgumentException - if corePoolSize is smaller than zero or if maxPoolSize smaller than
corePoolSize.| Method Detail |
|---|
public int getCorePoolSize()
public void setCorePoolSize(int newCorePoolSize)
newCorePoolSize - the new core poolsize.
java.lang.IllegalArgumentException - if newCorePoolSize is smaller than 0.
java.lang.IllegalStateException - if this TransactionalThreadPoolExecutor is shutdown or terminated.public int getCurrentPoolSize()
public java.util.concurrent.BlockingQueue<java.lang.Runnable> getWorkQueue()
public org.multiverse.transactional.executors.TransactionalThreadPoolExecutor.State getState()
public void setThreadFactory(java.util.concurrent.ThreadFactory threadFactory)
threadFactory - the new thread factory
java.lang.NullPointerException - if threadFactory is nullgetThreadFactory()public java.util.concurrent.ThreadFactory getThreadFactory()
setThreadFactory(java.util.concurrent.ThreadFactory)public void shutdown()
public java.util.List<java.lang.Runnable> shutdownNow()
public boolean isShutdown()
public boolean isTerminated()
public boolean isStarted()
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedException
public void awaitTermination()
throws java.lang.InterruptedException
java.lang.InterruptedException - if the Thread was interrupted.public void awaitTerminationUninterruptibly()
public void execute(java.lang.Runnable command)
public void start()
java.lang.IllegalStateException - if the this TransactionalThreadPoolExecutor already is shutdown or terminated.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||