org.gcube.common.core.state
Class GCUBEReadWriteLock.GCUBEReadLock

java.lang.Object
  extended by java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
      extended by org.gcube.common.core.state.GCUBEReadWriteLock.GCUBEReadLock
All Implemented Interfaces:
Serializable, Lock
Enclosing class:
GCUBEReadWriteLock

public static class GCUBEReadWriteLock.GCUBEReadLock
extends ReentrantReadWriteLock.ReadLock

An extension of ReentrantReadWriteLock.WriteLock that supports preemptive requests and acquisitions.

Author:
Fabio Simeoni (University of Strathclyde)
See Also:
Serialized Form

Method Summary
 void lock()
          Deprecated. use lockInterruptibly() instead.
 void lockInterruptibly()
          
 boolean tryLock()
          Extends the semantics of Lock.tryLock() to cater for lock preemption.
 
Methods inherited from class java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock
newCondition, toString, tryLock, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

lock

public void lock()
          throws org.gcube.common.core.state.GCUBEReadWriteLock.LockPreemptedException
Deprecated. use lockInterruptibly() instead.

Forces interruptibility on the standard semantics of Lock.lock() to cater for lock preemption.

Specified by:
lock in interface Lock
Overrides:
lock in class ReentrantReadWriteLock.ReadLock
Throws:
LockPreemptedException - if the lock is preempted.
org.gcube.common.core.state.GCUBEReadWriteLock.LockPreemptedException

tryLock

public boolean tryLock()
Extends the semantics of Lock.tryLock() to cater for lock preemption.

Specified by:
tryLock in interface Lock
Overrides:
tryLock in class ReentrantReadWriteLock.ReadLock
Returns:
false if the lock is already held by another thread or has been preempted.

lockInterruptibly

public void lockInterruptibly()
                       throws InterruptedException

Specified by:
lockInterruptibly in interface Lock
Overrides:
lockInterruptibly in class ReentrantReadWriteLock.ReadLock
Throws:
InterruptedException


Copyright © 2013. All Rights Reserved.