1 Reply Latest reply on Mar 4, 2004 8:11 PM by Elias Ross

    synchronize in onMessage?

    Lei Shen Newbie

      I am trying to add a static field in the MessageDrivenBean to count how many total message this particular type of Bean processed.

      Question 1:
      Is this the right way to do it? Do I need to synchronize when I increase the counter? Will JBoss take care of the synchronize for me automatically?

      Question 2:
      I was read somewhere that by default JBoss can have 15 concurrent message processing. Is that true? Where can I find more document?

      thanks
      Lei

        • 1. Re: synchronize in onMessage?
          Elias Ross Master


          There are already processing statistics stored in the JBoss server. You can see them via the JMX console under the "jboss.mq.destination" category.

          If you're using a static variable, then you need to synchronize on some sort of static lock. JBoss will create up to 15 MDB objects. You should use something like SynchronizedInteger in concurrent.jar.