4 Replies Latest reply on Sep 21, 2001 3:09 AM by Peter Antman

    MDB instansiation...

    Lars Olsson Newbie

      I have a question about how jboss 2.4.1 (RH Linux 6.2)
      handles MDB instances.

      I have a simple test application that consists of one
      MDB that consumes messages from a queue. The MDB prints
      a log message to System.err in its ejbCreate() method,
      its ejbDestroy() method, and in the onMessage() method.
      The log-message contains the hashCode() of the MDB instance.

      A simple test client loops a 100 times and:
      1) Writes a tiny dummy message to the queue
      2) Sleeps two seconds.

      When I run the test client I can see how the MDB
      ejbCreate() method is called 100 times and the
      onMessage is called 100 times. The ejbDestroy
      method is never called. The hascode that appears
      in the log messages seems to be different for each
      invocation of onMessage().

      I know that it is not my business as a MDB writer
      to try to control how the container creates MDB
      instances and pass messages to them - but why
      does the container not create just one MDB instance
      and pass all messages to that instance? It is not as
      if the queue is being overwhelmed with data - the
      tiny test messages arrive with two second intervals.

      In a separate test the two second wait in the
      loop in the test client was removed. This resulted
      A) 115 calls to ejbCreate()
      B) 100 calls to onMessage()
      C) Zero calls to ejbDestroy