@Loggable(value=1) public final class Atomic<T> extends Object implements Callable<T>
This class runs your Callable in a concurrent thread-safe
manner, using a lock from Stateful.co. For example:
Callable<String> origin = new Callable<String>() {
@Override
public String call() {
// fetch it from a thread-critical resource
// and return
}
};
Lock lock = new RtSttc(new URN("urn:github:12345"), "token")
.locks().lock("test");
String result = new Atomic<String>(origin, lock).call();
If you want to use Runnable instead, try static method
Executors.callable(Runnable). If you
want to avoid checked exceptions, use callQuietly().
Copyright © 2014–2015 stateful.co. All rights reserved.