Async for opening bucket

Opening bucket was blocking the application. any suggestions for opening bucket in async way

hi @Arihant,
If you want to switch the API to the async one, just create your Bucket (or even Cluster) as usual and call async() method on it. From there on, you have a AsyncBucket/AsyncCluster reference and all methods return Observable<?>.

So in your case, with the Cluster reference myCluster:

AsyncCluster myAsyncCluster = myCluster.async();
myAsyncCluster.openBucket("myBucket", "password")
  .subscribe(result -> doSomethingWithAsyncBucket(result))

Note that this way you get an AsyncBucket in the callback, that you need to work with by chaining RxJava operations. Thus you will have to be async all the way.

Usually we recommend the bucket reference to be stored somewhere and reused across the application (declaring as static variable for the sync one, singleton / DI singleton, resourcemanager or similar).

Thanks simon, i am using vertx to fetch the data from couchbase. As vertx is single threaded , the event loop is getting blocked due to delay in opening the bucket.

you can have look at the below warning. Not sure these warnings will go if i use async in opening bucket

Aug 19, 2015 10:21:00 AM com.couchbase.client.core.env.DefaultCoreEnvironment
INFO: ioPoolSize is less than 3 (2), setting to: 3
Aug 19, 2015 10:21:00 AM com.couchbase.client.core.env.DefaultCoreEnvironment
INFO: computationPoolSize is less than 3 (2), setting to: 3
Aug 19, 2015 10:21:00 AM com.couchbase.client.core.CouchbaseCore
INFO: CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile=‘null’, sslKeystorePassword=‘null’, queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=3, computationPoolSize=3, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.1.4 (git: 2.1.4), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS; lower=10, upper=100000}, keepAliveInterval=30000, autoreleaseAfter=2000, bufferPoolingEnabled=true, queryTimeout=75000, viewTimeout=75000, kvTimeout=2500, connectTimeout=5000, disconnectTimeout=25000, dnsSrvEnabled=false}
Aug 19, 2015 10:21:02 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-eventloop-thread-2,5,main] has been blocked for 2002 ms, time limit is 2000
Aug 19, 2015 10:21:02 AM com.couchbase.client.core.node.CouchbaseNode$1 call
INFO: Connected to Node localhost
Aug 19, 2015 10:21:03 AM io.vertx.core.impl.BlockedThreadChecker
WARNING: Thread Thread[vert.x-eventloop-thread-2,5,main] has been blocked for 3002 ms, time limit is 2000
Aug 19, 2015 10:21:03 AM com.couchbase.client.core.config.DefaultConfigurationProvider$6 call
INFO: Opened bucket custorder6_dev