Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

sttc/java-sdk

Repository files navigation

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn Maven Central Javadoc

This is Java SDK for Stateful.

The JavaDoc is here.

First, register an account at Stateful. Then, you can create a counter and increment it:

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:

Locks locks = sttc.locks();
Lock lock = locks.get("test-lock");
new Atomic(lock).call(
 new Callable<Void>() {
 @Override
 public void call() {
 // perfectly synchronized code
 return null;
 }
 }
);

Contributors 4

Languages

AltStyle によって変換されたページ (->オリジナル) /