@InterfaceAudience.Private public class KeyLocker<K> extends Object
class Example { private final static KeyLocker<String> locker = new Locker<String>(); public void foo(String s){ Lock lock = locker.acquireLock(s); try { // whatever }finally{ lock.unlock(); } } }
构造器和说明 |
---|
KeyLocker() |
public ReentrantLock acquireLock(K key)
key
- Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.