8 Replies Latest reply on Feb 28, 2007 12:27 AM by mandarjboss

    Siebel Resource Adapter for JBoss

    mandarjboss

      I have developed a customized Siebel Resource Adapter.But I am really confused to see that "matchManagedConnections" method of ManagedConnectionFactory is never getting invoked during the lifecycle of the application.Also I am confused as to where I can specify the minPoolSize and MaxPoolSize parameters for my Resource Adapter Implementation.I tried specifying paramters as "min-pool-size" and "max-pool-size" in ds.xml but it did not help me much.
      So I would appreciate if anyone can help me in this problem.

        • 1. Re: Siebel Resource Adapter for JBoss
          weston.price

          The matchManagedConnnections method will get called when JBoss attempts to locate a connection from the pool for use. Are you able to acquire a connection from the pool. The JMX console should list your min/max settings which are by default 0 and 10 respectively. Can you look at the JMX console for your pool and tell me what you see?

          • 2. Re: Siebel Resource Adapter for JBoss
            mandarjboss

            Hi weston,
            Thanks for your reply.Now I am able to configure the pool as per the desired prameters.The problem that I am facing is my connection is not returned backto the pool. Can you tell me what I need to do ?
            I am using a NoTxConnectionFactory.I read in many of the forum answers that JBoss closes the connection(puts the connection backto the pool) only when the transaction is either commited or rolled back.
            Can you guide me how the things will happen when transaction is not supported by the Resource Adapter?

            • 3. Re: Siebel Resource Adapter for JBoss
              weston.price

              There should be nothing preventing the connection from being returned to the pool. A simple

              connection.close()
              


              should do it. However, if you are not firing a connection close event to your associated ConnectionListener(s) then this wouldn't occur, so it sounds like this is not being done. Check your ManagedConnection and verify that

              1)You are firing a connection close event to the listener(s) and supplying the ManagedConnection instance in the constructor of the ConnectionEvent.

              2) You are setting the handle on in the ConnectionEvent so it can be released.

              An example of how to do this can be found in

              org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection
              


              Since you are non transaction you don't need to worry about Tx interleaving holding the connection open for the lifetime of the transaction.





              • 4. Re: Siebel Resource Adapter for JBoss
                mandarjboss

                I am doing everything whatever you have mentioned in ur response.Going further I have switched on the "TRACE" level debugging.I can see the following message in the log file while JBoss is establishing the connection,

                2007-02-27 11:58:51,876 TRACE [org.jboss.resource.connectionmanager.CachedConnectionManager] registering connection from org.jboss.resource.connectionmanager.NoTxConnectionManager@1670cc6, connection : de.chs.siebel.jca.SiebelConnection@dc420b, key: null


                If I check the source code of "CachedConnectionManager" I can see this logging in "registerConnection" method of the same class.In the same method I can see an if loop as,
                if (key == null)
                return; //not participating properly in this management scheme.

                Now If you look at the TRACE log we can surely say that a null key is passed to the "registerConnection" method. Hence I am totally confused to see what JBoss is doing and what is expected output. Do I need to configure somewhere that my RA must use a NoTxConnectionManager ?

                Also when the connection is closed I can see the following log message generated,

                2007-02-27 11:58:51,891 TRACE [org.jboss.resource.connectionmanager.CachedConnectionManager] unregistering connection from org.jboss.resource.connectionmanager.NoTxConnectionManager@1670cc6, object: null, key: null
                2007-02-27 11:58:51,891 INFO [org.jboss.resource.connectionmanager.NoTxConnectionManager] Unregistered handle that was not registered! null for managedConnection: de.chs.siebel.jca.SiebelManagedConnection@65ab77


                Can you guide me to solve this problem ?

                • 5. Re: Siebel Resource Adapter for JBoss
                  mandarjboss

                  Another problem that I am facing is ....I can not see any evidence that "close" method of "ManagedConnection" is called upon server shutdown.I think it is an expected behavious as it will release the sockets held by the connection on the EIS server. We are getting "SocketException" after an exhaustive execution of the application.

                  • 6. Re: Siebel Resource Adapter for JBoss
                    weston.price

                    Without looking at your code it's difficult to diagnose what is going on. The log message

                    2007-02-27 11:58:51,891 INFO [org.jboss.resource.connectionmanager.NoTxConnectionManager] Unregiste
                    red handle that was not registered! null for managedConnection: de.chs.siebel.jca.SiebelManagedConne
                    ction@65ab77
                    


                    Is telling you that according to the ConnectionListener, the handle is unknown. Being that you are having issues with the close, the first place I would check is in how you are handling the association of ConnectionListeners in your code.

                    Something is preventing this association from happening.



                    • 7. Re: Siebel Resource Adapter for JBoss
                      mandarjboss

                      Hi Weston,

                      I will just explain the scenario,
                      1) When I call factory.getConnection() method the container calls the "createManagedConnectionConnection" method with an instance of "ConnectionManager" being passed as an argument.If I print the class-name the output is "BaseConnectionManager2" class of JBoss.
                      2) We are expecting the entire control being taken over by JBoss.Similarly the task of creating the connection and attaching a listener to it is expected to be done by the ConnectionManager.Therefore we are relying on BaseConnectionManager2 to create a connection and attach a listener to it.
                      3) In ManagedConnection's close method we are invoking the listeners explicitly.So as per our understanding the task of associating a Connection with its litener is the task of JBoss and not our RA. Correct me If I m wrong.

                      ManagedConnection's close method and "notifyClose" method that invokes the listeners attached to the connection.

                      public void close() {
                       notifyClose();
                       myConnection.invalidate();
                      }
                      
                      public void notifyClose() {
                       ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
                       ConnectionEventListener cel = null;
                       for(Iterator i = eventListeners.iterator(); i != null && i.hasNext();) {
                       Object obj = i.next();
                       System.out.println("Event Listener Class = " + obj.getClass().getName());
                       cel = (ConnectionEventListener)obj;
                       cel.connectionClosed(ce);
                       }
                       }



                      • 8. Re: Siebel Resource Adapter for JBoss
                        mandarjboss

                        Hi Weston ..

                        Thanks a lot. You have made my day. ....:)
                        We did a small change in notifyClose by passing the reference of connection object as a connection handle to connection even object and things worked fine.... once again thanks a lot... u r a genious ....!!!!