The README example for using a Lock at README.md lines 42 to 54 does not compile against the current API.
It calls new Atomic(lock), but Atomic declares no constructor that takes only a Lock; the three public constructors at src/main/java/co/stateful/Atomic.java lines 89, 99, and 112 all require a Callable<T> as the first argument. The same example then invokes .call(...) with a Callable argument, but Atomic#call() is the no-arg method declared on java.util.concurrent.Callable; it takes nothing and returns T. The inner Callable<Void> further declares its call() method as public void call() instead of public Void call(), so the override signature is wrong too.
The Javadoc at the top of Atomic already shows the correct shape on lines 24 to 33: build the Callable first, then pass it together with the Lock into new Atomic<>(origin, lock) and invoke .call() with no arguments. Replace the README block with the same shape so the snippet matches the real API: declare a Callable<Void> work = new Callable<Void>() { @Override public Void call() { return null; } }; and then run new Atomic<>(work, lock).call();.
The README example for using a Lock at
README.mdlines 42 to 54 does not compile against the current API.It calls
new Atomic(lock), butAtomicdeclares no constructor that takes only aLock; the three public constructors atsrc/main/java/co/stateful/Atomic.javalines 89, 99, and 112 all require aCallable<T>as the first argument. The same example then invokes.call(...)with aCallableargument, butAtomic#call()is the no-arg method declared onjava.util.concurrent.Callable; it takes nothing and returnsT. The innerCallable<Void>further declares itscall()method aspublic void call()instead ofpublic Void call(), so the override signature is wrong too.The Javadoc at the top of
Atomicalready shows the correct shape on lines 24 to 33: build theCallablefirst, then pass it together with theLockintonew Atomic<>(origin, lock)and invoke.call()with no arguments. Replace the README block with the same shape so the snippet matches the real API: declare aCallable<Void> work = new Callable<Void>() { @Override public Void call() { return null; } };and then runnew Atomic<>(work, lock).call();.