5 Replies Latest reply on Apr 1, 2004 9:43 AM by Michael Arnett

    JBoss Connection Pool for non-DB resource

    Michael Arnett Newbie

      All,
      How would I go about setting up a container managed connection pool? Ideally, it would be similar to the same methodology that is implemented for datasources.
      Thanks,
      -MLA

        • 1. Re: JBoss Connection Pool for non-DB resource
          Michael Arnett Newbie

          Oops, I left out that I am trying to do this on JBoss 3.2.1.
          Thanks,
          -MLA

          • 2. Re: JBoss Connection Pool for non-DB resource
            Adrian Brock Master

            For what?

            The short answer is you write and deploy a resource adapter - a .rar

            Regards,
            Adrian

            • 3. Re: JBoss Connection Pool for non-DB resource
              Michael Arnett Newbie

              Essentially, I have an application that sends many requests to another server. Additionally, if this server is unreachable, there are fail-over servers to which I need to make future requests until the primary servers come back online. What I would like to do is have a Primary Server Connection Pool and a FailOver Server Connection Pool. The FailOver Server Connection Pool would largely be ignored, unless there was a problem, and the FailOVer Server Connection Pool would utilize a different IP Address, but essentially both pools would be identical otherwise. If indeed developing a ResourceAdapter seems to be the logical solution, any advice on where to look for info on developing/deploying a ResourceAdapter for Jboss3.2.1?
              Thanks,
              -MLA

              • 4. Re: JBoss Connection Pool for non-DB resource
                Adrian Brock Master

                The ResourceAdapter is part of the j2ee connector architecture spec (JCA)
                http://java.sun.com/developer/codesamples/connect.html

                What you describe in failover pools sounds like you want to replace/enhance
                the connection pool implementation within jboss,
                although it could be done at the resource adapter level.

                See
                org.jboss.resource.connectionmanager.JBossManagedConnectionPool and
                org.jboss.resource.connectionmanager.InternalManagedConnectionPool

                Regards,
                Adrian

                • 5. Re: JBoss Connection Pool for non-DB resource
                  Michael Arnett Newbie

                  I decided to go with the rar. I simply updated my -ds.xml file to include two connection factories ( same rar for both ) which point to different IP Addresses. The code requests a connection from the primary connection factory. If the connection fails or is unavailable or throws an exception, then the failure is handled and an attempt is made to retrieve a connection from the backup connection factory. That's the solution that seemed to meet my needs the best. Thanks for the help Adrian.

                  For the sake of others who might be going the rar route, I found the following helpful: create a jar file which contains the javax.resource classes for jca 1.x and then extend these classes for your rar. Also, the URL Adrian lists has some great example code to get you going in the right direction. Finally, I found it helpful to start with no config-properties and just 'hardcoded' future config-properties in the class, getting it deployed successfully, and then adding the getters and setters for the config-properties and adding them to the -ds.xml file appropriately. This made it extremely easy to id config-properties that were not capitalized properly or for which the type was wrong, etc.

                  Hope that is helpful,
                  -MLA