public class ReentrantLockHelper extends Object
| Modifier and Type | Class and Description | 
|---|---|
static interface  | 
ReentrantLockHelper.ValueGetter<V>  | 
| Modifier and Type | Field and Description | 
|---|---|
static ReentrantLockHelper | 
DEFAULT  | 
| Constructor and Description | 
|---|
ReentrantLockHelper()  | 
| Modifier and Type | Method and Description | 
|---|---|
ReentrantLock | 
getLocker(String lockKey)  | 
static <K,V> V | 
putIfAbsent(Map<K,V> target,
           K key,
           V value)  | 
static <K,V> V | 
putIfAbsentAsync(Map<K,V> target,
                K key,
                ReentrantLockHelper.ValueGetter<V> valueGetter)  | 
static void | 
unlock(ReentrantLock lock)  | 
public static final ReentrantLockHelper DEFAULT
public static <K,V> V putIfAbsent(Map<K,V> target, K key, V value)
public static <K,V> V putIfAbsentAsync(Map<K,V> target, K key, ReentrantLockHelper.ValueGetter<V> valueGetter) throws Exception
K - 键名类型V - 键值类型target - 目标映射key - 键名valueGetter - 键值回调接口Exception - 可能产生的任何异常public ReentrantLock getLocker(String lockKey) throws Exception
Exceptionpublic static void unlock(ReentrantLock lock)
Copyright © 2022. All rights reserved.