Liferay 6.2-ce-ga5

com.liferay.portal.kernel.concurrent
Class DiscardWithCancelPolicy

java.lang.Object
  extended by com.liferay.portal.kernel.concurrent.DiscardWithCancelPolicy
All Implemented Interfaces:
RejectedExecutionHandler

public class DiscardWithCancelPolicy
extends Object
implements RejectedExecutionHandler

Handles rejected tasks by canceling them immediately.

Use this policy for efficiently discarding rejected tasks. Unlike CallerRunsPolicy, this policy maintains the order of tasks in the task queue. Unlike DiscardOldestPolicy and DiscardPolicy, which ultimately call Future.get(), threads do not block waiting for a timeout.


Constructor Summary
DiscardWithCancelPolicy()
           
 
Method Summary
 void rejectedExecution(Runnable runnable, ThreadPoolExecutor threadPoolExecutor)
          Rejects execution of the Runnable task by canceling it immediately.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscardWithCancelPolicy

public DiscardWithCancelPolicy()
Method Detail

rejectedExecution

public void rejectedExecution(Runnable runnable,
                              ThreadPoolExecutor threadPoolExecutor)
Rejects execution of the Runnable task by canceling it immediately.

Important: The task can only be canceled if it is a subtype of Future.

Specified by:
rejectedExecution in interface RejectedExecutionHandler
Parameters:
runnable - the task
threadPoolExecutor - the executor
See Also:
ThreadPoolExecutor.RejectedExecutionHandler

Liferay 6.2-ce-ga5