1 2 Previous Next 19 Replies Latest reply on Jul 22, 2013 7:42 AM by gytis Go to original post
      • 15. Re: Replacing TransactionalDriver with IronJacamar
        tomjenkinson

        Sorry Jesper, I wasn;t clear.

         

        I am aware of the API, our current QS uses it:

        https://github.com/jbosstm/quickstart/blob/master/jca-and-tomcat/src/main/java/org/jboss/narayana/quickstart/jca/listener/ServletContextListenerImpl.java#L97

         

        What I was trying to say is that if Mauro were to use IJ directly he can register the shutdown "hook" in:

            @Override

            public void contextDestroyed(final ServletContextEvent servletContextEvent)

         

        Much like he can register the IJ startup hook in

            contextInitialized(final ServletContextEvent servletContextEvent)

         

        That said, I can then imagine how using sitting IJ behind the java.sql.Driver interface we still get the chance to do the Embedded::startup(), what I am not sure is where the appropriate place to add shutdown except through a shutdown hook on the Runtime.

         

        Tom

        • 16. Re: Replacing TransactionalDriver with IronJacamar
          jesper.pedersen

          Well, I would hide IronJacamar behind a Narayana specific class - or interface + Factory like IJ/Embedded - and let users control their setup that way

           

          import org.narayana.td.TransactionalDriver;
          import org.narayana.td.TransactionalDriverFactory;
          
          TransactionalDriver td = TransactionalDriverFactory.create();
          td.start();
          
          td.deploy(myDsXml);
          
          XADataSource xads = td.lookup("java:/MyXADs", XADataSource.class);
          
          // Do work
          
          td.undeploy(myDsXml);
          td.stop();
          

           

          Then have the JDBC resource adapter deploy during start() behind the scenes, and of course undeploy during stop().

           

          Having a facade to IronJacamar allows you to switch implementation and configuration without asking the users to make updates. Of course you would need to expose the configuration parameters that the users should be able to tinker with - optional parameter to create().

          • 17. Re: Replacing TransactionalDriver with IronJacamar
            mauromol

            Please note that shutdown hooks are evil!!! You can't rely on them when you're in a managed environment (for instance, an application server) and they are certain causes of memory leaks!

             

            So, any explicit startup/sthudown procedures would be much better. If we are talking about a Driver implementation, I don't know if it's possible to add a hook to DriverManager.deregisterDriver(Driver) in order to perform some shutdown operations.

             

            Anyway, I would like to clarify that I'm not questioning the value of having IronJacamar support in JBoss Transactions (or vice-versa), but rather that I'm not sure if the whole power of IronJacamar is really needed in my own use case.

            • 18. Re: Replacing TransactionalDriver with IronJacamar
              jesper.pedersen

              DriverManager is an old broken concept

              • 19. Re: Replacing TransactionalDriver with IronJacamar
                gytis

                Hello,

                 

                After a meeting with Tom and Mike we will investigate whether we can provide an option to make integration for Narayana with Iron Jacamar possible via an API as close to the existing transactional driver API as possible. First of all, I will work on JBTM-1856 to provide a quickstart for the current transactional driver. Then, I will update the quickstart with the prototyped version of the transactional driver backed with IronJacamar.

                Hopefully, such option will make the integration with IronJacamar much easier for the current transactional driver users.

                 

                Regards,

                Gytis

                1 2 Previous Next