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);
}

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 ) ; }
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 .
