Dear All,
I’m currently exploring document locking using “getAndLock(“Key”, timeOut)” method, but unfortunately i’m not able to lock the document. Below is the piece of the code i have written:
=================================================================
List uris = new LinkedList();
uris.add(URI.create(CouchbaseURL));
CouchbaseClient client = null;
try {
client = new CouchbaseClient(uris,BucketName, “”);
} catch (IOException e) {
System.err.println("IOException connecting to Couchbase: " + e.getMessage());
System.exit(1);
}
Record = client.getAndLock(Key,30).toString();
Record1 = client.get(Key).toString();
client.shutdown();
In ideal case the statement “Record1 = client.get(Key).toString();” should not return the document. But in my case it is returning the document associated with the “key”. Event i’m able to execute the “client.set()” on the same key without getting any error (before releasing the lock and before 30 seconds). I’m not sure where exactly i’m going wrong, Kindly assist me to achieve locking on documents.
Thanks,
Siva