Search in sources :

Example 1 with Router

use of com.newcosoft.cache.Router in project disgear by yangbutao.

the class ClusterState method collectionFromObjects.

private static CacheCollection collectionFromObjects(String name, Map<String, Object> objs) {
    Map<String, Object> props;
    Map<String, Shard> slices;
    Map<String, Object> sliceObjs = (Map<String, Object>) objs.get(CacheCollection.SHARDS);
    if (sliceObjs == null) {
        slices = makeShards(objs);
        props = Collections.emptyMap();
    } else {
        slices = makeShards(sliceObjs);
        props = new HashMap<String, Object>(objs);
        objs.remove(CacheCollection.SHARDS);
    }
    Router router = Router.DEFAULT;
    return new CacheCollection(name, slices, props, router);
}
Also used : Router(com.newcosoft.cache.Router) Shard(com.newcosoft.cache.Shard) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CacheCollection(com.newcosoft.cache.CacheCollection)

Aggregations

CacheCollection (com.newcosoft.cache.CacheCollection)1 Router (com.newcosoft.cache.Router)1 Shard (com.newcosoft.cache.Shard)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1