public CrdtValueDelegate(String name, Serializer serializer, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.clusterEventService = managementService.getEventService(); this.executorService = managementService.getExecutorService(); this.valueSerializer = serializer; this.timestampProvider = config.getTimestampProvider(); this.subject = String.format("atomix-crdt-value-%s", name); subscribeFuture = clusterEventService.subscribe(subject, SERIALIZER::decode, this::updateValue, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastValue, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
public CrdtSetDelegate(String name, Serializer serializer, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.clusterCommunicator = managementService.getCommunicationService(); this.executorService = managementService.getExecutorService(); this.elementSerializer = serializer; this.timestampProvider = config.getTimestampProvider(); this.subject = String.format("atomix-crdt-set-%s", name); clusterCommunicator.subscribe(subject, SERIALIZER::decode, this::updateElements, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastElements, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
public CrdtCounterDelegate(String name, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.localMemberId = managementService.getMembershipService().getLocalMember().id(); this.clusterCommunicator = managementService.getCommunicationService(); this.executorService = managementService.getExecutorService(); this.subject = String.format("atomix-crdt-counter-%s", name); clusterCommunicator.subscribe(subject, SERIALIZER::decode, this::updateCounters, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastCounters, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
@SuppressWarnings("unchecked") @Override public CompletableFuture<DistributedSemaphore> buildAsync() { return newProxy(AtomicSemaphoreService.class, new AtomicSemaphoreServiceConfig().setInitialCapacity(config.initialCapacity())) .thenCompose(proxy -> new AtomicSemaphoreProxy( proxy, managementService.getPrimitiveRegistry(), managementService.getExecutorService()) .connect()) .thenApply(DelegatingAsyncDistributedSemaphore::new) .thenApply(AsyncDistributedSemaphore::sync); } }
@SuppressWarnings("unchecked") @Override public CompletableFuture<AtomicSemaphore> buildAsync() { return newProxy(AtomicSemaphoreService.class, new AtomicSemaphoreServiceConfig().setInitialCapacity(config.initialCapacity())) .thenCompose(proxy -> new AtomicSemaphoreProxy( proxy, managementService.getPrimitiveRegistry(), managementService.getExecutorService()) .connect()) .thenApply(AsyncAtomicSemaphore::sync); } }
public CrdtSetDelegate(String name, Serializer serializer, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.clusterCommunicator = managementService.getCommunicationService(); this.executorService = managementService.getExecutorService(); this.elementSerializer = serializer; this.timestampProvider = config.getTimestampProvider(); this.subject = String.format("atomix-crdt-set-%s", name); clusterCommunicator.subscribe(subject, SERIALIZER::decode, this::updateElements, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastElements, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
public CrdtValueDelegate(String name, Serializer serializer, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.clusterEventService = managementService.getEventService(); this.executorService = managementService.getExecutorService(); this.valueSerializer = serializer; this.timestampProvider = config.getTimestampProvider(); this.subject = String.format("atomix-crdt-value-%s", name); subscribeFuture = clusterEventService.subscribe(subject, SERIALIZER::decode, this::updateValue, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastValue, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
public CrdtCounterDelegate(String name, CrdtProtocolConfig config, PrimitiveManagementService managementService) { this.localMemberId = managementService.getMembershipService().getLocalMember().id(); this.clusterCommunicator = managementService.getCommunicationService(); this.executorService = managementService.getExecutorService(); this.subject = String.format("atomix-crdt-counter-%s", name); clusterCommunicator.subscribe(subject, SERIALIZER::decode, this::updateCounters, executorService); broadcastFuture = executorService.scheduleAtFixedRate( this::broadcastCounters, config.getGossipInterval().toMillis(), config.getGossipInterval().toMillis(), TimeUnit.MILLISECONDS); }
@SuppressWarnings("unchecked") @Override public CompletableFuture<DistributedSemaphore> buildAsync() { return newProxy(AtomicSemaphoreService.class, new AtomicSemaphoreServiceConfig().setInitialCapacity(config.initialCapacity())) .thenCompose(proxy -> new AtomicSemaphoreProxy( proxy, managementService.getPrimitiveRegistry(), managementService.getExecutorService()) .connect()) .thenApply(DelegatingAsyncDistributedSemaphore::new) .thenApply(AsyncDistributedSemaphore::sync); } }
@SuppressWarnings("unchecked") @Override public CompletableFuture<AtomicSemaphore> buildAsync() { return newProxy(AtomicSemaphoreService.class, new AtomicSemaphoreServiceConfig().setInitialCapacity(config.initialCapacity())) .thenCompose(proxy -> new AtomicSemaphoreProxy( proxy, managementService.getPrimitiveRegistry(), managementService.getExecutorService()) .connect()) .thenApply(AsyncAtomicSemaphore::sync); } }