• 0.15

Stateful Web Primitives

This is a Java SDK for a collection of stateful web primitives at www.stateful.co.

For example, you need a lock available online and shared among multiple processes running on different nodes in the network. Here is how you do it in Java, using this SDK:

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) throws Exception {
    Sttc sttc = new RtSttc(
      new URN("urn:github:526301"),
      "9FF3-41E0-73FB-F900"
    );
    Lock lock = sttc.locks().get("my-test-lock");
    new Atomic<Void>(
      new Callable<Void>() {
        @Override
        public Void call() {
          System.out.println("this call is synchronized");
        }
      },
      lock
    ).call();
  }
}

The only dependency you need is (you can also download java-sdk-0.15.jar and add it to the classpath):

<dependency>
  <groupId>co.stateful</groupId>
  <artifactId>java-sdk</artifactId>
  <version>0.15</version>
</dependency>

If you want to use current version of the product, you can do it with this configuration in your pom.xml:

<repositories>
  <repository>
    <id>oss.sonatype.org</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
  </repository>
</repositories>
<dependencies>
  <dependency>
    <groupId>co.stateful</groupId>
    <artifactId>java-sdk</artifactId>
    <version>1.0-SNAPSHOT</version>
  </dependency>
</dependencies>