コード例 #1
0
  /** Public for testing purpose. Do not use. */
  public synchronized void unregisterDataSource(String name) {
    final XaDataSource dataSource = dataSources.get(name);
    if (dataSource == null) {
      return;
    }

    byte branchId[] = getBranchId(dataSource.getXaConnection().getXaResource());
    dataSources.remove(name);
    branchIdMapping.remove(UTF8.decode(branchId));
    sourceIdMapping.remove(name);
    Listeners.notifyListeners(
        dsRegistrationListeners,
        new Listeners.Notification<DataSourceRegistrationListener>() {
          @Override
          public void notify(DataSourceRegistrationListener listener) {
            listener.unregisteredDataSource(dataSource);
          }
        });
    life.remove(dataSource);
    // No need for shutdown, removing does that
  }