BucketManager.info() java.util.concurrent.TimeoutException

This happens in version 2.2.0 of Java’s SDK.

If I do that:

Bucket bucket = cluster.openBucket(bucketName, bucketPassword);
BucketManager bucketManager = bucket.bucketManager();

and then try to insert a new DesignDocument with

bucketManager.insertDesignDocument(DesignDocument.create(“dev_beer”, Lists.newArrayList(createView())))

it all works just fine. On the other if instead of getting BucketManager from bucket instance I create one with:

final DefaultCouchbaseEnvironment couchbaseEnvironment =
DefaultCouchbaseEnvironment.create();

final DefaultBucketManager bucketManager = DefaultBucketManager
.create(couchbaseEnvironment, bucketName, bucketPassword, new CouchbaseCore(couchbaseEnvironment));

any call to inserDesignDocument(), info() or whatever else method will block forever.

log.debug(“bucket manager info {}”, rnsBucketManager.info(60L, TimeUnit.SECONDS));

working from the Bucket and getting the BucketManager from here is the official way to go.

Note:
Any reason you tried to instantiate it manually? It’s undocumented and at this point you usually work with interfaces rather than concrete classes.

I’m on my mobile so I can’t check properly, but I think maybe the creation of CouchbaseCore is the problem there… Anyway this create method is public so that other classes in other packages can use it, internally. It should probably be marked as internal, somehow (documentation, annotation).

Good to know. Thanks.
I did use it for no particularly good reason, just messing around with new API. Regarding interface one can obviously do:

CouchbaseEnvironment couchbaseEnvironment =
DefaultCouchbaseEnvironment.create();

BucketManager rnsBucketManager = DefaultBucketManager
.create(couchbaseEnvironment, bucketName, bucketPassword, new CouchbaseCore(couchbaseEnvironment));

but I don’t think that’s the case.

That’s a fair point regarding the interface.
However the CouchbaseCore is a special little beast. The bootstraping of the connection between it and the Couchbase cluster is done by sending a special command first. That is covered for you when you go through the Cluster interface.
That was what you missed, which is not unexpected since it’s not really intended for public consumption…

Great! I’ll keep that in mind and stay away from it. Thank you.