use of io.atomix.core.counter.impl.AtomicCounterProxy in project atomix by atomix.
the class IdGeneratorSessionIdService method start.
@Override
@SuppressWarnings("unchecked")
public CompletableFuture<SessionIdService> start() {
PrimitiveProxy proxy = partitions.getPartition(PRIMITIVE_NAME).getPrimitiveClient().newProxy(PRIMITIVE_NAME, AtomicIdGeneratorType.instance(), RaftProtocol.builder().withMinTimeout(Duration.ofMillis(250)).withMaxTimeout(Duration.ofSeconds(5)).withReadConsistency(ReadConsistency.LINEARIZABLE).withCommunicationStrategy(CommunicationStrategy.LEADER).withRecoveryStrategy(Recovery.RECOVER).withMaxRetries(5).build());
return proxy.connect().thenApply(v -> {
idGenerator = new DelegatingAtomicIdGenerator(new AtomicCounterProxy(proxy));
started.set(true);
return this;
});
}
Aggregations