[jboss-user] [JCA] - Re: Specifying a different WorkManager for a custom resource
bortx
do-not-reply at jboss.com
Tue Nov 17 06:29:44 EST 2009
I have developed a work around on this issue and I want your opinion about it. It consist on the following.
1.- Deploy a service called custom-work-manager-service.xml defining a custom WorkManager with a custom thread pool with the following content
<server>
|
| <mbean code="org.jboss.util.threadpool.BasicThreadPool"
| name="custom.jca:service=CustomWorkManagerThreadPool">
| <!-- The name that appears in thread names -->
| <attribute name="Name">CustomWorkManager</attribute>
| <!-- The maximum amount of work in the queue -->
| <attribute name="MaximumQueueSize">10</attribute>
| <!-- The maximum number of active threads -->
| <attribute name="MinimumPoolSize">1</attribute>
| <!-- The maximum number of active threads -->
| <attribute name="MaximumPoolSize">10</attribute>
| <!-- How long to keep threads alive after their last work (default one minute) -->
| <attribute name="KeepAliveTime">60000</attribute>
| <!-- The behaviour when the queue is full -> the calling thread blocks until the queue has room -->
| <attribute name="BlockingMode">wait</attribute>
| </mbean>
|
| <mbean code="org.jboss.resource.work.JBossWorkManager"
| name="custom.jca:service=CustomWorkManager">
| <depends optional-attribute-name="ThreadPoolName">custom.jca:service=CustomWorkManagerThreadPool</depends>
| <depends optional-attribute-name="XATerminatorName">jboss:service=TransactionManager</depends>
| </mbean>
|
| </server>
2.- Accesing this work manager from my resource adapter and using it to submit works instead of the one that is provided by jboss in the BootstrapContext:
WorkManager customWorkManager = null;
| try {
| MBeanServer server = MBeanServerLocator.locateJBoss();
| customWorkManager = (WorkManager) server.getAttribute(new ObjectName(
| "custom.jca:service=CustomWorkManager"), "Instance");
| } catch (MalformedObjectNameException e) {
| // TODO
| } catch (Exception e) {
| // TODO
| }
What do you think about it?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4266040#4266040
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4266040
More information about the jboss-user
mailing list