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

    singeton mdb (message driven)

    Douglas Campbell Newbie

      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. :(