.builder() .queryEndpoints(queryEndpoints) .callbacksOnIoPool(true)
/** * Override this method if you want a customized {@link CouchbaseEnvironment}. * This environment will be managed by Spring, which will call its shutdown() * method upon bean destruction, unless you override {@link #isEnvironmentManagedBySpring()} * as well to return false. * * @return a customized environment, defaults to a {@link DefaultCouchbaseEnvironment}. */ protected CouchbaseEnvironment getEnvironment() { return DefaultCouchbaseEnvironment.create(); }
managementTimeout = longPropertyOr("managementTimeout", builder.managementTimeout); queryTimeout = longPropertyOr("queryTimeout", builder.queryTimeout); viewTimeout = longPropertyOr("viewTimeout", builder.viewTimeout); kvTimeout = longPropertyOr("kvTimeout", builder.kvTimeout); searchTimeout = longPropertyOr("searchTimeout", builder.searchTimeout); analyticsTimeout = longPropertyOr("analyticsTimeout", builder.analyticsTimeout); connectTimeout = longPropertyOr("connectTimeout", builder.connectTimeout); dnsSrvEnabled = booleanPropertyOr("dnsSrvEnabled", builder.dnsSrvEnabled); propagateParentSpan = booleanPropertyOr("propagateParentSpan", builder.propagateParentSpan); cryptoManager = builder.cryptoManager; if (queryTimeout > maxRequestLifetime()) { LOGGER.warn("The configured query timeout is greater than the maximum request lifetime. " + "This can lead to falsely cancelled requests."); if (kvTimeout > maxRequestLifetime()) { LOGGER.warn("The configured key/value timeout is greater than the maximum request lifetime." + "This can lead to falsely cancelled requests."); if (viewTimeout > maxRequestLifetime()) { LOGGER.warn("The configured view timeout is greater than the maximum request lifetime." + "This can lead to falsely cancelled requests."); if (analyticsTimeout > maxRequestLifetime()) { LOGGER.warn("The configured analytics timeout is greater than the maximum request lifetime." + "This can lead to falsely cancelled requests."); if (searchTimeout > maxRequestLifetime()) { LOGGER.warn("The configured search timeout is greater than the maximum request lifetime." +
@Override public DefaultCouchbaseEnvironment build() { return new DefaultCouchbaseEnvironment(this); } }
/** * Override this method if you want a customized {@link CouchbaseEnvironment}. * This environment will be managed by Spring, which will call its shutdown() * method upon bean destruction, unless you override {@link #isEnvironmentManagedBySpring()} * as well to return false. * * @return a customized environment, defaults to a {@link DefaultCouchbaseEnvironment}. */ protected CouchbaseEnvironment getEnvironment() { return DefaultCouchbaseEnvironment.create(); }
private DefaultCouchbaseEnvironment createCouchbaseEnvironment() { initCluster(); return DefaultCouchbaseEnvironment.builder() .kvTimeout(10000) .bootstrapCarrierDirectPort(getMappedPort(MEMCACHED)) .bootstrapCarrierSslPort(getMappedPort(MEMCACHED_SSL)) .bootstrapHttpDirectPort(getMappedPort(REST)) .bootstrapHttpSslPort(getMappedPort(REST_SSL)) .build(); }
/** * Override this method if you want a customized {@link CouchbaseEnvironment}. * This environment will be managed by Spring, which will call its shutdown() * method upon bean destruction, unless you override {@link #isEnvironmentManagedBySpring()} * as well to return false. * * @return a customized environment, defaults to a {@link DefaultCouchbaseEnvironment}. */ protected CouchbaseEnvironment getEnvironment() { return DefaultCouchbaseEnvironment.create(); }
.builder() .sslEnabled(sslEnabled) .sslKeystoreFile(sslKeystoreFile)
/** * Override this method if you want a customized {@link CouchbaseEnvironment}. * This environment will be managed by Spring, which will call its shutdown() * method upon bean destruction, unless you override {@link #isEnvironmentManagedBySpring()} * as well to return false. * * @return a customized environment, defaults to a {@link DefaultCouchbaseEnvironment}. */ protected CouchbaseEnvironment getEnvironment() { return DefaultCouchbaseEnvironment.create(); }
CouchbaseEnvironment cbEnv = DefaultCouchbaseEnvironment.builder().bootstrapHttpEnabled(true) .bootstrapHttpDirectPort(port) .bootstrapCarrierDirectPort(serverPort)
/** * Creates a new {@link CouchbaseCluster} reference using the connection string. * * The {@link CouchbaseEnvironment} will be automatically created and its lifecycle managed. * * @param connectionString the connection string to identify the remote cluster. * @return a new {@link CouchbaseCluster} reference. */ public static CouchbaseCluster fromConnectionString(final String connectionString) { return new CouchbaseCluster( DefaultCouchbaseEnvironment.create(), ConnectionString.create(connectionString), false ); }
@BeforeSuite public void startServers() { _couchbaseTestServer = new CouchbaseTestServer(TestUtils.findFreePort()); _couchbaseTestServer.start(); _couchbaseEnvironment = DefaultCouchbaseEnvironment.builder().bootstrapHttpEnabled(true) .bootstrapHttpDirectPort(_couchbaseTestServer.getPort()) .bootstrapCarrierDirectPort(_couchbaseTestServer.getServerPort()).bootstrapCarrierEnabled(false) .kvTimeout(10000).build(); }
/** * Creates a new {@link CouchbaseAsyncCluster} reference using the connection string. * * The {@link CouchbaseEnvironment} will be automatically created and its lifecycle managed. * * @param connectionString the connection string to identify the remote cluster. * @return a new {@link CouchbaseAsyncCluster} reference. */ public static CouchbaseAsyncCluster fromConnectionString(final String connectionString) { return new CouchbaseAsyncCluster( DefaultCouchbaseEnvironment.create(), ConnectionString.create(connectionString), false ); }
private static DefaultCouchbaseEnvironment getEnv(String hostOrKey) { URI singleHostURI = checkAndGetURI(hostOrKey); DefaultCouchbaseEnvironment.Builder builder = DefaultCouchbaseEnvironment.builder(); builder.connectTimeout(Long.parseLong(getConfig("connectTimeout"))); builder.socketConnectTimeout(Integer.parseInt(getConfig("socketConnectTimeout"))); builder.kvTimeout(Integer.parseInt(getConfig("kvTimeout"))); builder.ioPoolSize(Integer.parseInt(getConfig("ioPoolSize"))); builder.computationPoolSize(Integer.parseInt(getConfig("computationPoolSize"))); if (singleHostURI == null || singleHostURI.getScheme() == null) { Map<String, Object> couchbaseConfig = getKeyMap(hostOrKey); Object port; if ((port = couchbaseConfig.get(PORT_CONFIG_KEY)) != null) { builder.bootstrapHttpDirectPort(Integer.parseInt(port.toString())); } } else { if (singleHostURI.getPort() != -1) { builder.bootstrapHttpDirectPort(singleHostURI.getPort()); } } return builder.build(); }
/** * Creates a new {@link CouchbaseCluster} reference against the nodes passed in. * * The {@link CouchbaseEnvironment} will be automatically created and its lifecycle managed. * * @param nodes the list of nodes to use when connecting to the cluster reference. * @return a new {@link CouchbaseCluster} reference. */ public static CouchbaseCluster create(final List<String> nodes) { return new CouchbaseCluster( DefaultCouchbaseEnvironment.create(), ConnectionString.fromHostnames(nodes), false ); }
@Before public void before() { ENV = DefaultCouchbaseEnvironment.builder().bootstrapHttpDirectPort(couchbase.getMappedPort(8091)).build(); }
/** * Creates a new {@link CouchbaseAsyncCluster} reference against the nodes passed in. * * The {@link CouchbaseEnvironment} will be automatically created and its lifecycle managed. * * @param nodes the list of nodes to use when connecting to the cluster reference. * @return a new {@link CouchbaseAsyncCluster} reference. */ public static CouchbaseAsyncCluster create(final List<String> nodes) { return new CouchbaseAsyncCluster( DefaultCouchbaseEnvironment.create(), ConnectionString.fromHostnames(nodes), false ); }
/** * Creates a {@link CouchbaseEnvironment} with default settings applied. * * @return a {@link DefaultCouchbaseEnvironment} with default settings. */ public static DefaultCouchbaseEnvironment create() { return builder().build(); }
@Bean(destroyMethod = "disconnect") @ConditionalOnProperty("store.enable") public Cluster couchbaseCluster( @Value("#{'${store.nodes:127.0.0.1}'.split(',')}") String... nodes) { CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder() .queryEnabled(useCouchbaseForFindAll) .build(); return CouchbaseCluster.create(env, nodes); }
public static DefaultCouchbaseEnvironment.Builder environmentBuilder(CouchbaseConfig config, Supplier<KeyStore> keystore) { final DefaultCouchbaseEnvironment.Builder envBuilder = DefaultCouchbaseEnvironment.builder(); if (config.secureConnection()) { envBuilder .sslEnabled(true) .sslTruststore(keystore.get()); } // Dirty kludge to allow non-standard bootstrap port for containerized Couchbase final ConnectionString c = ConnectionString.fromHostnames(config.hosts()); for (InetSocketAddress host : c.hosts()) { final int port = host.getPort(); if (port != 0) { LOGGER.debug("Using bootstrap port {}", port); envBuilder.bootstrapHttpDirectPort(port); break; } } return envBuilder; }