use of com.alipay.sofa.jraft.example.counter.rpc.CounterOutter.IncrementAndGetRequest in project sofa-jraft by sofastack.
the class CounterClient method incrementAndGet.
private static void incrementAndGet(final CliClientServiceImpl cliClientService, final PeerId leader, final long delta, CountDownLatch latch) throws RemotingException, InterruptedException {
IncrementAndGetRequest request = IncrementAndGetRequest.newBuilder().setDelta(delta).build();
cliClientService.getRpcClient().invokeAsync(leader.getEndpoint(), request, new InvokeCallback() {
@Override
public void complete(Object result, Throwable err) {
if (err == null) {
latch.countDown();
System.out.println("incrementAndGet result:" + result);
} else {
err.printStackTrace();
latch.countDown();
}
}
@Override
public Executor executor() {
return null;
}
}, 5000);
}
Aggregations