2 Replies Latest reply on Oct 11, 2003 3:57 PM by judybramlette

    Close EJB Connections

    judybramlette Newbie

      I need to find out where a person would look to find out if our EJB's are being closed after they are used versus just waiting for them to timeout before they are returned to the pool. Our application was written using JBuilder 7 and served through JBoss 3.2 (hopefully my terminology is correct). Our configuration was all set up by a contractor who is no longer with us and the two of us left know very little about this environment so I'm not really sure what information I need to be providing to help someone answer my question. I do know we are using only container-managed beans. We need to know how or if we need to explicitly close these connections.

        • 1. Re: Close EJB Connections
          Jon Barnett Master

          For container managed persistence (CMP), the entity beans will manage the connections themselves (usually unless someone has put explicit connection code in the EJBs). Any stateless and stateful session beans that obtain connections from the connection pool themselves will need to close them as well. So you would be looking for code that explicitly performed a myConnection = pool.getConnection(...);

          However, JBoss 3.2.x will usually put warnings in the server.log about connections it had to clean up itself. So if you are not getting messages "clean up your own connections" or something like that, you are probably fine. For your own peace of mind, you can of course inspect the code for occurrences of the above and a corresponding myConnection.close(); This requires an understanding of EJBs as there are rules about where the close() should appear.

          JBoss will not protect you (nor will any other application server) if you connect directly to the database, not through a connection pool.

          Hope that helps.

          • 2. Re: Close EJB Connections
            judybramlette Newbie

            The numerous messages we were getting is what caused me to post the question. Your reply helped. We were able to find several places where they were not being closed. Thanks.