Example #1
0
 @Override
 public void destroy() throws AtomException {
   if (null != localTxDataSource) {
     try {
       localTxDataSource.destroy();
     } catch (Exception e) {
       throw new AtomException(e);
     }
   }
   if (null != configManager) {
     configManager.stop();
   }
 }
Example #2
0
  public void init() throws AtomException {

    // 默认使用zookeeper
    configManager = new DefaultAtomDataSourceConfigManager();
    configManager.init(gateway);

    _ds_lock_ = new ReentrantLock();
    DataSourceConfig config = configManager.getConfig(appName, dbKey);
    //
    reflush(config);

    configManager.register(
        appName,
        dbKey,
        new DataSourceConfigListener() {
          @Override
          public void changed(DataSourceConfig newConfig) {
            // 刷新数据源
            reflush(newConfig);
          }
        });
  }