[JCA Development] New message: "Re: JBJCA-260: New WorkManager"
by David Lloyd
User 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
16 years, 3 months
[jBPM] New message: "Re: jBPM 4.3 - Will cause memory leaks due to unclosed InitialContext()"
by Santanu Saraswati
User development,
A new message was posted in the thread "jBPM 4.3 - Will cause memory leaks due to unclosed InitialContext()":
http://community.jboss.org/message/521841#521841
Author : Santanu Saraswati
Profile : http://community.jboss.org/people/saraswati.santanu
Message:
--------------------------------------------------------------
Martin,
Did you really faced any OutOfMemoryError because of this?
Typically InitialContext context = new InitialContext() does not take a lot of resources and build a new context altogether. InitialContext just works as a delegate to the actual initial context created using some environment variables/ jndi.properties. When you do a new InitialContext() it asks the InitialContextFactory for the actual InitialContext, and it will be suicidal if the InitialContextFactory creates a new context whenever somebody calls getInitialContext() on it. And I can assure that no proper InitialContextFactory implementation does that. So calling close should not be required at all.
Now what if I call close? Well the code in IntialContext.java is this:
* public void close() throws NamingException {
myProps = null;
if (defaultInitCtx != null) {
defaultInitCtx.close();
defaultInitCtx = null;
}
gotDefault = false;
}*
So this closes the defaultInitContext, which is the JNDI context of the server. So if I do so, any further initial context lookup in my application is going to fail !! It will be interesting to see what happens if I call close. It should depend on the implementation and the implementation should understand that the real intention is not to close.
Regards,
Santanu
--------------------------------------------------------------
To reply to this message visit the message page: http://community.jboss.org/message/521841#521841
16 years, 3 months