How to configure WorkManagers in WebLogic 10.3?

I would like to use the WorkManager to schedule some parallel jobs on the WebLogic 10.3 application server.

http://java.sun.com/javaee/5/docs/api/javax/resource/spi/work/WorkManager.html

I find the Oracle / BEA documentation a bit fragmented and hard to follow, and it does not have good examples for using WorkManagers from EJB 3.0.

In particular, I would like to know:

1) What exactly, if anything, do I need to add to deployment descriptors (ejb-jar.xml and friends)?

2) I would like to use the @Resource annotation to introduce the WorkManager into my EJB 3 bean session. What "name" do I use for the resource?

3) How to configure the number of threads and other parameters for WorkManager.

I understand that the underlying implementation in WebLogic is CommonJ, but I would prefer to use a generic approach if possible.

+6
java-ee concurrency weblogic
source share
2 answers

First, you will find the CommonJ documentation, an implementation of the Timer and Work Manager APIs developed by BEA Oracle and IBM, in the Timer Programmer's Guide and Work Manager API (CommonJ) . They provide an example of a work manager, but are not inserted into this document.

1) What exactly, if anything, do I need to add to deployment descriptors (ejb-jar.xml and friends)?

In the Deployment section of the job manager :

Work managers are defined at the server level through the resource-ref to the appropriate deployment descriptor. It could be web.xml or ejb-jar.xml among others.

The following deployment descriptor fragment demonstrates how to configure a WorkManager :

 ... <resource-ref> <res-ref-name>wm/MyWorkManager</res-ref-name> <res-type>commonj.work.WorkManager</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> ... 

Note. The recommended prefix for the JNDI namespace for WorkManager objects is java: comp / env / wm.

Read the WorkManager javadocs for more details (for example, "The res-auth and res-sharing areas are ignored in this version of the specification. The EJB or servlet can then use the WorkManager as it needs to.").

2) I would like to use the @Resource annotation to introduce the WorkManager into my EJB 3 bean session. What "name" do I use for the resource?

I would say something like this (not tested):

 @ResourceRef(jndiName="java:comp/env/wm/MyWorkManager", auth=ResourceRef.Auth.CONTAINER, type="commonj.work.WorkManager", name="MyWorkManager") 

3) How to configure the number of threads and other parameters for WorkManager.

See the description of <work-manager> and Using Work Managers to optimize planned work for detailed information about work managers.

I understand that the underlying implementation in WebLogic is CommonJ, but I would prefer to use a generic approach if possible.

I have no other suggestion (and, as long as this implementation complies with the standards, I would not mind using it).

+8
source share

Weblogic documentation will answer your questions. Using work managers to optimize planned work

0
source share

All Articles