JBoss Community

Re: Problem with XARecoveryModule.

created by Adam Ringel in IronJacamar - View the full discussion

Not only does JBoss 7 not appear ready to us to move our production code to, we also don't have the resources to do such a large effort just to fix this one problem.

We analyzed the code further and noticed that not only is the getXAResource not doing any sanity checking, but the cached instance variable:


private ManagedConnection recoverMC = null;

 

 

is not being reinitialized, ever.  You can see the open code used in the recovery will never recreate it:

 


   private ManagedConnection open(Subject s) throws ResourceException
   {
      if (recoverMC == null)
      {
         recoverMC = createManagedConnection(s, null);
            }


      return recoverMC;
   }

 

 

You can't even reinitialize it using the stopService lifecycle method from JMX.  You can see the close method nulls the passed in reference, but the actual instance variable is not nulled!!

 


   protected void stopService()
   {
      if (recoveryRegistered)
      {
         if (getXAResourceRecoveryRegistry() != null)
         {
            close(recoverMC);


            getXAResourceRecoveryRegistry().removeXAResourceRecovery(this);
            recoveryRegistered = false;


            if (log.isDebugEnabled())
               log.debug("Unregistered for XA Resource Recovery: " + dmd.getJndiName());
         }
      }


      mcf = null;
      mcfClass = null;
   }

   private void close(ManagedConnection mc)
   {
      if (mc != null)
      {
         try
         {
            mc.cleanup();
         }
         catch (ResourceException ire)
         {
            if (log.isDebugEnabled())
               log.debug("Error during recovery cleanup", ire);
         }
      }


      if (mc != null)
      {
         try
         {
            mc.destroy();
         }
         catch (ResourceException ire)
         {
            if (log.isDebugEnabled())
               log.debug("Error during recovery destroy", ire);
         }
      }


      mc = null;
   }

 

 

When we have a DB crash that cached ManagedConnection is no good anymore but it never gets reinitialized.  We would like to put a check in the open method that would verify the cached MC is healthy and if it isn't reinitialize it.

Any ideas on how to check the health at that stage?

Reply to this message by going to Community

Start a new discussion in IronJacamar at Community