sventon subversion web client - http://www.sventon.org
[show recent changes]
 
  Help
HEAD
Rev: 52703 - http://anonsvn.icesoft.org/repo / iceutil / trunk / iceutil / util / src / main / java / org / icesoft / util / concurrent / ReentrantLockUtilities.java
Show File - ReentrantLockUtilities.java  [show properties]
spinner
package org.icesoft.util.concurrent;
import static org.icesoft.util.CollectionUtilities.isNotNullAndIsNotEmpty;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
10 
11  public class ReentrantLockUtilities {
12      private static final Logger LOGGER = Logger.getLogger(ReentrantLockUtilities.class.getName());
13 
14      public static Set<? extends ReentrantLock> retainLocksHeldByCurrentThread(
15          final Set<? extends ReentrantLock> lockSet) {
16 
17          if (isNotNullAndIsNotEmpty(lockSet)) {
18              Iterator<? extends ReentrantLock> _lockIterator = lockSet.iterator();
19              while (_lockIterator.hasNext()) {
20                  if (!_lockIterator.next().isHeldByCurrentThread()) {
21                      _lockIterator.remove();
22                  }
23              }
24          }
25          return lockSet;
26      }
27  }


feed icon

sventon 2.5.1