Пример #1
0
 /**
  * Reference counts and deactivate a configuration Notice: this won't remove the servers since a
  * server may have previous XIDs
  *
  * @param resourceConfig
  */
 public void unRegister(final XARecoveryConfig resourceConfig) {
   RecoveryDiscovery discoveryRecord = configSet.get(resourceConfig);
   if (discoveryRecord != null && discoveryRecord.decrementUsage() == 0) {
     discoveryRecord = configSet.remove(resourceConfig);
     if (discoveryRecord != null) {
       discoveryRecord.stop();
     }
   }
 }
Пример #2
0
 /**
  * This will be called by then resource adapters, to register a new discovery
  *
  * @param resourceConfig
  */
 public void register(final XARecoveryConfig resourceConfig) {
   RecoveryDiscovery newInstance = new RecoveryDiscovery(resourceConfig);
   RecoveryDiscovery discoveryRecord = configSet.putIfAbsent(resourceConfig, newInstance);
   if (discoveryRecord == null) {
     discoveryRecord = newInstance;
     discoveryRecord.start(false);
   }
   // you could have a configuration shared with multiple MDBs or RAs
   discoveryRecord.incrementUsage();
 }
Пример #3
0
 /**
  * We need to make sure that all resources are closed, we don't actually do this when a
  * resourceConfig is closed but maybe we should.
  */
 public void stop() {
   for (RecoveryDiscovery recoveryDiscovery : configSet.values()) {
     recoveryDiscovery.stop();
   }
   for (HornetQXAResourceWrapper hornetQXAResourceWrapper : recoveries.values()) {
     hornetQXAResourceWrapper.close();
   }
   recoveries.clear();
   configSet.clear();
 }