1 Reply Latest reply on Nov 13, 2002 1:08 AM by joelvogt

    singeton mdb (message driven)

    deegs_ca

      Hi all,

      I'm using 3.0.2 (downloaded from sf.net) and I need the following.

      1. if an mdb exists already then it will be re-used
      2. onMessage() to be invoked only if the singleton instance above is out of the onMessage() method scope.

      The ejb2.0 spec states that the container should guarantee that onMessage() will only be invoked if that same instance is not invoking it. Adherence by container to spec will guarantee 2 if singleton is used.

      Currently, the container is instantiating a new instance and then invoking onMessage() on a different bean causing the updates I'm performing to occur out of sequence and out of order of the queue.

      I've tried defining

      public static synchronized void _onMessage(...) {}

      (which is invoked in onMessage()) in order to sequentialize the processing of the messages in the queue but if my server dies while one of these threads is bloking on the static call then I lose my message. :(

      Suggestions?

        • 1. Re: singeton mdb (message driven)
          joelvogt

          you can maybe get what you want in the mdb container config in standardjboss.xml (or put in your jboss.xml). Specify MaximumSize=1. This will mean only one mdb at a time can be around processing your message.