-
Notifications
You must be signed in to change notification settings - Fork 0
Home
KeptCollections is a library of drop-in replacements for the data structures in the Java Collections framework. KeptCollections uses Apache ZooKeeper as a backing store, thus making its data structures distributed and scalable.
Changes made to a KeptCollection by one node are seen by all other nodes within milliseconds, allowing for easy communication between nodes in a computing cluster.
Implementing a distributed data structure from scratch is difficult. ZooKeeper programming is less hard, but still no walk in the park. Conversely, KeptCollections implements the well known Java Collections APIs, so they can be easily dropped into new or existing Java code and easily make those applications distributed.
The only difference between the KeptCollections collections and the JDK collections are the names of the classes and their constructors.
For instance, where a Map from Java Collections could be instantiated like:
Map map = new HashMap();
KeptCollections is instead instantiated like:
Zookeeper zk = new ZooKeeper("localhost:2181", 20000, watcher);
Map<String, String> map =
new KeptMap(zk, "/mymap", Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
Both are accessed the same way:
map.put("key", "value");
String value = map.get("key");
The KeptSet, KeptMap and KeptLock implementations have seen several years of usage in a production environment at two different cloud computing companies.
The other implementations are similar in code base and well unit tested, but have not seen production usage.