Codota Logo
PrimitiveManagementService
Code IndexAdd Codota to your IDE (free)

How to use
PrimitiveManagementService
in
io.atomix.primitive

Best Java code snippets using io.atomix.primitive.PrimitiveManagementService (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: atomix/atomix

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);
}
origin: atomix/atomix

@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;
   });
}
origin: atomix/atomix

 @Override
 public CompletableFuture<DistributedCounter> buildAsync() {
  PrimitiveProtocol protocol = protocol();
  if (protocol instanceof GossipProtocol) {
   if (protocol instanceof CounterProtocol) {
    return managementService.getPrimitiveCache().getPrimitive(name, () -> CompletableFuture.completedFuture(
      new GossipDistributedCounter(name, (GossipProtocol) protocol, ((CounterProtocol) protocol)
        .newCounterDelegate(name, managementService))))
      .thenApply(AsyncDistributedCounter::sync);
   } else {
    return Futures.exceptionalFuture(new UnsupportedOperationException("Counter is not supported by the provided gossip protocol"));
   }
  } else if (protocol instanceof ProxyProtocol) {
   return newProxy(AtomicCounterService.class, new ServiceConfig())
     .thenCompose(proxy -> new AtomicCounterProxy(proxy, managementService.getPrimitiveRegistry()).connect())
     .thenApply(DelegatingDistributedCounter::new)
     .thenApply(AsyncDistributedCounter::sync);
  } else {
   return Futures.exceptionalFuture(new ConfigurationException("Invalid protocol type"));
  }
 }
}
origin: atomix/atomix

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);
}
origin: atomix/atomix

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);
}
origin: atomix/atomix

@Override
public Collection<PrimitiveInfo> getPrimitives() {
 return managementService.getPrimitiveRegistry().getPrimitives();
}
origin: atomix/atomix

 @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);
 }
}
origin: atomix/atomix

 Function<Transactional<?>, CompletableFuture<Void>> completionFunction) {
PrimitiveType primitiveType = managementService.getPrimitiveTypeRegistry().getPrimitiveType(participantInfo.type());
if (primitiveType == null) {
 return Futures.exceptionalFuture(new TransactionException("Failed to locate primitive type " + participantInfo.type() + " for participant " + participantInfo.name()));
PrimitiveProtocol.Type protocolType = managementService.getProtocolTypeRegistry().getProtocolType(participantInfo.protocol());
if (protocolType == null) {
 return Futures.exceptionalFuture(new TransactionException("Failed to locate protocol type for participant " + participantInfo.name()));
 partitionGroup = managementService.getPartitionService().getPartitionGroup(protocolType);
} else {
 partitionGroup = managementService.getPartitionService().getPartitionGroup(participantInfo.group());
origin: atomix/atomix

public AntiEntropyMapDelegate(String name, Serializer entrySerializer, AntiEntropyProtocolConfig config, PrimitiveManagementService managementService) {
 this.localMemberId = managementService.getMembershipService().getLocalMember().id();
 this.mapName = name;
 this.entrySerializer = entrySerializer;
 destroyedMessage = mapName + ERROR_DESTROYED;
 this.clusterCommunicator = managementService.getCommunicationService();
 this.membershipService = managementService.getMembershipService();
   : managementService.getMembershipService()
     .getMembers()
     .stream()
origin: atomix/atomix

@Override
public CompletableFuture<Void> stop() {
 if (started.compareAndSet(true, false)) {
  managementService.getMembershipService().removeListener(clusterEventListener);
  return transactions.close().exceptionally(e -> null);
 }
 return CompletableFuture.completedFuture(null);
}
origin: atomix/atomix

protected <S> CompletableFuture<ProxyClient<S>> newProxy(Class<S> serviceType, ServiceConfig config) {
 PrimitiveProtocol protocol = protocol();
 if (protocol instanceof ProxyProtocol) {
  try {
   return CompletableFuture.completedFuture(((ProxyProtocol) protocol)
     .newProxy(name, type, serviceType, config, managementService.getPartitionService()));
  } catch (Exception e) {
   return Futures.exceptionalFuture(e);
  }
 }
 return Futures.exceptionalFuture(new UnsupportedOperationException());
}
origin: atomix/atomix

SerializerBuilder serializerBuilder = managementService.getSerializationService().newBuilder(name);
serializerBuilder.withNamespace(new Namespace(namespaceConfig));
origin: atomix/atomix

 /**
  * Gets or builds a singleton instance of the primitive asynchronously.
  * <p>
  * The returned primitive will be shared by all {@code get()} calls for the named primitive. If no instance has yet
  * been constructed, the instance will be built from this builder's configuration.
  *
  * @return a singleton instance of the primitive
  */
 public CompletableFuture<P> getAsync() {
  return managementService.getPrimitiveCache().getPrimitive(name, this::buildAsync);
 }
}
origin: atomix/atomix

@Override
public Collection<PrimitiveInfo> getPrimitives(PrimitiveType primitiveType) {
 return managementService.getPrimitiveRegistry().getPrimitives(primitiveType);
}
origin: atomix/atomix

 @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);
 }
}
origin: io.atomix/atomix

 Function<Transactional<?>, CompletableFuture<Void>> completionFunction) {
PrimitiveType primitiveType = managementService.getPrimitiveTypeRegistry().getPrimitiveType(participantInfo.type());
if (primitiveType == null) {
 return Futures.exceptionalFuture(new TransactionException("Failed to locate primitive type " + participantInfo.type() + " for participant " + participantInfo.name()));
PrimitiveProtocol.Type protocolType = managementService.getProtocolTypeRegistry().getProtocolType(participantInfo.protocol());
if (protocolType == null) {
 return Futures.exceptionalFuture(new TransactionException("Failed to locate protocol type for participant " + participantInfo.name()));
 partitionGroup = managementService.getPartitionService().getPartitionGroup(protocolType);
} else {
 partitionGroup = managementService.getPartitionService().getPartitionGroup(participantInfo.group());
origin: io.atomix/atomix-gossip

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);
}
origin: io.atomix/atomix-gossip

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);
}
origin: io.atomix/atomix-gossip

public AntiEntropyMapDelegate(String name, Serializer entrySerializer, AntiEntropyProtocolConfig config, PrimitiveManagementService managementService) {
 this.localMemberId = managementService.getMembershipService().getLocalMember().id();
 this.mapName = name;
 this.entrySerializer = entrySerializer;
 destroyedMessage = mapName + ERROR_DESTROYED;
 this.clusterCommunicator = managementService.getCommunicationService();
 this.membershipService = managementService.getMembershipService();
   managementService.getMembershipService()
     .getMembers()
     .stream()
origin: atomix/atomix

public CoreTransactionService(PrimitiveManagementService managementService) {
 this.managementService = checkNotNull(managementService);
 this.localMemberId = managementService.getMembershipService().getLocalMember().id();
}
io.atomix.primitivePrimitiveManagementService

Javadoc

Primitive management service.

Most used methods

  • getExecutorService
  • getMembershipService
  • getPartitionService
  • getPrimitiveCache
  • getCommunicationService
  • getEventService
  • getPrimitiveRegistry
  • getPrimitiveTypeRegistry
  • getProtocolTypeRegistry
  • getSerializationService

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (Timer)
  • onRequestPermissionsResult (Fragment)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • DataSource (javax.sql)
    A factory for connections to the physical data source that this DataSource object represents. An alt
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now