ariba.util.core
Class ThreadPoolRejectedExecutionHandler
java.lang.Object
ariba.util.core.ThreadPoolRejectedExecutionHandler
- All Implemented Interfaces:
- RejectedExecutionHandler
public class ThreadPoolRejectedExecutionHandler
- extends Object
- implements RejectedExecutionHandler
A concrete implementation of RejectedExecutionHandler for ThreadPools.
This handler will allocate extra threads as needed and attempts to execute
the specified runnable task. This handler is appropriate to be used in
situations where response time is important and the system is capable of
providing extra resources (threads) on a temporary basis to handle sudden
burst of activity.
ThreadPoolRejectedExecutionHandler
public ThreadPoolRejectedExecutionHandler()
handle
public void handle(Runnable runnable,
Executor executor)
throws RejectedExecutionException
- Description copied from interface:
RejectedExecutionHandler
- Called when a RejectedExecutionException is thrown when the
Executor.execute(java.lang.Runnable) method is invoked to handle the rejection.
- Specified by:
handle in interface RejectedExecutionHandler
- Parameters:
runnable - the task to run, guaranteed to be non-null.executor - the executor, guaranteed to be non-null.
- Throws:
RejectedExecutionException - thrown if the way to handle the
exception is to throw it.
IMPORTANT Since the executor is passed in, there is nothing
to prevent this method to invoke the executor's execute method. But if
this handler does call the executor's execute method, it must ensure
that this execute call will not trigger this handler which can in turn
trigger a call to execute, ultimately resulting in a stack overflow.
AribaWeb User Interface Development Framework
Copyright © 2000-2009 Ariba, Inc. All Rights Reserved.