2 Replies Latest reply on Oct 11, 2001 10:42 AM by vad

    JCA, destroying connections

    vad

      First, this is the continuation from the "JCA transaction not_supported" message I posted a week ago on the ejb forum. Many thanks, davidjencks, you solved my problem.

      I wrote a jms connector, and I'm writing now a proprietary connector (to allow my beans to make CORBA Orbix calls to legacy app.) ; for the config I just paste and copy the one existing.


      One thing is not clear however : It seems that I have to chose the JNDI name of my connector in the jboss.jcml and not at deployment time, or am I wrong ?

      One problem I have is not a bug but an annoying feature : suppose I have 2 types of connection, say to server1 and to server2 and suppose my pool has a max number of open connections limited to 5. My bean gets the right connection by giving a ConnectionSpec parameter in the getConnection(). If the first 5 times the getConnection is called with request for connection to server1, 5 connections to server1 will be created and the pool will be exhausted. When the connections are released by the bean, they come back to the pool. Right. But now if a bean request a connection to server2, it is blocked, because no connection in the pool can match, and there is no more room to create a new connection. As I understand it, this is the behavior coded in the ObjectPool class.

      So my question is : is it possible to plug another pool (I'd like to extend ObjectPool) and which interfaces should I implement ?

      Thanks

        • 1. Re: JCA, destroying connections
          davidjencks

          A resource adapter is kind of like a db driver: with it you can connect to a type of EIS. Deploying the rar gives your application server the ability to configure ConnectionFactory instances that are supplying connections to particular instances of the type of EIS. You still need to specify a bunch of parameters for the ConnectionFactory and what supports it, in particular the identity of the EIS instance you wish to connect to. The spec states specifically that the identity of the EIS instance should be configured with the ManagedConnectionFactory properties, and not in the ConnectionSpec. (I don't have a page number, sorry)


          So...

          you need to set up two ConnectionFactoryLoader mbeans with different jndi names, and independent pooling, one for each EIS instance you wish to connect to. Take the EIS identity out of the ConnectionSpec.


          All that being said, you might be able to get by with one ConnectionFactory if you make your ManagedConnections able to reconnect to either server depending on the instance specified in the ConnectionSpec when they are reused. You can implement connection pools internal to the driver for this purpose. Another strategy that I have considered for other reasons is pooling based on Subject and ConnectionSpec: this should also solve your problem. However, this is not currently available.

          I think the simplest and most spec compliant solution is to set up two ConnectionFactories.

          Hope this helps.

          david jencks

          • 2. Re: JCA, destroying connections
            vad

            OK, suppose now that I deploy one connector per external server.

            Do I need to set up one resource adapter section in jboss.jcml per server ? (As I do it now, all the parameters are identical but the resource adapter name which I use in the <display-name> of the ra.xml).

            I don't find it very elegant to paste and copy the same section 20 times because I can have potentially 20 external servers (so potentially 20 connectors deployed); although most of the time I will have 3 or 4 deployed connectors.

            Is there a way to deploy a connector without modifying the jboss.jcml file?