use of io.atomix.primitive.protocol.ProxyProtocol in project atomix by atomix.
the class CorePrimitiveRegistry method start.
@Override
@SuppressWarnings("unchecked")
public CompletableFuture<PrimitiveRegistry> start() {
ProxyProtocol protocol = partitionService.getSystemPartitionGroup().newProtocol();
ProxyClient proxy = protocol.newProxy("primitives", AtomicMapType.instance(), AtomicMapService.class, new ServiceConfig(), partitionService);
return proxy.connect().thenApply(v -> {
AtomicMapProxy mapProxy = new AtomicMapProxy(proxy, this);
primitives = new TranscodingAsyncAtomicMap<>(mapProxy, key -> key, key -> key, value -> value != null ? SERIALIZER.encode(value) : null, value -> value != null ? SERIALIZER.decode(value) : null);
started.set(true);
return this;
});
}
use of io.atomix.primitive.protocol.ProxyProtocol in project atomix by atomix.
the class CoreTransactionService method start.
@Override
@SuppressWarnings("unchecked")
public CompletableFuture<TransactionService> start() {
PrimitiveProtocol protocol = managementService.getPartitionService().getSystemPartitionGroup().newProtocol();
return AtomicMapType.<TransactionId, TransactionInfo>instance().newBuilder("atomix-transactions", new AtomicMapConfig(), managementService).withSerializer(SERIALIZER).withProtocol((ProxyProtocol) protocol).withCacheEnabled().buildAsync().thenApply(transactions -> {
this.transactions = transactions.async();
managementService.getMembershipService().addListener(clusterEventListener);
LOGGER.info("Started");
started.set(true);
return this;
});
}
Aggregations