2 Replies Latest reply on Dec 2, 2009 8:23 AM by Ralf Battenfeld

    How to handle a correct ejb module undeployment

    Ralf Battenfeld Apprentice

      Hi

      We have developed an EJB module in which the main tasks are performed by MDBs. An onMessage() call can be a long time task up to 2 minutes. I tried to find a mechanism to be informed some how that the container is being to undeploy the EJB module, so that the application can release all resources properly.

      At the moment, container stops the database resources before the EJBs are stopped.

      We look for way to be informed before the container stops the EJB module and the resources.

      We are using JBoss 5.1.

      Thanks a lot for any help.
      Ralf

        • 1. Re: How to handle a correct ejb module undeployment
          jaikiran pai Master

           

          "rbattenfeld" wrote:

          At the moment, container stops the database resources before the EJBs are stopped.

          Hmm, probably because there's no explicit dependency specified on the database resource (datasource?) in the EJBs. How does the EJB access the database resource? Through datasources?

          • 2. Re: How to handle a correct ejb module undeployment
            Ralf Battenfeld Apprentice

            Hi jaikiran

            Yes, we use standard JBoss datasource files and JPA and ORM technology. The datausources are not part of the EAR.

            What is the recommended way of shutting down an EJB module in order to be able to cleanup? At the moment, we use an external event that informs the application to finish all transactions, and not to start new transactions. If someone forgets the send this event, then we have a problem.

            Is there perhaps a possibility to define an interceptor that we could use instead of this external event?

            Thanks for your help
            Ralf