JBoss development,
A new message was posted in the thread "JBJCA-260: New WorkManager":
http://community.jboss.org/message/521849#521849
Author : David Lloyd
Profile :
http://community.jboss.org/people/david.lloyd@jboss.com
Message:
--------------------------------------------------------------
jesper.pedersen wrote:
[..]
We need to define datastructures such that the WorkManager API:
http://java.sun.com/javaee/6/docs/api/javax/resource/spi/work/WorkManager...
can be implemented.
The WorkManager should reference two thread pools at first:
1. Short running tasks (default)
2. Long running tasks (tasks with HintsContext.LONGRUNNING_HINT set)
Later we can add support for additional thread pools with custom JBoss hints - such as
LOWPRIORITY_HINT and HIGHPRIORITY_HINT.
Sounds good. In order to implement WorkManager, you need to be able to execute tasks in
three different ways:
1. Block the calling thread until the work is complete (with an optional task submission
timeout and callbacks)
2. Block the calling thread until the work is accepted (with an optional task submission
timeout and callbacks)
3. Do not block the calling thread (with an optional task submission timeout and
callbacks)
In addition, the callbacks which must be supported include:
1. Work accepted (i.e. the executor queued the task)
2. Work started (i.e. a thread began executing the task)
3. Work completed (i.e. the runnable finished, with or without an exception)
4. Work rejected (i.e. the executor could not accept the task, or the submission timeout
expired before the task started)
I just committed a new version of JBoss Threads into trunk (2.0.0.CR2) which includes a
new type, BlockingExecutor, which includes these methods:
package org.jboss.threads;
public interface BlockingExecutor extends Executor {
// [...]
void executeBlocking(Runnable task) throws RejectedExecutionException,
InterruptedException;
void executeBlocking(Runnable task, long timeout, TimeUnit unit) throws
RejectedExecutionException, InterruptedException;
void executeNonBlocking(Runnable task) throws RejectedExecutionException;
// [...]
}
All JBoss Threads executors now implement this interface. With this new executor
interface, along with simple wrapper Runnables, all the above requirements should be
easily implemented. Unfortunately this means that the JCA implementation will need a hard
dependency on jboss-threads, because there is no java.util.concurrent equivalent to these
methods.
--------------------------------------------------------------
To reply to this message visit the message page:
http://community.jboss.org/message/521849#521849