org.infinispan.util.concurrent
Class BlockingTaskAwareExecutorServiceImpl

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by org.infinispan.util.concurrent.BlockingTaskAwareExecutorServiceImpl
All Implemented Interfaces:
Executor, ExecutorService, BlockingTaskAwareExecutorService

public class BlockingTaskAwareExecutorServiceImpl
extends AbstractExecutorService
implements BlockingTaskAwareExecutorService

A special executor service that accepts a BlockingRunnable. 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
BlockingTaskAwareExecutorServiceImpl(ExecutorService executorService, TimeService timeService)
           
 
Method Summary
 boolean awaitTermination(long timeout, TimeUnit unit)
           
 void checkForReadyTasks()
          It checks for tasks ready to be processed in the thread.
 void execute(BlockingRunnable runnable)
          Executes the given command at some time in the future when the command is less probably to block a thread.
 void execute(Runnable command)
           
 boolean isShutdown()
           
 boolean isTerminated()
           
 void shutdown()
           
 List<Runnable> shutdownNow()
           
 
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

BlockingTaskAwareExecutorServiceImpl

public BlockingTaskAwareExecutorServiceImpl(ExecutorService executorService,
                                            TimeService timeService)
Method Detail

execute

public final void execute(BlockingRunnable runnable)
Description copied from interface: BlockingTaskAwareExecutorService
Executes the given command at some time in the future when the command is less probably to block a thread.

Specified by:
execute in interface BlockingTaskAwareExecutorService
Parameters:
runnable - the command to execute

shutdown

public void shutdown()
Specified by:
shutdown in interface ExecutorService

shutdownNow

public List<Runnable> shutdownNow()
Specified by:
shutdownNow in interface ExecutorService

isShutdown

public boolean isShutdown()
Specified by:
isShutdown in interface ExecutorService

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface ExecutorService

awaitTermination

public boolean awaitTermination(long timeout,
                                TimeUnit unit)
                         throws InterruptedException
Specified by:
awaitTermination in interface ExecutorService
Throws:
InterruptedException

checkForReadyTasks

public final void checkForReadyTasks()
Description copied from interface: BlockingTaskAwareExecutorService
It checks for tasks ready to be processed in the thread.

Specified by:
checkForReadyTasks in interface BlockingTaskAwareExecutorService

execute

public void execute(Runnable command)
Specified by:
execute in interface Executor

-->

Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.