com.couchbase.client.java.Bucket.core()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.couchbase.client.java.Bucket.core()方法的一些代码示例,展示了Bucket.core()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bucket.core()方法的具体详情如下:
包路径:com.couchbase.client.java.Bucket
类名称:Bucket
方法名:core

Bucket.core介绍

[英]Returns the underlying "core-io" library through its ClusterFacade. Handle with care, with great power comes great responsibility. All additional checks which are normally performed by this library are skipped.
[中]通过其ClusterFacade返回底层“core io”库。小心处理,强大的力量带来巨大的责任。跳过通常由该库执行的所有附加检查。

代码示例

代码示例来源:origin: testcontainers/testcontainers-java

@Override
  protected void waitUntilReady() {
    log.info("Waiting for {} seconds for QUERY service", startupTimeout.getSeconds());

    // try to connect to the URL
    try {
      retryUntilSuccess((int) startupTimeout.getSeconds(), TimeUnit.SECONDS, () -> {
        getRateLimiter().doWhenReady(() -> {
          GetClusterConfigResponse clusterConfig = bucket.core()
            .<GetClusterConfigResponse>send(new GetClusterConfigRequest())
            .toBlocking().single();
          boolean queryServiceEnabled = clusterConfig.config()
            .bucketConfig(bucket.name())
            .serviceEnabled(ServiceType.QUERY);
          if (!queryServiceEnabled) {
            throw new ContainerLaunchException("Query service not ready yet");
          }
        });
        return true;
      });
    } catch (TimeoutException e) {
      throw new ContainerLaunchException("Timed out waiting for QUERY service");
    }
  }
}

代码示例来源:origin: couchbase/couchbase-elasticsearch-connector

public static CouchbaseBucketConfig getBucketConfig(Bucket bucket) {
 final GetClusterConfigResponse response = (GetClusterConfigResponse) bucket.core().send(
   new GetClusterConfigRequest()).toBlocking().single();
 return (CouchbaseBucketConfig) response.config().bucketConfig(bucket.name());
}

代码示例来源:origin: com.couchbase.client/java-client

private NodeLocatorHelper(final Bucket bucket) {
  configProvider = bucket
    .core()
    .<GetConfigProviderResponse>send(new GetConfigProviderRequest())
    .toBlocking()
    .single()
    .provider();
  bucketConfig = new AtomicReference<BucketConfig>(configProvider.config().bucketConfig(bucket.name()));
  configProvider
    .configs()
    .filter(new Func1<ClusterConfig, Boolean>() {
      @Override
      public Boolean call(ClusterConfig clusterConfig) {
        return clusterConfig.hasBucket(bucket.name());
      }
    }).subscribe(new Action1<ClusterConfig>() {
      @Override
      public void call(ClusterConfig config) {
        bucketConfig.set(config.bucketConfig(bucket.name()));
      }
    });
}

代码示例来源:origin: com.github.differentway/couchbase-testcontainer

@Override
  protected void waitUntilReady() {
    logger().info("Waiting for {} seconds for QUERY service", startupTimeout.getSeconds());

    // try to connect to the URL
    try {
      retryUntilSuccess((int) startupTimeout.getSeconds(), TimeUnit.SECONDS, () -> {
        getRateLimiter().doWhenReady(() -> {
          GetClusterConfigResponse clusterConfig = bucket.core()
              .<GetClusterConfigResponse>send(new GetClusterConfigRequest())
              .toBlocking().single();
          boolean queryServiceEnabled = clusterConfig.config()
              .bucketConfig(bucket.name())
              .serviceEnabled(ServiceType.QUERY);
          if (!queryServiceEnabled) {
            throw new RuntimeException("Query service not ready yet");
          }
        });
        return true;
      });
    } catch (TimeoutException e) {
      throw new ContainerLaunchException("Timed out waiting for QUERY service");
    }
  }
}

相关文章