org.apache.manifoldcf.core.lockmanager
Class LockObject

java.lang.Object
  extended by org.apache.manifoldcf.core.lockmanager.LockObject

public class LockObject
extends java.lang.Object

One instance of this object exists for each lock on each JVM!


Field Summary
static java.lang.String _rcsid
           
 
Constructor Summary
LockObject(LockPool lockPool, java.lang.Object lockKey, java.io.File synchDir)
           
 
Method Summary
 void enterNonExWriteLock()
           
 void enterNonExWriteLockNoWait()
          Note well: Upgrading a read lock to a non-ex write lock is tricky.
 void enterReadLock()
           
 void enterReadLockNoWait()
           
 void enterWriteLock()
          This method WILL NOT BE CALLED UNLESS we are actually committing a write lock for the first time for a given thread.
 void enterWriteLockNoWait()
          Note well: Upgrading a read lock to a non-ex write lock is tricky.
 void leaveNonExWriteLock()
           
 void leaveReadLock()
           
 void leaveWriteLock()
           
 void makeInvalid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_rcsid

public static final java.lang.String _rcsid
See Also:
Constant Field Values
Constructor Detail

LockObject

public LockObject(LockPool lockPool,
                  java.lang.Object lockKey,
                  java.io.File synchDir)
Method Detail

makeInvalid

public void makeInvalid()

enterWriteLock

public void enterWriteLock()
                    throws java.lang.InterruptedException,
                           ExpiredObjectException
This method WILL NOT BE CALLED UNLESS we are actually committing a write lock for the first time for a given thread.

Throws:
java.lang.InterruptedException
ExpiredObjectException

enterWriteLockNoWait

public void enterWriteLockNoWait()
                          throws LockException,
                                 LocalLockException,
                                 java.lang.InterruptedException,
                                 ExpiredObjectException
Note well: Upgrading a read lock to a non-ex write lock is tricky. The code inside the lock should execute only when there are NO threads that are executing in a read-locked area that aren't waiting to enter the non-ex write lock area! This is therefore essentially an illegal codepath, because it will lead inevitably to deadlock, as is going from a read-locked area into a write-locked area, or from a non-ex write area into an exclusive write area.

Throws:
LockException
LocalLockException
java.lang.InterruptedException
ExpiredObjectException

leaveWriteLock

public void leaveWriteLock()
                    throws java.lang.InterruptedException,
                           ExpiredObjectException
Throws:
java.lang.InterruptedException
ExpiredObjectException

enterNonExWriteLock

public void enterNonExWriteLock()
                         throws java.lang.InterruptedException,
                                ExpiredObjectException
Throws:
java.lang.InterruptedException
ExpiredObjectException

enterNonExWriteLockNoWait

public void enterNonExWriteLockNoWait()
                               throws LockException,
                                      LocalLockException,
                                      java.lang.InterruptedException,
                                      ExpiredObjectException
Note well: Upgrading a read lock to a non-ex write lock is tricky. The code inside the lock should execute only when there are NO threads that are executing in a read-locked area that aren't waiting to enter the non-ex write lock area! This is therefore essentially an illegal codepath, because it will lead inevitably to deadlock, as is going from a read-locked area into a write-locked area, or from a non-ex write area into an exclusive write area.

Throws:
LockException
LocalLockException
java.lang.InterruptedException
ExpiredObjectException

leaveNonExWriteLock

public void leaveNonExWriteLock()
                         throws java.lang.InterruptedException,
                                ExpiredObjectException
Throws:
java.lang.InterruptedException
ExpiredObjectException

enterReadLock

public void enterReadLock()
                   throws java.lang.InterruptedException,
                          ExpiredObjectException
Throws:
java.lang.InterruptedException
ExpiredObjectException

enterReadLockNoWait

public void enterReadLockNoWait()
                         throws LockException,
                                LocalLockException,
                                java.lang.InterruptedException,
                                ExpiredObjectException
Throws:
LockException
LocalLockException
java.lang.InterruptedException
ExpiredObjectException

leaveReadLock

public void leaveReadLock()
                   throws java.lang.InterruptedException,
                          ExpiredObjectException
Throws:
java.lang.InterruptedException
ExpiredObjectException