@Override public Bucket openBucket(final String name, final String password, final List<Transcoder<? extends Document, ?>> transcoders, long timeout, TimeUnit timeUnit) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Bucket name is not allowed to be null or empty."); } Bucket cachedBucket = getCachedBucket(name); if (cachedBucket != null) { return cachedBucket; } return Blocking.blockForSingle(couchbaseAsyncCluster .openBucket(name, password, transcoders) .map(new Func1<AsyncBucket, Bucket>() { @Override public Bucket call(AsyncBucket asyncBucket) { CouchbaseBucket bucket = new CouchbaseBucket(asyncBucket, environment, core(), name, name, password); bucketCache.put(name, bucket); return bucket; } }).single(), timeout, timeUnit); }
Bucket cachedBucket = getCachedBucket(name); if (cachedBucket != null) { return cachedBucket;