HI Couchbase Team,
I am migrating the couchbase jdk code from 1.4.4 to 2.5.
1.4.4 bucket insert method looks like:
public void setRIObject(String key,String data){
OperationFuture ri = client.set(key, expiry,data);
try{
ri.get();
}catch(Exception ex){
int retry = 1;
int cbRetryLimit= 5;
while(retry < cbRetryLimit){
try{
Thread.currentThread().sleep(1000);
logger.error("Retrying [{}] inserting for id [{}] ",retry,key);
OperationFuture ric = setObject(cbClient.getRIClient(), key, data);
ric.get();
break;
}catch(Exception e){
if(retry == cbRetryLimit){
logger.error(“Failed after the maximum retry [{}] with Exception [{}]”,retry,ExceptionUtils.getFullStackTrace(e));
}
retry++;
}
}
}
}
Kindly let me know in 2.5 version, how can i get the OperationFuture out of the bucket insert method and also how can i apply the retry logic in case of exception