ReliableHashMap<K,V>.getAsync 方法

定义

重载

getAsync(Transaction txn, K key)

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

getAsync(Transaction txn, K key, Duration timeout, CancellationToken cancellationToken)

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

getAsync(Transaction txn, K key)

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

public CompletableFuture<V> getAsync(Transaction txn, K key)

参数

txn
Transaction

The transaction id associated with this operation.

key
K

the key whose associated value is to be returned

返回

CompletableFuture<V>

CompletableFuture with value to which the specified key is mapped, null if no such mapping exists. The future completes exceptionally with IOException or ClassNotFoundException for deserialization failures, FabricException for fabric related failures.

例外

IllegalArgumentException

if key or txn is null.

getAsync(Transaction txn, K key, Duration timeout, CancellationToken cancellationToken)

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

public CompletableFuture<V> getAsync(Transaction txn, K key, Duration timeout, CancellationToken cancellationToken)

参数

txn
Transaction

The transaction id associated with this operation.

key
K

the key whose associated value is to be returned

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<V>

CompletableFuture with value to which the specified key is mapped, null if no such mapping exists. The future completes exceptionally with IOException or ClassNotFoundException for deserialization failures, FabricException for fabric related failures.

例外

IllegalArgumentException

if key or txn is null.

适用于