1 Reply Latest reply on Jan 4, 2011 9:18 AM by shivaraj mallalli

    How to use BasicThreadPool

    shivaraj mallalli Newbie

      Hi Experts,


      I am running an multi threaded application(not a war file, its just a simple jar) inside the JBOSS 5 container. I am manually creating threads and handling them. I heard about the class basicThreadPool which jboss maintains. So is it possible that i can take a thread from this pool and execute this task. I am new to this. please guide me through.


      Thanks in advance


        • 1. Re: How to use BasicThreadPool
          shivaraj mallalli Newbie

          finally i found it


          MBeanServer mBeanServer = MBeanServerLocator.locate();
                   BasicThreadPoolMBean   basicThreadPoolBean = (BasicThreadPoolMBean) MBeanProxyExt.create(BasicThreadPoolMBean.class, "jboss.system:service=ThreadPool", mBeanServer);
                      threadPool = basicThreadPoolBean.getInstance();

          threadPool.run("your runnable task");


          By this way you don have to do thread management and jboss will take care of.


          PS:Its always better to have your own threadpool mbean rather than submitting jbos to jboss system thread pool "jboss.system:service=ThreadPool"