[jboss-user] [JCA] New message: "Re: HornetQ RA integration"

Vicky Kak do-not-reply at jboss.com
Wed Mar 17 12:45:06 EDT 2010


User development,

A new message was posted in the thread "HornetQ RA integration":

http://community.jboss.org/message/532592#532592

Author  : Vicky Kak
Profile : http://community.jboss.org/people/vickyk

Message:
--------------------------------------------------------------
> jmesnil wrote:
>  
> At that time, I need to know if I should create a XASession (if <xa-transaction /> was specified), a transacted Session (if <local-transaction />) or a non-transacted Session (if in a <no-tx-connection-factory> element).
> This created session will be returned later by ManagedConnection.getConnection(). Is that  
>  
If xa-transaction is specified the ConnectionManager implementation i.e org.jboss.resource.connectionmanager.TxConnectionManager::createConnectionListerner(..) will get the XAResource from the MC::getXAResource
 
Here is the code
 
 public ConnectionListener createConnectionListener(ManagedConnection mc, Object context)
      throws ResourceException
   {
      XAResource xaResource = null;
      
      if (localTransactions)
      {
         xaResource = new LocalXAResource(log);
         if (xaResourceTimeout != 0)
            log.debug("XAResource transaction timeout cannot be set for local transactions: " + getJndiName());
      }
      else
      {
         xaResource = JcaXAResourceWrapperFactory.getResourceWrapper(mc.getXAResource(), isSameRMOverrideValue);
         
         if (xaResourceTimeout != 0)
         {
            try
            {
               if (xaResource.setTransactionTimeout(xaResourceTimeout) == false)
                  log.debug("XAResource does not support transaction timeout configuration: " + getJndiName());
            }
            catch (XAException e)
            {
               throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
            }
         }
      }
 
      ConnectionListener cli = new TxConnectionEventListener(mc, poolingStrategy, context, log, xaResource);
      mc.addConnectionEventListener(cli);
      return cli;
   }
 

 
 
The ConnectionListener/ConnectionManager creates the XASession and non XASession, you will have to implement the getXAResource and getLocalTransaction appropriately.
 
The JCA CM will call these methods approprately during the execution.
You can find more from JCA specs CM chapter.
 
HTH !

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/532592#532592




More information about the jboss-user mailing list