Skip to main content

@Asynchronous configuration

8 replies [Last post]
karl.vizmatik
Offline
Joined: 2011-05-20
Points: 0

System: Glassfish 3.1
Q: Is there any way to configure ...
1) Thread pools for the async calls (number of threads, thread factory, etc) on a global or local (per bean) level?
2) work queue? (i.e. replace it a custom priority queue)
Thanks,
Carl

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04
Points: 0

It's on our to-do list, but I'm not sure when will it happen...

-marina

tizzo
Offline
Joined: 2006-03-08
Points: 0

mvatkina wrote:
It's on our to-do list, but I'm not sure when will it happen...

-marina

Sorry to respond to such an old post, but I was wondering if there's any more status on this.

What I need is the equivalent of a ThreadPoolExecutor, but with a customizable pool size, and subclassed to use Comparable tasks in a PriorityBlockingQueue.

Is there any configurability available (or coming soon) on @Asynchronous methods that would give me any or all of this functionality? Thanks.

Tony

karl.vizmatik
Offline
Joined: 2011-05-20
Points: 0

mvatkina wrote:

It's on our to-do list, but I'm not sure when will it happen...

-marina

Thanks for a prompt answer. One more thing ... how is the async execution configured right now? Is there a global async-execute thread pool with one queue? Can I look/modify/jar inject my own changes?

mvatkina
Offline
Joined: 2005-04-04
Points: 0

This is what GlassFish docs say:

Priority Based Scheduling of Remote Bean Invocations

You can create multiple thread pools, each having its own work queues. An optional element in the glassfish-ejb-jar.xml file, use-thread-pool-id, specifies the thread pool that processes the requests for the bean. The bean must have a remote interface, or use-thread-pool-id is ignored. You can create different thread pools and specify the appropriate thread pool ID for a bean that requires a quick response time. If there is no such thread pool configured or if the element is absent, the default thread pool is used.

HTH,
-marina

karl.vizmatik
Offline
Joined: 2011-05-20
Points: 0

mvatkina wrote:

This is what GlassFish docs say:

Priority Based Scheduling of Remote Bean Invocations

You can create multiple thread pools, each having its own work queues. An optional element in the glassfish-ejb-jar.xml file, use-thread-pool-id, specifies the thread pool that processes the requests for the bean. The bean must have a remote interface, or use-thread-pool-id is ignored. You can create different thread pools and specify the appropriate thread pool ID for a bean that requires a quick response time. If there is no such thread pool configured or if the element is absent, the default thread pool is used.

HTH,
-marina

Pretty sure this only applies to remote EJB invocations. I'm trying to execute async methods on local instances. I've done some more testing and it seems like the async thread pool size is fixed at 16, which is, at least for me, not acceptable. Again, thanks for the help.

atomicknight
Offline
Joined: 2010-03-14
Points: 0

The 16 thread limit is hard-coded here: http://java.net/projects/glassfish/sources/svn/content/tags/3.1-b43/ejb/.... It's completely internal, so there's no getting around it apart from re-compiling the source yourself or creating your own thread pool in the application itself.

mvatkina
Offline
Joined: 2005-04-04
Points: 0

It has 30 as the max pool size. If this is not enough, please file a bug to make it configurable.

-marina

mvatkina
Offline
Joined: 2005-04-04
Points: 0

This has been fixed in 3.1.2 - see http://java.net/jira/browse/GLASSFISH-16735