protected <T> ICompletableFuture<T> replaceAsyncInternal(K key, V oldValue, V newValue, ExpiryPolicy expiryPolicy, boolean hasOldValue, boolean withCompletionEvent, boolean async) { long startNanos = nowInNanosOrDefault(); ensureOpen(); if (hasOldValue) { validateNotNull(key, oldValue, newValue); validateConfiguredTypes(cacheConfig, key, oldValue, newValue); } else { validateNotNull(key, newValue); validateConfiguredTypes(cacheConfig, key, newValue); } Data keyData = toData(key); Data oldValueData = toData(oldValue); Data newValueData = toData(newValue); Data expiryPolicyData = toData(expiryPolicy); int completionId = withCompletionEvent ? nextCompletionId() : -1; ClientMessage request = CacheReplaceCodec.encodeRequest(nameWithPrefix, keyData, oldValueData, newValueData, expiryPolicyData, completionId); ClientInvocationFuture future = invoke(request, keyData, completionId); ClientDelegatingFuture<T> delegatingFuture = newDelegatingFuture(future, REPLACE_RESPONSE_DECODER); ExecutionCallback<T> callback = async && statisticsEnabled ? statsHandler.<T>newOnReplaceCallback(startNanos) : null; onReplaceInternalAsync(key, newValue, keyData, newValueData, delegatingFuture, callback); return delegatingFuture; }
protected <T> ICompletableFuture<T> replaceAsyncInternal(K key, V oldValue, V newValue, ExpiryPolicy expiryPolicy, boolean hasOldValue, boolean withCompletionEvent, boolean async) { long startNanos = nowInNanosOrDefault(); ensureOpen(); if (hasOldValue) { validateNotNull(key, oldValue, newValue); validateConfiguredTypes(cacheConfig, key, oldValue, newValue); } else { validateNotNull(key, newValue); validateConfiguredTypes(cacheConfig, key, newValue); } Data keyData = toData(key); Data oldValueData = toData(oldValue); Data newValueData = toData(newValue); Data expiryPolicyData = toData(expiryPolicy); int completionId = withCompletionEvent ? nextCompletionId() : -1; ClientMessage request = CacheReplaceCodec.encodeRequest(nameWithPrefix, keyData, oldValueData, newValueData, expiryPolicyData, completionId); ClientInvocationFuture future = invoke(request, keyData, completionId); ClientDelegatingFuture<T> delegatingFuture = newDelegatingFuture(future, REPLACE_RESPONSE_DECODER); ExecutionCallback<T> callback = async && statisticsEnabled ? statsHandler.<T>newOnReplaceCallback(startNanos) : null; onReplaceInternalAsync(key, newValue, keyData, newValueData, delegatingFuture, callback); return delegatingFuture; }