4 Replies Latest reply on Jul 5, 2003 3:56 PM by sdumais

    ManagedConnections appear not to close

    sdumais

      Hi All,

      I've just hit a snag. My application connection use count hits the sky very quickly and I can't understand why.

      I've gone over my code again and again and I'm 100% sure that all my connections (ds.getConnection()) have a corresponding con.close().

      Here is a post of my mbean

        • 1. Re: ManagedConnections appear not to close
          sdumais

          > Hi All,
          >
          > I've just hit a snag. My application connection use
          > count hits the sky very quickly and I can't
          > understand why.
          >
          > I've gone over my code again and again and I'm 100%
          > sure that all my connections (ds.getConnection())
          > have a corresponding con.close().
          >
          > Here is a post of my mbean

          sorry... hit the send button too fast...

          I'm using PostgreSQL 7.3 and JBoss 3.2.1. The reason I have used the "manual" mbean configuration is because I wanted to have ByContainer and not "ByNothing" or "ByApplication".

          One thing I've noticed is that I have many "do your own housecleaning" statements in my logs (regarding closing statements).

          Thank you for your help.

          • 2. Re: ManagedConnections appear not to close

            Connection c = ds.getConnection();
            try
            {
            // Do work
            }
            finally
            {
            try
            {
            // Return to the pool
            if (c != null)
            c.close();
            }
            catch (Exception ignored)
            {
            }
            }

            Regards,
            Adrian

            • 3. Re: ManagedConnections appear not to close
              darranl

              Which version of JBoss are you using?

              Do you obtain more than one connection in the same transaction?

              I had a problem where I obtained a connection in Bean1, Bean1 then used Bean2 which also obtained a connection. I didn't see how many connections were kept open but I was getting the do your own housekeeping messages even though I was closing the connections.

              • 4. Re: ManagedConnections appear not to close
                sdumais

                Thank you for your answers.

                The problem was that I had race conditions between two of my
                modules and connections remained open because the
                finally blocks were not reached (the methods never returned).

                I've fixed the problem on my module.