Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinsb/jetcd
Java binding for etcd
https://github.com/justinsb/jetcd
Last synced: 18 days ago
JSON representation
Java binding for etcd
- Host: GitHub
- URL: https://github.com/justinsb/jetcd
- Owner: justinsb
- License: apache-2.0
- Created: 2013-09-04T23:16:59.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T09:35:31.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T20:45:45.660Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 30.3 KB
- Stars: 137
- Watchers: 15
- Forks: 55
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - jetcd - Client library for etcd. (Projects / Database)
- awesome-java-zh - jetcd - 用于etcd的客户端库。 (项目 / 数据库)
- awesome-java - jetcd - Client library for etcd. (Projects / Database)
README
jetcd: Java binding for etcd
============================TravisCI: [![Build Status](https://travis-ci.org/justinsb/jetcd.png?branch=master)](https://travis-ci.org/justinsb/jetcd)
CircleCI: ![CircleCI Status](https://circleci.com/gh/justinsb/jetcd.png?circle-token=ebf4870e1fc43b6d6139a0514312441b7dc11457)
A simple Java client library for the awesome [etcd]
Uses the Apache [HttpAsyncClient] to implement watches without blocking a thread, and Google's [Guava] to give us the nice [ListenableFuture] interface.
Check out [SmokeTest.java] to see how this is used (and tested), but here's a quick code example:
```Java
EtcdClient client = new EtcdClient(URI.create("http://127.0.0.1:4001/"));String key = "/watch";
EtcdResult result = this.client.set(key, "hello");
Assert.assertEquals("hello", result.value);result = this.client.get(key);
Assert.assertEquals("hello", result.value);
ListenableFuture watchFuture = this.client.watch(key, result.index + 1);
Assert.assertFalse(watchFuture.isDone());result = this.client.set(key, "world");
Assert.assertEquals("world", result.value);EtcdResult watchResult = watchFuture.get(100, TimeUnit.MILLISECONDS);
Assert.assertNotNull(result);
Assert.assertEquals("world", result.value);
```
For a bit of background, check out the [blog post][blog post]: http://blog.justinsb.com
[etcd]: http://coreos.com/blog/distributed-configuration-with-etcd/
[SmokeTest.java]: https://github.com/justinsb/jetcd/blob/master/src/test/java/com/justinsb/etcd/SmokeTest.java
[ListenableFuture]: https://code.google.com/p/guava-libraries/wiki/ListenableFutureExplained
[Guava]: https://plus.google.com/118010414872916542489
[HttpAsyncClient]:http://hc.apache.org/httpcomponents-asyncclient-dev/