Tabnine Logo
ServiceCache
Code IndexAdd Tabnine to your IDE (free)

How to use
ServiceCache
in
org.apache.curator.x.discovery

Best Java code snippets using org.apache.curator.x.discovery.ServiceCache (Showing top 20 results out of 315)

origin: apache/drill

@Override
public void start(long millisToWait) throws Exception {
 logger.debug("Starting ZKClusterCoordination.");
 discovery.start();
 if (millisToWait != 0) {
  boolean success = this.initialConnection.await(millisToWait,
    TimeUnit.MILLISECONDS);
  if (!success) {
   throw new IOException(String.format(
     "Failure to connect to the zookeeper cluster service within the allotted time of %d milliseconds.",
     millisToWait));
  }
 } else {
  this.initialConnection.await();
 }
 serviceCache = discovery.serviceCacheBuilder().name(serviceName).build();
 serviceCache.addListener(new EndpointListener());
 serviceCache.start();
 updateEndpoints();
}
origin: org.apache.curator/curator-x-discovery

/**
 * The provider must be started before use
 *
 * @throws Exception any errors
 */
@Override
public void start() throws Exception
{
  cache.start();
  discovery.providerOpened(this);
}
origin: spring-cloud/spring-cloud-zookeeper

@Override
public void clearDependencyRegistrationHooks() throws IOException {
  for (ServiceCache<?> cache : this.dependencyRegistry.values()) {
    cache.close();
  }
}
origin: org.apache.oozie/oozie-core

/**
 * Returns a list of the metadata provided by all of the Oozie Servers.  Note that the metadata is cached so it may be a second
 * or two stale.
 *
 * @return a List of the metadata provided by all of the Oozie Servers.
 */
public List<ServiceInstance<Map>> getAllMetaData() {
  List<ServiceInstance<Map>> instances = null;
  if (sCache != null) {
    instances = sCache.getInstances();
  }
  return instances;
}
origin: xiancloud/xian

    .build();
