Package org.infinispan.util.concurrent
Class BlockingTaskAwareExecutorServiceImpl
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- org.infinispan.util.concurrent.BlockingTaskAwareExecutorServiceImpl
-
- All Implemented Interfaces:
Executor,ExecutorService,BlockingTaskAwareExecutorService
public class BlockingTaskAwareExecutorServiceImpl extends AbstractExecutorService implements BlockingTaskAwareExecutorService
A special executor service that accepts aBlockingRunnable. This special runnable gives hints about the code to be running in order to avoiding put a runnable that will block the thread. In this way, only when the runnable says that is ready, it is sent to the real executor service- Since:
- 5.3
- Author:
- Pedro Ruivo
-
-
Constructor Summary
Constructors Constructor Description BlockingTaskAwareExecutorServiceImpl(String controllerThreadName, ExecutorService executorService, org.infinispan.commons.time.TimeService timeService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, TimeUnit unit)voidcheckForReadyTasks()It checks for tasks ready to be processed in thisExecutorService.voidexecute(Runnable command)voidexecute(BlockingRunnable runnable)Executes the given command at some time in the future when the command is less probably to block a thread.ExecutorServicegetExecutorService()booleanisShutdown()booleanisTerminated()voidshutdown()List<Runnable>shutdownNow()-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
-
-
-
Constructor Detail
-
BlockingTaskAwareExecutorServiceImpl
public BlockingTaskAwareExecutorServiceImpl(String controllerThreadName, ExecutorService executorService, org.infinispan.commons.time.TimeService timeService)
-
-
Method Detail
-
execute
public final void execute(BlockingRunnable runnable)
Description copied from interface:BlockingTaskAwareExecutorServiceExecutes the given command at some time in the future when the command is less probably to block a thread.- Specified by:
executein interfaceBlockingTaskAwareExecutorService- Parameters:
runnable- the command to execute
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService
-
shutdownNow
public List<Runnable> shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorService
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorService
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceExecutorService
-
awaitTermination
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException- Specified by:
awaitTerminationin interfaceExecutorService- Throws:
InterruptedException
-
checkForReadyTasks
public final void checkForReadyTasks()
Description copied from interface:BlockingTaskAwareExecutorServiceIt checks for tasks ready to be processed in thisExecutorService. The invocation is done asynchronously, so the invoker is never blocked.- Specified by:
checkForReadyTasksin interfaceBlockingTaskAwareExecutorService
-
getExecutorService
public ExecutorService getExecutorService()
-
-