Example usage for com.google.common.collect OtterMigrateMap makeSoftValueComputingMap

List of usage examples for com.google.common.collect OtterMigrateMap makeSoftValueComputingMap

Introduction

In this page you can find the example usage for com.google.common.collect OtterMigrateMap makeSoftValueComputingMap.

Prototype

@SuppressWarnings("deprecation")
    public static <K, V> ConcurrentMap<K, V> makeSoftValueComputingMap(
            Function<? super K, ? extends V> computingFunction) 

Source Link

Usage

From source file:com.alibaba.otter.node.etl.common.db.dialect.mysql.MysqlDialect.java

private void initShardColumns() {
    this.shardColumns = OtterMigrateMap.makeSoftValueComputingMap(new Function<List<String>, String>() {

        public String apply(List<String> names) {
            Assert.isTrue(names.size() == 2);
            try {
                String result = DdlUtils.getShardKeyByDRDS(jdbcTemplate, names.get(0), names.get(0),
                        names.get(1));//from   w  w w.  j  a  va2s  . c om
                if (StringUtils.isEmpty(result)) {
                    return "";
                } else {
                    return result;
                }
            } catch (Exception e) {
                throw new NestableRuntimeException(
                        "find table [" + names.get(0) + "." + names.get(1) + "] error", e);
            }
        }
    });
}