/** * Delete a value and Observe. * * @param key the key to set * @param req the Persistence to Master value * @param rep the Persistence to Replicas * @return whether or not the operation was performed */ public OperationFuture<Boolean> delete(String key, PersistTo req, ReplicateTo rep) { OperationFuture<Boolean> deleteOp = delete(key); try { deleteOp.get(); deleteOp.set(true, deleteOp.getStatus()); observePoll(key, 0L, req, rep); } catch (InterruptedException e) { deleteOp.set(false, deleteOp.getStatus()); } catch (ExecutionException e) { deleteOp.set(false, deleteOp.getStatus()); } catch (TimeoutException e) { deleteOp.set(false, deleteOp.getStatus()); } catch (IllegalArgumentException e) { deleteOp.set(false, deleteOp.getStatus()); } catch (RuntimeException e) { deleteOp.set(false, deleteOp.getStatus()); } return (deleteOp); }
/** * Set a value and Observe. * * @param key the key to set * @param exp the Expiry value * @param value the Key value * @param req the Persistence to Master value * @param rep the Persistence to Replicas * @return whether or not the operation was performed */ public OperationFuture<Boolean> set( String key, int exp, String value, PersistTo req, ReplicateTo rep) { OperationFuture<Boolean> setOp = set(key, exp, value); try { if (setOp.get()) { observePoll(key, setOp.getCas(), req, rep); } } catch (InterruptedException e) { setOp.set(false, setOp.getStatus()); } catch (ExecutionException e) { setOp.set(false, setOp.getStatus()); } catch (TimeoutException e) { setOp.set(false, setOp.getStatus()); } catch (IllegalArgumentException e) { setOp.set(false, setOp.getStatus()); } catch (RuntimeException e) { setOp.set(false, setOp.getStatus()); } return (setOp); }