6 Replies Latest reply on Nov 13, 2003 4:58 PM by Jon Barnett

    Newbie connection pooling

    Gopalakrishnan Newbie


      I am fairly new to jboss and I would appreciate very much if someone on this forum can help me out.

      a) Can jboss be configured to use other third party connection pooling algorithms as opoosed to using the default jboss connection pooling?

      If so, how can I do it?

      -- Gopal

        • 1. Re: Newbie connection pooling
          Jon Barnett Master

          Not easily unless you can integrate the replacement pooling mechanism into the JBoss microkernel - which means you need to create it as an MBean plugin. Ultimately, to reap the best advantage from connection pooling, you need to have the connections established in the same JVM as the components that will use the resource. Also, you need to tie in the connection pool with the transaction management service in JBoss. So there are a few environmental factors with which to contend. Study the existing JBoss connection pool implementation to understand the forces at work.

          • 2. Re: Newbie connection pooling
            Gopalakrishnan Newbie

            Thanks, Jon.

            Ok, is there a way to monitor/verify that jboss indeed used a connection pool to get the connection?

            I read in the forum that enabling the minpool/maxpool parameters in
            the -ds.xml would automatically enable the jboss managed connection pool. So, I want to see how many connections are open, how many are active etc?

            If I can at least get re-assurance from jboss server that yes, it's indeed using the connection pool, then I will be happy.

            Also, does the jboss managed pool reap abandoned connections. Say for instance, I forgot to close the statement or the resultse (bad code), then, would jboss managed connection pool close it and bring it back to the connection pool?

            -- Gopal

            • 3. Re: Newbie connection pooling
              Jon Barnett Master

              By default JBoss 3.2.x will warn you if you did not properly close a connection or closed a connection before closing a statement, resultset, etc when using a connection from the connection pool. Connection pooling has always been a central part of JBoss as it is intimately tied with delivering entity bean capability. It also does the standard connection reaping as part of reclamation of resources if anything goes wrong with the EJB that was using it, etc.

              You can check the pool via the JMX-console web application. Click on name=MyPool,service=ManagedConnectionPool under jboss.jca in the http://localhost:8080/jmx-console application. Note that no connections are established until the first connection request is made.

              Unless you are making a request to a DataSource that is not managed by JBoss, then JBoss will be using the DataSource bound to the JBoss JNDI/RMI service.

              • 4. Re: Newbie connection pooling
                Gopalakrishnan Newbie

                Thanks, jonlee. You have been a big help.

                -- Gopal

                • 5. Re: Newbie connection pooling
                  Gopalakrishnan Newbie


                  I also found out one more thing that I can do. I read the forums and I have the following information for verification of connection pool.

                  I enabled the trace in <jboss.server.home>/default/conf/log4j.xml as follows:

                  <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]

                  By default, the above line is commented out. But, this is another good resource to find out the details of the connection pool managed by jboss. The output is in server.log ...

                  Thanks again, Jonlee, Now if I can only figure out the log4j stuff for my application, I will be all set.

                  -- Gopal

                  • 6. Re: Newbie connection pooling
                    Jon Barnett Master

                    Yes, you can use that. However, from an operational perspective, and also from a test perspective when you have a large number of entity beans going and consequently a large amount of connection activity, it could impact your system. Remember the consequences of measurement as implied in Heisenberg's Uncertainty principle. ;-)