2 Replies Latest reply on Apr 28, 2009 6:46 AM by bortx

    ManagedConnectionFactory lifecycle

      Hi,

      I have created a new post that continues this one

      http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154012

      because I think this subject describes better what I want to discuss, so if administrators want to delete the old post and continue this one I think it would be better.

      Basically I want to discuss about how to handle the ManagedConnectionFactory lifecycle

      I have developed a solution for this issue that I want to share with you to know your impressions. I have modified jboss-jca sources in my jboss installation to do the following:

      I have added an interface ManagedConnectionFactoryLifeCycle as follows:

      public interface ManagedConnectionFactoryLifeCycle {
      
       public void start();
      
       public void stop();
      }
      

      I have added the following code in org.jboss.resource.connectionmanager.RARDeployment

      protected void startService() throws Exception
       {
       ...original actions
      
       if (mcf instanceof ManagedConnectionFactoryLifeCycle)
       {
       ManagedConnectionFactoryLifeCycle mcflc = (ManagedConnectionFactoryLifeCycle) mcf;
       mcflc.start();
       }
       }
      
      protected void stopService()
       {
       if (mcf instanceof ManagedConnectionFactoryLifeCycle)
       {
       ManagedConnectionFactoryLifeCycle mcflc = (ManagedConnectionFactoryLifeCycle) mcf;
       mcflc.stop();
       }
       ... original actions
       }
      

      Then my ManagedConnectionFactory implements this interface and can handle its deployment and undeployment and perform actions needed. It works, but I know this is not JCA compliant, so I would like to know if you agree with this solution or if you can suggest any other better solution.

      Thanks a lot

        • 1. Re: ManagedConnectionFactory lifecycle

          MCF lifecycle is a feature that is projected to be added in jca 1.6 (jsr322)
          http://jcp.org/en/jsr/detail?id=322
          (along with other annotation handling and the new javabean validation mechanism - jsr303).

          Instead of an interface it is supposed to use the @PostConstruct and @PreDestroy
          annotations on the javabean methods.
          http://java.sun.com/javase/6/docs/api/javax/annotation/package-summary.html

          If we are going to implement it early then I'd rather do that.

          The difficulty comes in that we are only suppossed to process the annotations
          when the ra.xml (when there is one)
          specifies 1.6+ as the version (which obviously doesn't exist yet :-)

          So maybe we could add some jboss specific metadata/annotation that enables
          it for earlier versions?

          • 2. Re: ManagedConnectionFactory lifecycle

            I think for the moment I'm going to adopt my solution, as I see jca 1.6 is going to be late for my needs.

            By the way, I suppose you are going to provide jca 1.6 support for jboss 5, as I am using jboss 4.2.3 it would be a great idea to add it also to this version ;)

            Thanks for your answer