question: public static synchronized void addResource ( RecoverableResource resource ) throws IllegalStateException { purgeResources ( ) ; if ( resources_ . containsKey ( resource . getName ( ) ) ) throw new IllegalStateException ( "Attempt to register second " + "resource with name " + resource . getName ( ) ) ; resource . setRecoveryService ( recoveryService_ ) ; resources_ . put ( resource . getName ( ) , resource ) ; resourceList_ . add ( resource ) ; }
target:  Add a resource to the transaction manager domain. Should be called for all resources that have to be recovered, BEFORE initializing the transaction manager! The purpose of registering resources is mainly to be able the recovery the ResourceTransaction context for each prepared ResourceTransction. This is needed for those ResourceTransaction instances that do not encapsulate the full state themselves, as in the XAResource case.