Search in sources :

Example 1 with AtomicCounterProxy

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;
    });
}
Also used : PrimitiveProxy(io.atomix.primitive.proxy.PrimitiveProxy) AtomicCounterProxy(io.atomix.core.counter.impl.AtomicCounterProxy)

Aggregations

AtomicCounterProxy (io.atomix.core.counter.impl.AtomicCounterProxy)1 PrimitiveProxy (io.atomix.primitive.proxy.PrimitiveProxy)1