private synchronized void unLoadUser(final String app) throws TddlException { String dataId = DATAID_PREFIX + this.cluster + "." + app + DATAID_SUFFIX; ConfigDataHandler cdh = cdhs.getIfPresent(dataId); if (cdh != null) { cdh.destroy(); cdhs.invalidate(dataId); } String newDataId = DATAID_PREFIX + app + DATAID_SUFFIX; cdh = cdhs.getIfPresent(newDataId); if (cdh != null) { cdh.destroy(); cdhs.invalidate(dataId); } users.remove(app); }
private synchronized void loadUser(final String app) throws ExecutionException, TddlException { String dataId = DATAID_PREFIX + this.cluster + "." + app + DATAID_SUFFIX; ConfigDataHandler cdh = getConfigDataHandler(app, dataId); String config = cdh.getData(); if (StringUtil.isEmpty(config)) { cdhs.invalidate(dataId); cdh.destroy(); // 重新拿一下新的dataId String newDataId = DATAID_PREFIX + app + DATAID_SUFFIX; cdh = getConfigDataHandler(app, newDataId); config = cdh.getData(); } this.parseConfig(dataId, app, config); }
@Override protected void doDestroy() throws TddlException { for (ConfigDataHandler cdh : cdhs.asMap().values()) { try { cdh.destroy(); } catch (Exception e) { // ignore } } for (SchemaConfig schema : schemas.values()) { TDataSource dataSource = schema.getDataSource(); try { if (dataSource != null) { dataSource.destroy(); } } catch (Exception e) { // ignore } } }