Created
April 26, 2011 21:53
-
-
Save ceocoder/943274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final ConcurrentMap<String, ShardInfo> indexShards = new MapMaker().makeMap(); | |
private static final Logger logger = Logger.getLogger(CassandraIndexManager.class); | |
private class ShardInfo | |
{ | |
public final String indexName; | |
public final long ttl = System.currentTimeMillis() | |
+ (expirationTime * 1000) - 1000; | |
public final ConcurrentSkipListMap<Integer, NodeInfo> shards = new ConcurrentSkipListMap<Integer, NodeInfo>(); | |
public ShardInfo(String indexName) | |
{ | |
this.indexName = indexName; | |
} | |
} | |
private class NodeInfo | |
{ | |
public Integer shard; | |
public Map<String, AtomicInteger> nodes = new HashMap<String, AtomicInteger>(); | |
public NodeInfo(Integer shard) | |
{ | |
this.shard = shard; | |
} | |
} | |
private class IdInfo | |
{ | |
public NodeInfo node; | |
public Integer id; | |
public Integer offset; | |
public final long ttl = System.currentTimeMillis() + expirationTime * 1000 - 1000; | |
public IdInfo(NodeInfo node, Integer id, Integer offset) | |
{ | |
this.node = node; | |
this.id = id; | |
this.offset = offset; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment