ReliableHashMap<K,V>.replaceAsync 方法
定义
重载
replaceAsync(Transaction txn, K key, V value) |
Replaces the entry for a key only if currently mapped to some value.
|
replaceAsync(Transaction txn, K key, V value, Duration timeout, CancellationToken cancellationToken) |
Replaces the entry for a key only if currently mapped to some value.
|
replaceAsync(Transaction txn, K key, V value)
Replaces the entry for a key only if currently mapped to some value.
public CompletableFuture<Boolean> replaceAsync(Transaction txn, K key, V value)
参数
- txn
- Transaction
The transaction id associated with this operation.
- key
- K
key with which the specified value is associated
- value
- V
value to be associated with the specified key
返回
CompletableFuture with result true if the key is found and replace succeeds, false otherwise. The future completes exceptionally with IOException for serialization failures, FabricException for fabric related failures.
例外
if key, value or txn is null.
replaceAsync(Transaction txn, K key, V value, Duration timeout, CancellationToken cancellationToken)
Replaces the entry for a key only if currently mapped to some value.
public CompletableFuture<Boolean> replaceAsync(Transaction txn, K key, V value, Duration timeout, CancellationToken cancellationToken)
参数
- txn
- Transaction
The transaction id associated with this operation.
- key
- K
key with which the specified value is associated
- value
- V
value to be associated with the specified key
- timeout
- Duration
the timeout for the operation to complete. Default timeout(4 seconds) will be used if null is passed.
- cancellationToken
- CancellationToken
CancellationToken object to indicate the cancellation status of the operation.
返回
CompletableFuture with result true if the key is found and replace succeeds, false otherwise. The future completes exceptionally with IOException for serialization failures, FabricException for fabric related failures.
例外
if key, value or txn is null.