What does openBucket parameter timeout means, how to change it


Hello, everyone.
I’m using couchbase java sdk 2.3.2 and meeting with a problem.
My code is like this:

List<Transcoder<? extends Document,?>> transcoders = new ArrayList<Transcoder<? extends Document, ?>>();
transcoders.add(new RawTranscoder());

//customize the connection to the Cluster

cluster = CouchbaseCluster.create(StringUtils.join(ipList.toArray(), ','));
bucket = cluster.openBucket(dbName,dbPasswd,transcoders,60,TimeUnit.SECONDS);

There’s a parameter timeout in openBucket. I know there’s a class named CouchbaseEnvironment or DefaultCouchbaseEnvironment, which contains several kinds of timeouts.

I’m wondering whether there’s relation between openBucket’s timeout and DefaultCouchbaseEnvironment timeouts. Now I want to customize openBucket’s timeout after giving a default value , how should I do it ?

Thank you.


Now I’ve known it. It’s just DefaultCouchbaseEnvironment’s connectiontimeout


@baiwfg2 exactly. The default timeouts are set on the DefaultCouchbaseEnvironment and when you add one to the method you call you explicitly override that timeout setting for the one call.


On a side note: these default timeouts only apply to the synchronous, blocking API.

If you use the asynchronous API (eg. bucket.async()), then you need to define all your timeouts explicitly
That is done by chaining the rx operator timeout(duration, unit).