public class SafeExecutorService
extends java.util.concurrent.AbstractExecutorService
SafeExecutorService ses = new SafeExecutorService(false);
SafeExecutorThreadFactory setf = new SafeExecutorThreadFactory(ses, Executors.defaultThreadFactory());
ses.setDelegate(Executors.newSingleThreadExecutor(setf));
Constructor and Description |
---|
SafeExecutorService(boolean permitSelfExecutions) |
SafeExecutorService(java.util.concurrent.ExecutorService delegate,
boolean permitSelfExecutions) |
Modifier and Type | Method and Description |
---|---|
void |
addManagedThread(java.lang.Thread thread) |
boolean |
allowsSelfExecutions() |
boolean |
awaitTermination(long arg0,
java.util.concurrent.TimeUnit arg1) |
protected void |
canExecute(java.lang.Runnable arg0)
test to see if the current thread is managed and we permit self executions
|
void |
execute(java.lang.Runnable arg0) |
java.util.concurrent.ExecutorService |
getDelegate() |
boolean |
isManagedThread(java.lang.Thread thread) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
removeManagedThread(java.lang.Thread thread) |
void |
setDelegate(java.util.concurrent.ExecutorService service) |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
public SafeExecutorService(boolean permitSelfExecutions)
public SafeExecutorService(java.util.concurrent.ExecutorService delegate, boolean permitSelfExecutions)
public void setDelegate(java.util.concurrent.ExecutorService service)
public java.util.concurrent.ExecutorService getDelegate()
public boolean allowsSelfExecutions()
public boolean awaitTermination(long arg0, java.util.concurrent.TimeUnit arg1) throws java.lang.InterruptedException
java.lang.InterruptedException
ExecutorService.awaitTermination(long,
java.util.concurrent.TimeUnit)
public boolean isShutdown()
ExecutorService.isShutdown()
public boolean isTerminated()
ExecutorService.isTerminated()
public void shutdown()
ExecutorService.shutdown()
public java.util.List<java.lang.Runnable> shutdownNow()
ExecutorService.shutdownNow()
public void execute(java.lang.Runnable arg0)
Executor.execute(java.lang.Runnable)
public void addManagedThread(java.lang.Thread thread)
public void removeManagedThread(java.lang.Thread thread)
public boolean isManagedThread(java.lang.Thread thread)
protected void canExecute(java.lang.Runnable arg0)