3 Replies Latest reply on Feb 1, 2006 7:17 AM by adrian.brock

    Notification of RA removal

    dansalt

      Hi,

      Platform: JBoss-4.0.3

      I'm currently implementing a JCA Resource Adapter that provides additional functionality for software load balancing. As part of this, when the ManagedConnectionFactory starts up, it establishes a number of "real" connections to the underlying EIS that are then allocated to ManagedConnections (using the chosen LB Algorith) when requests are made by users of the Adapter.

      My question is, is there a mechanism (either within the JCA spec or JBoss implementation) to receive a notification when the Resource Adapter is removed. Preferably I'd want to receive this in the ManagedConnectionFactory, or any class that can indirectly call the MCF. In this way, I can then cleanly close and tidy up the "real" connections.

      Many Thanks,
      Dan Salt.

        • 1. Re: Notification of RA removal
          dansalt

          ... funny how the answer always comes to you 5 seconds after you hit the "send". Well, maybe.

          Am I right in now thinking that I should be providing my own implementation for the JCA 1.5 interface "ResourceAdapter" so that I can write my own "stop()" method and do the work there?

          • 2. Re: Notification of RA removal
            dansalt

            Okay, so that solves half the problem - can anyone help me with the rest.

            For some reason, the ResourceAdapter.stop() is only called when the RA is undeployed, not on ApplicationServer shutdown.

            I've searched on the forums for this (search under ResourceAdapter stop shutdown) and found nothing.

            There is a post on another forum for another AS that has the same problem, and it is cited as a bug, is the same true for this case?

            Cheers,
            Dan.

            • 3. Re: Notification of RA removal

              It works for me.

              Change: http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossJCAMessageInflowExample

              to have

               public void stop()
               {
               log.info("Stopping", new Throwable("StackTrace"));
               for (Iterator i = activations.entrySet().iterator(); i.hasNext();)
              etc.
              


              And then I get:

              07:13:36,969 INFO [RARDeployment] Required license terms exist, view META-INF/r
              a.xml in .../deploy/filexmlrar.rar
              07:13:41,206 INFO [Server] Runtime shutdown hook called, forceHalt: true
              07:13:41,218 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
              07:13:41,240 INFO [FileXMLResourceAdapter] Stopping
              java.lang.Throwable: StackTrace
               at org.jboss.example.FileXMLResourceAdapter.stop(FileXMLResourceAdapter.
              java:79)
               at org.jboss.resource.deployment.RARDeployment.stopService(RARDeployment
              .java:114)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalStop(ServiceMBeanSu
              pport.java:315)
               at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMB
              eanSupport.java:247)
               at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBea
              nSupport.java:124)
               at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:1
              64)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
               at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
              ler.java:974)
               at $Proxy0.stop(Unknown Source)
               at org.jboss.system.ServiceController.stop(ServiceController.java:508)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
              java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
              sorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:585)
               at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
              er.java:157)
               at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
               at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
               at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
              java:262)
               at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
               at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:190)
               at $Proxy40.stop(Unknown Source)
               at org.jboss.deployment.SimpleSubDeployerSupport.stopService(SimpleSubDe
              ployerSupport.java:363)
               at org.jboss.deployment.SimpleSubDeployerSupport.stop(SimpleSubDeployerS
              upport.java:141)
               at org.jboss.deployment.MainDeployer.stop(MainDeployer.java:658)
               at org.jboss.deployment.MainDeployer.undeploy(MainDeployer.java:631)
               at org.jboss.deployment.MainDeployer.shutdown(MainDeployer.java:510)