类 SingleFlight<K,V>
java.lang.Object
cn.kingyen.singleflight.core.SingleFlight<K,V>
- 类型参数:
K- key typeV- value type
SingleFlight is a utility class for access suppression。
- 作者:
- KingYen.
-
嵌套类概要
嵌套类 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Perform an operation, and if an operation with the same key is in progress, wait for it to complete and return the resultdoOnceFuture(K key, Supplier<V> fn) Execute an operation asynchronously, and if an operation with the same key is in progress, wait for it to complete and return the resultbooleanForcibly delete a key and cancel all waiting operationsintGets the number of operations currently in progress
-
字段详细资料
-
inFlight
-
-
构造器详细资料
-
SingleFlight
public SingleFlight()
-
-
方法详细资料
-
doOnce
Perform an operation, and if an operation with the same key is in progress, wait for it to complete and return the result- 参数:
key- operating keyfn- the actual operation performed- 返回:
- result of operation
- 抛出:
RuntimeException- the exception occurs during operation execution
-
doOnceFuture
Execute an operation asynchronously, and if an operation with the same key is in progress, wait for it to complete and return the result- 参数:
key- operating keyfn- the actual operation performed- 返回:
- CompletableFuture containing the result of the operation
-
forget
Forcibly delete a key and cancel all waiting operations- 参数:
key- the key to delete- 返回:
- Return true if key exists and is deleted, false otherwise
-
pendingCount
public int pendingCount()Gets the number of operations currently in progress- 返回:
- number of ongoing operations
-