@ Override public XAResource getXAResource ( Serializable xaresinfo ) throws XAResourceNotAvailableException { final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "getXAResource" , getID ( ) , xaresinfo ) ; XAResource xa ; ManagedConnection mc = null ; lock . readLock ( ) . lock ( ) ; try { if ( ! isInitialized . get ( ) ) try { // Switch to write lock for lazy initialization lock . readLock ( ) . unlock ( ) ; lock . writeLock ( ) . lock ( ) ; if ( ! isInitialized . get ( ) ) initPrivileged ( ) ; } finally { // Downgrade to read lock for rest of method lock . readLock ( ) . lock ( ) ; lock . writeLock ( ) . unlock ( ) ; } // TODO supply class loader identifier if resource was loaded from application ManagedConnectionFactory mcf = getManagedConnectionFactory ( null ) ; setMQQueueManager ( xaresinfo ) ; Subject subject = getSubjectForRecovery ( mcf , xaresinfo ) ; mc = mcf . createManagedConnection ( subject , null ) ; xa = mc . getXAResource ( ) ; xa = xa instanceof WSXAResource ? xa : new WSXAResourceImpl ( mc , xa ) ; } catch ( Throwable x ) { // Connections must be destroyed so they aren't leaked if ( mc != null ) try { mc . destroy ( ) ; } catch ( Throwable t ) { } FFDCFilter . processException ( x , getClass ( ) . getName ( ) , "328" , this , new Object [ ] { xaresinfo } ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getXAResource" , x ) ; if ( x instanceof Error ) throw ( Error ) x ; if ( x instanceof RuntimeException ) throw ( RuntimeException ) x ; throw new XAResourceNotAvailableException ( x ) ; } finally { lock . readLock ( ) . unlock ( ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "getXAResource" , xa ) ; return xa ; }
Given XAResourceInfo the XAResourceFactory produces a XAResource object .