@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; }); }
@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; }); }
/** * Returns the first partition group that matches the given primitive protocol. * * @param protocol the primitive protocol * @return the first partition group that matches the given primitive protocol */ @SuppressWarnings("unchecked") default PartitionGroup getPartitionGroup(ProxyProtocol protocol) { if (protocol.group() != null) { PartitionGroup group = getPartitionGroup(protocol.group()); if (group != null) { return group; } PartitionGroup systemGroup = getSystemPartitionGroup(); if (systemGroup != null && systemGroup.name().equals(protocol.group())) { return systemGroup; } return null; } for (PartitionGroup partitionGroup : getPartitionGroups()) { if (partitionGroup.protocol().name().equals(protocol.type().name())) { return partitionGroup; } } return null; }
@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; }); }
@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; }); }