@Override protected Cancellable updateCAS( final String storageKey, final CASValue<Object> casValue, final byte[] storageObject, final FutureCallback<Boolean> callback) { return operation(client.asyncCAS(storageKey, casValue.getCas(), storageObject), new FutureCallback<CASResponse>() { @Override public void completed(final CASResponse result) { callback.completed(result == CASResponse.OK); } @Override public void failed(final Exception ex) { callback.failed(ex); } @Override public void cancelled() { callback.cancelled(); } }); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ public Future<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public Future<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public <T> Future<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Asynchronous CAS operation using the default transcoder. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
/** * Asynchronous CAS operation using the default transcoder with expiration. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, Object value) { return asyncCAS(key, casId, exp, value, transcoder); }
/** * Asynchronous CAS operation. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public <T> Future<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Asynchronous CAS operation using the default transcoder with expiration. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, Object value) { return asyncCAS(key, casId, exp, value, transcoder); }
/** * Asynchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Asynchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ @Override public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Asynchronous CAS operation using the default transcoder with expiration. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ public Future<CASResponse> asyncCAS(String key, long casId, int exp, Object value) { return asyncCAS(key, casId, exp, value, transcoder); }
/** * Asynchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ public <T> Future<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Asynchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a future that will indicate the status of the CAS * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public <T> Future<CASResponse> asyncCAS(String key, long casId, T value, Transcoder<T> tc) { return asyncCAS(key, casId, 0, value, tc); }
/** * Perform a synchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a CASResponse * @throws OperationTimeoutException if global operation timeout is * exceeded * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public <T> CASResponse cas(String key, long casId, int exp, T value, Transcoder<T> tc) { try { return asyncCAS(key, casId, exp, value, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { throw new RuntimeException("Exception waiting for value", e); } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } }
/** * Perform a synchronous CAS operation. * * @param <T> * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a CASResponse * @throws OperationTimeoutException if global operation timeout is exceeded * @throws IllegalStateException in the rare circumstance where queue is too * full to accept any more requests */ public <T> CASResponse cas(String key, long casId, int exp, T value, Transcoder<T> tc) { try { return asyncCAS(key, casId, exp, value, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { throw new RuntimeException("Exception waiting for value", e); } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } }
/** * Perform a synchronous CAS operation. * * @param key the key * @param casId the CAS identifier (from a gets operation) * @param exp the expiration of this object * @param value the new value * @param tc the transcoder to serialize and unserialize the value * @return a CASResponse * @throws OperationTimeoutException if global operation timeout is * exceeded * @throws IllegalStateException in the rare circumstance where queue * is too full to accept any more requests */ public <T> CASResponse cas(String key, long casId, int exp, T value, Transcoder<T> tc) { try { return asyncCAS(key, casId, exp, value, tc).get(operationTimeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for value", e); } catch (ExecutionException e) { throw new RuntimeException("Exception waiting for value", e); } catch (TimeoutException e) { throw new OperationTimeoutException("Timeout waiting for value", e); } }
@Override protected Cancellable updateCAS( final String storageKey, final CASValue<Object> casValue, final byte[] storageObject, final FutureCallback<Boolean> callback) { return operation(client.asyncCAS(storageKey, casValue.getCas(), storageObject), new FutureCallback<CASResponse>() { @Override public void completed(final CASResponse result) { callback.completed(result == CASResponse.OK); } @Override public void failed(final Exception ex) { callback.failed(ex); } @Override public void cancelled() { callback.cancelled(); } }); }