serviceProvider.start();
serviceProvider.serviceCache().addListener(new ServiceCacheListener<NodeStatus>() {
  @Override
  public void cacheChanged() {
origin: info.xiancloud/xian-curator-x-discovery

@Override
public ServiceInstance<T> getInstance(String id) {
  return cache.getInstance(id);
}
origin: info.xiancloud/xian-curator-x-discovery

/**
 * The provider must be started before use
 *
 * @throws Exception any errors
 */
@Override
public void start() throws Exception
{
  cache.start();
  discovery.providerOpened(this);
}
origin: dremio/dremio-oss

 @Override
 public void close() throws Exception {
  // might be redundant, as serviceCache clears them upon closure
  clearListeners();
  serviceCache.close();
 }
}
origin: apache/oozie

/**
 * Returns a list of the metadata provided by all of the Oozie Servers.  Note that the metadata is cached so it may be a second
 * or two stale.
 *
 * @return a List of the metadata provided by all of the Oozie Servers.
 */
public List<ServiceInstance<Map>> getAllMetaData() {
  List<ServiceInstance<Map>> instances = null;
  if (sCache != null) {
    instances = sCache.getInstances();
  }
  return instances;
}
origin: dremio/dremio-oss

@Override
public void start() throws Exception {
 serviceCache.start();
 serviceCache.addListener(new EndpointListener());
 updateEndpoints();
}
origin: com.daedafusion/service-discovery

@Override
public void start() throws Exception
{
  cache.start();
  discovery.providerOpened(this);
}
origin: info.xiancloud/xian-curator-x-discovery

/**
 * {@inheritDoc}
 */
@Override
public void close() throws IOException
{
  discovery.providerClosed(this);
  cache.close();
}
origin: dremio/dremio-oss

@Override
public Collection<NodeEndpoint> getAvailableEndpoints() {
 return transform(serviceCache.getInstances(),
   new Function<ServiceInstance<NodeEndpoint>, NodeEndpoint>() {
    @Override
    public NodeEndpoint apply(ServiceInstance<NodeEndpoint> input) {
     return input.getPayload();
    }
   });
}
origin: org.apache.drill.exec/drill-java-exec

@Override
public void start(long millisToWait) throws Exception {
 logger.debug("Starting ZKClusterCoordination.");
 discovery.start();
 if(millisToWait != 0) {
  boolean success = this.initialConnection.await(millisToWait, TimeUnit.MILLISECONDS);
  if (!success) {
   throw new IOException(String.format("Failure to connect to the zookeeper cluster service within the allotted time of %d milliseconds.", millisToWait));
  }
 }else{
  this.initialConnection.await();
 }
 serviceCache = discovery
   .serviceCacheBuilder()
   .name(serviceName)
   .build();
 serviceCache.addListener(new EndpointListener());
 serviceCache.start();
 updateEndpoints();
}
origin: apache/oozie

private void advertiseService() throws Exception {
  // Advertise on the service discovery
  new EnsurePath(ZK_BASE_SERVICES_PATH).ensure(client.getZookeeperClient());
  InstanceSerializer<Map> instanceSerializer = new FixedJsonInstanceSerializer<Map>(Map.class);
  sDiscovery = ServiceDiscoveryBuilder.builder(Map.class)
                      .basePath(ZK_BASE_SERVICES_PATH)
                      .client(client)
                      .serializer(instanceSerializer)
                      .build();
  sDiscovery.start();
  sDiscovery.registerService(getMetadataInstance());
  // Create the service discovery cache
  sCache = sDiscovery.serviceCacheBuilder().name(ZK_OOZIE_SERVICE).build();
  sCache.start();
  zkRegTime = sDiscovery.queryForInstance(ZK_OOZIE_SERVICE, zkId).getRegistrationTimeUTC();
}
origin: org.apache.curator/curator-x-discovery

/**
 * {@inheritDoc}
 */
@Override
public void close() throws IOException
{
  discovery.providerClosed(this);
  cache.close();
}
origin: spring-cloud/spring-cloud-zookeeper

  @SuppressWarnings("unchecked")
  public void verifyDependencyPresence(String dependencyName, @SuppressWarnings("rawtypes") ServiceCache serviceCache, boolean required) {
    if (required) {
      MANDATORY_DEPENDENCY_CHECKER.checkPresence(dependencyName, serviceCache.getInstances());
    } else {
      this.optionalDependencyChecker.checkPresence(dependencyName, serviceCache.getInstances());
    }
  }
}
origin: spring-cloud/spring-cloud-zookeeper

@Override
public void registerDependencyRegistrationHooks() {
  for (ZookeeperDependency zookeeperDependency : this.zookeeperDependencies.getDependencyConfigurations()) {
    String dependencyPath = zookeeperDependency.getPath();
    ServiceCache<?> serviceCache = getServiceDiscovery()
        .serviceCacheBuilder().name(dependencyPath).build();
    try {
      serviceCache.start();
    }
    catch (Exception e) {
      ReflectionUtils.rethrowRuntimeException(e);
    }
    this.dependencyPresenceOnStartupVerifier.verifyDependencyPresence(dependencyPath, serviceCache, zookeeperDependency.isRequired());
    this.dependencyRegistry.put(dependencyPath, serviceCache);
    serviceCache.addListener(new DependencyStateChangeListenerRegistry(this.listeners, dependencyPath, serviceCache));
  }
}
origin: org.apache.oozie/oozie-core

private void advertiseService() throws Exception {
  // Advertise on the service discovery
  new EnsurePath(ZK_BASE_SERVICES_PATH).ensure(client.getZookeeperClient());
  InstanceSerializer<Map> instanceSerializer = new FixedJsonInstanceSerializer<Map>(Map.class);
  sDiscovery = ServiceDiscoveryBuilder.builder(Map.class)
                      .basePath(ZK_BASE_SERVICES_PATH)
                      .client(client)
                      .serializer(instanceSerializer)
                      .build();
  sDiscovery.start();
  sDiscovery.registerService(getMetadataInstance());
  // Create the service discovery cache
  sCache = sDiscovery.serviceCacheBuilder().name(ZK_OOZIE_SERVICE).build();
  sCache.start();
  zkRegTime = sDiscovery.queryForInstance(ZK_OOZIE_SERVICE, zkId).getRegistrationTimeUTC();
}
origin: com.daedafusion/service-discovery

  @Override
  public void close() throws IOException
  {
    discovery.providerClosed(this);
    cache.close();
  }
}
org.apache.curator.x.discoveryServiceCache

Most used methods

  • start
    The cache must be started before use
  • addListener
  • close
  • getInstances
    Return the current list of instances. NOTE: there is no guarantee of freshness. This is merely the l
  • getInstance
  • getNewestServiceDefinition

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • getSupportFragmentManager (FragmentActivity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Runner (org.openjdk.jmh.runner)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now