4 Replies Latest reply on Sep 11, 2003 7:58 PM by Adrian Brock

    ManagedConnection pooling

    schristinson Newbie


      I am new to JBoss so I hope this isn't too far off the

      I am writing a resource adapter for connecting clients
      with remote devices (telnet over TCP/IP). The IP addresses
      of the remote devices aren't known until runtime (they are
      discovered separately) and so can't be configured into the
      resource adapter. Additionally, connection establishment
      is reasonably expensive (TCP 3-way handshake) and we have
      many such devices. Too many to keep connections to all.

      I have written the adapter so that the IP address is
      supplied by the client when it gets its connection to the
      resource adapter. At this time I want the resource adapter
      to decide whether a connection to the requested device
      already exists and, if not, create one. When the client
      is done the connection to the device is not closed.

      I was hoping the connection pooling mechanism would help
      me out here, but the ManagedConnectionFactory always
      destroys "active" connections which fail to match. So,
      when a client requests a connection to the resource
      adapter for a device with no physical connection, the resource adapter makes the new connection OK, but in doing
      so destroys the "active" connection because it doesn't
      match the new request.

      I am using JBoss 3.2.1 and have the max pool size set to


      Steve Christinson

        • 1. Re: ManagedConnection pooling
          Adrian Brock Master

          Use ByApplication pooling and pass the ip address.
          JBoss will create a subpool for each ip address.

          The spec doesn't recommend this kind of usage.
          Any reason for using JCA? i.e. Transactions/Security.
          Why not write it as an MBean?


          • 2. Re: ManagedConnection pooling
            schristinson Newbie


            I'll check out the ByApplication pooling option.

            My main reason for trying JCA is connection pooling.
            I hadn't considered MBeans because I don't know much
            about them. I'll check this option out as well.



            • 3. Re: ManagedConnection pooling
              schristinson Newbie


              I checked the spec and, as you say, it recommends not
              using the ConnectionRequestInfo to pass EIS specific
              information (it mentions IP address and port). However,
              in my case, the IP address _is_ client specific rather
              than EIS specific since it client may choose to connect
              to any of the "discovered" IP addresses.

              I tried using the ByApplication setting and JBoss then
              creates a sub-pool per IP address, which is something
              like what I want. However, it still insists on trying to
              destroy unmatched connections in a sub-pool when a new
              connection request arrives. That is, it supports a maximum
              of 1 connection per sub-pool which was not my
              understanding after reading the documentation.

              Any suggestions?

              Also, what advantages would using an MBean have in this
              situation? I am really after managed connection pooling
              only; security and transactions are not required at this

              Thanks in advance,


              • 4. Re: ManagedConnection pooling
                Adrian Brock Master

                I don't understand. The idea is to use the ConnectionRequestInfo
                to make all the connections in each subpool equivalent.
                You shouldn't be getting connections that don't match?

                An MBean is more flexible, you don't have to squeeze your
                application into the spec defined behaviour.
                Of course you would have to write your own pool or reuse
                the jboss pool.