private void loadShardCache ( TableDefinition tableDef ) { String appName = tableDef . getAppDef ( ) . getAppName ( ) ; String tableName = tableDef . getTableName ( ) ; m_logger . debug ( "Loading shard cache for {}.{}" , appName , tableName ) ; Date cacheDate = new Date ( ) ; String cacheKey = appName + "/" + tableName ; m_cacheMap . put ( cacheKey , cacheDate ) ; Map < String , Map < Integer , Date > > tableMap = m_appShardMap . get ( appName ) ; if ( tableMap == null ) { tableMap = new HashMap <> ( ) ; m_appShardMap . put ( appName , tableMap ) ; } Map < Integer , Date > shardMap = tableMap . get ( tableName ) ; if ( shardMap == null ) { shardMap = new HashMap <> ( ) ; tableMap . put ( tableName , shardMap ) ; } Tenant tenant = Tenant . getTenant ( tableDef ) ; String storeName = SpiderService . termsStoreName ( tableDef ) ; for ( DColumn col : DBService . instance ( tenant ) . getAllColumns ( storeName , SpiderTransaction . SHARDS_ROW_KEY ) ) { Integer shardNum = Integer . parseInt ( col . getName ( ) ) ; Date shardDate = new Date ( Long . parseLong ( col . getValue ( ) ) ) ; shardMap . put ( shardNum , shardDate ) ; } }
worry about concurrency .