@ Override public void registerXAResource ( String uniqueName , XAResource xaResource ) { Ehcache3XAResourceProducer xaResourceProducer = producers . get ( uniqueName ) ; if ( xaResourceProducer == null ) { xaResourceProducer = new Ehcache3XAResourceProducer ( ) ; xaResourceProducer . setUniqueName ( uniqueName ) ; // the initial xaResource must be added before init() can be called xaResourceProducer . addXAResource ( xaResource ) ; Ehcache3XAResourceProducer previous = producers . putIfAbsent ( uniqueName , xaResourceProducer ) ; if ( previous == null ) { xaResourceProducer . init ( ) ; } else { previous . addXAResource ( xaResource ) ; } } else { xaResourceProducer . addXAResource ( xaResource ) ; } }
Register an XAResource of a cache with BTM . The first time a XAResource is registered a new EhCacheXAResourceProducer is created to hold it .