use of com.alibaba.otter.shared.common.utils.meta.DdlUtilsFilter in project otter by alibaba.
the class AbstractDbDialect method initTables.
// ================================ helper method ==========================
private void initTables(final JdbcTemplate jdbcTemplate) {
// soft引用设置,避免内存爆了
GenericMapMaker mapMaker = null;
mapMaker = new MapMaker().softValues().evictionListener(new MapEvictionListener<List<String>, Table>() {
public void onEviction(List<String> names, Table table) {
logger.warn("Eviction For Table:" + table);
}
});
this.tables = mapMaker.makeComputingMap(new Function<List<String>, Table>() {
public Table apply(List<String> names) {
Assert.isTrue(names.size() == 2);
try {
beforeFindTable(jdbcTemplate, names.get(0), names.get(0), names.get(1));
DdlUtilsFilter filter = getDdlUtilsFilter(jdbcTemplate, names.get(0), names.get(0), names.get(1));
Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1), filter);
afterFindTable(table, jdbcTemplate, names.get(0), names.get(0), names.get(1));
if (table == null) {
throw new NestableRuntimeException("no found table [" + names.get(0) + "." + names.get(1) + "] , pls check");
} else {
return table;
}
} catch (Exception e) {
throw new NestableRuntimeException("find table [" + names.get(0) + "." + names.get(1) + "] error", e);
}
}
});
}
Aggregations