https://github.com/sttc/java-sdk
Java Client SDK for Stateful.co
https://github.com/sttc/java-sdk
java java-sdk locks multi-node synchronization
Last synced: about 1 month ago
JSON representation
Java Client SDK for Stateful.co
- Host: GitHub
- URL: https://github.com/sttc/java-sdk
- Owner: sttc
- License: other
- Created: 2014-05-09T12:54:10.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2026-03-21T07:27:06.000Z (about 2 months ago)
- Last Synced: 2026-03-21T21:33:57.324Z (about 2 months ago)
- Topics: java, java-sdk, locks, multi-node, synchronization
- Language: Java
- Homepage: https://java-sdk.stateful.co
- Size: 1.84 MB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Java SDK for Stateful.co
[](https://www.elegantobjects.org)
[](https://www.rultor.com/p/sttc/java-sdk)
[](https://www.jetbrains.com/idea/)
[](https://github.com/sttc/java-sdk/actions/workflows/mvn.yml)
[](https://maven-badges.herokuapp.com/maven-central/co.stateful/java-sdk)
[](https://www.javadoc.io/doc/co.stateful/java-sdk)
This is Java SDK for [Stateful](https://www.stateful.co).
See our [JavaDoc](http://java-sdk.stateful.co/).
First, register an account at [Stateful](https://www.stateful.co).
Then, you can create a counter and increment it:
```java
import co.stateful.Counter;
import co.stateful.Counters;
import co.stateful.Sttc;
import co.stateful.RtSttc;
import com.jcabi.urn.URN;
public class Main {
public static void main(String... args) {
Sttc sttc = new RtSttc(
new URN("urn:github:526301"),
"9FF3-41E0-73FB-F900"
);
String name = "test-123";
Counters counters = sttc.counters();
Counter counter = counters.create(name);
long value = counter.incrementAndGet(1L);
System.out.println("new value: " + value);
counters.delete(name);
}
}
```
Here is how you can use a lock:
```java
Locks locks = sttc.locks();
Lock lock = locks.get("test-lock");
new Atomic(lock).call(
new Callable() {
@Override
public void call() {
// perfectly synchronized code
return null;
}
}
);
```
## How to Contribute
Fork repository, make changes, send us a
[pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).
We will review your changes and apply them to the `master` branch shortly,
provided they don't violate our quality standards. To avoid frustration,
before sending us your pull request please run full Maven build:
```bash
mvn clean install -Pqulice
```
You will need Maven 3.3+ and Java 11+.