aspose file tools*
The moose likes JBoss/WildFly and the fly likes How to configure Thread pool in JBOSS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to configure Thread pool in JBOSS" Watch "How to configure Thread pool in JBOSS" New topic
Author

How to configure Thread pool in JBOSS

vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Hi,

Can any body please explain me how to configure Thread Pooling using JBOSS

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

Thread pooling for what? HTTP connections? EJBs? Messaging? Other?


JBoss In Action
vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Let me first explain my requirement

onMessage() method I am reading the message from queue and performing some Business logic.
This BL is taking some time to perform the operation which will be blocking that MDB.

So instead of this I thought of read message from Queue and assign a thread to perform that BL and release the MDB.

Please suggest me if this approach is correct or not. If correct how can I create a thread pool in JBOSS.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

The app server will create a pool of MDB instances and give each one the next message in the queue. Thus there is no need for you to fork off a thread. The pool size is configurable - you get 15 instances by default. A while ago I ran some tests that numbered the instances.

You didn't mention which version of JBoss AS, nor which level of EJB, so I will assume AS 5.1.0 and EJB 3. You can change the limit in ejb3-interceptors-aop.xml file, look for the Message Driven Beans entry, the maxSize portion of the default annotation. Of course, you can also apply your own @Pool annotation to your MDB.

Here is a discussion on this topic: http://community.jboss.org/thread/149187
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

For those of you following along at home, apparently Vijay didn't like my answer and decided to open two other threads on this same topic:
http://www.coderanch.com/t/529329/JBoss/create-Thread-Pool-Jboss
http://community.jboss.org/message/590844
vijay sachin
Greenhorn

Joined: Jan 18, 2011
Posts: 23
Hi Peter,

Don't thing wrongly. I got your answer and I implemented the same in my code.

I just need to know in jboss can we create Thread pool if yes how can we do that.
Its not at all related to my old requirement I just want to know.
Like Connection pool, MDB pool is it possible to create Thread pool.

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5827
    
    7

You should not be messing around with thread pools in your own code. Things such as user credentials and transaction state are maintained in thread-local storage. As soon as you spawn off other threads there is the possibility that you will lose that information. I don't know if the thread pool mechanism will copy the thread-local storage to the thread allocated from the pool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to configure Thread pool in JBOSS