}
return shutdownResult;
}
private void checkObserveReplica(String key, int numPersist, int numReplica) {
Config cfg = ((CouchbaseConnectionFactory) connFactory).getVBucketConfig();
VBucketNodeLocator locator = (VBucketNodeLocator) mconn.getLocator();
if(numReplica > 0) {
int vBucketIndex = locator.getVBucketIndex(key);
int currentReplicaNum = cfg.getReplica(vBucketIndex, numReplica-1);
if (currentReplicaNum < 0) {
throw new ObservedException("Currently, there is no replica node "
+ "available for the given replication index (" + numReplica + ").");
}
}
int replicaCount = Math.min(locator.getAll().size() - 1, cfg.getReplicasCount());
if (numReplica > replicaCount) {
throw new ObservedException("Requested replication to " + numReplica
+ " node(s), but only " + replicaCount + " are available.");
} else if (numPersist > replicaCount + 1) {
throw new ObservedException("Requested persistence to " + (numPersist + 1)