org.infinispan.util.concurrent.locks.containers
Class OwnableReentrantPerEntryLockContainer

java.lang.Object
  extended by org.infinispan.util.concurrent.locks.containers.AbstractLockContainer<L>
      extended by org.infinispan.util.concurrent.locks.containers.AbstractPerEntryLockContainer<OwnableReentrantLock>
          extended by org.infinispan.util.concurrent.locks.containers.OwnableReentrantPerEntryLockContainer
All Implemented Interfaces:
LockContainer<OwnableReentrantLock>

public class OwnableReentrantPerEntryLockContainer
extends AbstractPerEntryLockContainer<OwnableReentrantLock>

A per-entry lock container for OwnableReentrantLocks

Since:
4.0
Author:
Manik Surtani

Field Summary
 
Fields inherited from class org.infinispan.util.concurrent.locks.containers.AbstractPerEntryLockContainer
locks
 
Constructor Summary
OwnableReentrantPerEntryLockContainer(int concurrencyLevel)
           
 
Method Summary
 boolean isLocked(Object key)
           
protected  OwnableReentrantLock newLock()
           
 boolean ownsLock(Object key, Object owner)
          Tests if a give owner owns a lock on a specified object.
protected  boolean tryLock(OwnableReentrantLock lock, long timeout, TimeUnit unit, Object lockOwner)
           
protected  void unlock(OwnableReentrantLock l, Object owner)
           
 
Methods inherited from class org.infinispan.util.concurrent.locks.containers.AbstractPerEntryLockContainer
acquireLock, getLock, getLockId, getNumLocksHeld, releaseLock, size
 
Methods inherited from class org.infinispan.util.concurrent.locks.containers.AbstractLockContainer
safeRelease
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwnableReentrantPerEntryLockContainer

public OwnableReentrantPerEntryLockContainer(int concurrencyLevel)
Method Detail

newLock

protected OwnableReentrantLock newLock()
Specified by:
newLock in class AbstractPerEntryLockContainer<OwnableReentrantLock>

ownsLock

public boolean ownsLock(Object key,
                        Object owner)
Description copied from interface: LockContainer
Tests if a give owner owns a lock on a specified object.

Parameters:
key - object to check
owner - owner to test
Returns:
true if owner owns lock, false otherwise

isLocked

public boolean isLocked(Object key)
Parameters:
key - object
Returns:
true if an object is locked, false otherwise

tryLock

protected boolean tryLock(OwnableReentrantLock lock,
                          long timeout,
                          TimeUnit unit,
                          Object lockOwner)
                   throws InterruptedException
Specified by:
tryLock in class AbstractLockContainer<OwnableReentrantLock>
Throws:
InterruptedException

unlock

protected void unlock(OwnableReentrantLock l,
                      Object owner)
Specified by:
unlock in class AbstractLockContainer<OwnableReentrantLock>

-->

Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.