File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to configure Thread pool in JBOSS

 
vijay sachin
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread pooling for what? HTTP connections? EJBs? Messaging? Other?
 
vijay sachin
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic