Jose and I discussed this over a phone call. This is a recap, to keep
the discussion in the community.
I used his branch to implement a distributed register demo (basically a
long) that is updated by multiple threads in a number of nodes. Each
thread randomly applies an addition, subtraction, multiplcation or
division with a random number to the register. When stopped, every node
must have exactly the same register. This demo will be added to the 2.0
branch.
We're still trying to reduce the complexity of 2.0 further, e.g. by
removing the registration annotation. An idea is to the have a class
implement the state machine without implementing `StateMachine`, e.g.
@StateMachine
public class Register { // could possibly be changed to a record
@State(id=1,version=1)
protected long number;
@ReadOperation
public long get() {return number;}
@WriteOperation
public void set(long num) {this.number=num;}
@WriteOperation
public boolean compareAndSwap(long expected, long new_val) {...}
// note that apply(), readContentsFrom(), writeContentsTo() are gone
}
This way, we could actually send operations defined in the state machine
in JRaft.submit(). Jose is thinking more about this, but please feel
free to pitch in an submit feedback. The more ideas, the better!
An interesting topic was on which JDK to baseline 2.0. Currently
protostream requires 17. I suggested 21, which is an LTS and has virtual
threads which are a great feature to have. If vthreads are available, we
could even use a blocking API (no CompletionStages) without downsides...
However, baselining on 17 or 21 means that some folks will not be able
to use it for the time being.
Feedback? Remain on JDK 11? Go to 17/21?
Cheers
--
Bela Ban |
http://www.jgroups.org