本文整理汇总了Java中com.couchbase.client.java.Bucket.close方法的典型用法代码示例。如果您正苦于以下问题:Java Bucket.close方法的具体用法?Java Bucket.close怎么用?Java Bucket.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.couchbase.client.java.Bucket
的用法示例。
在下文中一共展示了Bucket.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beerBucketTest
import com.couchbase.client.java.Bucket; //导入方法依赖的package包/类
@Test
public void beerBucketTest() throws InterruptedException {
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.bootstrapCarrierDirectPort(couchbase.getMappedPort(11210))
.bootstrapCarrierSslPort(couchbase.getMappedPort(11207))
.bootstrapHttpDirectPort(couchbase.getMappedPort(8091))
.bootstrapHttpSslPort(couchbase.getMappedPort(18091))
.build();
CouchbaseCluster cc = CouchbaseCluster.create(env);
ClusterManager cm = cc.clusterManager("Administrator", "password");
assertTrue(cm.hasBucket("beer-sample"));
Bucket bucket = cc.openBucket("beer-sample");
assertTrue(bucket.exists("21st_amendment_brewery_cafe"));
bucket.close();
}
示例2: connect
import com.couchbase.client.java.Bucket; //导入方法依赖的package包/类
@Override
public void connect(ServerConfiguration serverConfiguration) {
CouchbaseCluster cluster = CouchbaseCluster.create(serverConfiguration.getServerUrl());
String userDatabase = serverConfiguration.getUserDatabase();
Bucket bucket = null;
try {
if (StringUtils.isEmpty(userDatabase)) {
bucket = cluster.openBucket();
} else {
bucket = cluster.openBucket(userDatabase);
}
} catch (Exception ex) {
throw new ConfigurationException(ex);
} finally {
if (bucket != null) {
bucket.close();
}
cluster.disconnect();
}
}
示例3: populateBucket
import com.couchbase.client.java.Bucket; //导入方法依赖的package包/类
private void populateBucket() {
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.socketConnectTimeout(60000)
.connectTimeout(60000)
.keepAliveInterval(60000)
.build();
CouchbaseCluster cluster = CouchbaseCluster.create(env, bootstrapNodes);
Bucket bucket = cluster.openBucket(bucketName, password);
assertTrue(bucket.bucketManager().flush());
JsonDocument document = JsonDocument.create("foo", JsonObject.create().put("bar", 42));
bucket.upsert(document, PersistTo.MASTER);
bucket.close();
cluster.disconnect();
}
示例4: testConnection
import com.couchbase.client.java.Bucket; //导入方法依赖的package包/类
private static void testConnection(Cluster cluster) {
Bucket bucket = cluster.openBucket(2, TimeUnit.SECONDS);
bucket.close();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:CouchbaseTestServer.java