Skip to content

Instantly share code, notes, and snippets.

@ceocoder
Created April 26, 2011 21:53
Show Gist options
  • Save ceocoder/943274 to your computer and use it in GitHub Desktop.
Save ceocoder/943274 to your computer and use it in GitHub Desktop.
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