users@glassfish.java.net

Concurrency in EE6

From: Steven Siebert <smsiebe_at_gmail.com>
Date: Fri, 23 Apr 2010 05:44:54 -0500

Good morning,

In an Singleton Session Bean, I have a BlockedLinkedQueue that accumulates
audit events. These events are then needed to be processed and finally
persisted. I want this processing block to be non-blocking so that it
doesn't tie up the request threads. I want the audit events to be processed
by other threads when available. This application is high-traffic and will
be deployed on serveral multi-socket, multi-core servers (T2/T2+ SPARC) with
full resources (up to 128 parallel threads).

When porting this system to EE6, I initially considered using the
@Asynchronous annotation instead of a BlockedLinkedQueue, but I can't find
any documentation that states n-threads will be used to process these
asynchronous calls. I tried using managed beans, but received some
exceptions stating I had uncompiled source code where I was trying to start
a new thread. One thing I would like, if possible, is to use CDI...so I can
handle auditing in an AOP manner....I just couldn't get the managed bean to
be backed by a concurrent processing engine.

So...my questions are:

1) do methods called with the @Asynchronous annotation share a single thread
or can they take advantage of the n-pipes available?
2) is there any other way to do explicit concurrency in EE6? By explicit, I
mean explicitly controlling the concurrency with Thread or perhaps allowing
me to throttle thread usage on a block of (Asynchronous?) code through
metadata.

If needed, I am trying to port my "Enterprise Logger" (
http://kenai.com/projects/elogger) to work in EE6. It works quite well in
both SE and EE5 environments right now. You can download the source from
the SVN.

Thanks,

Steve