public synchronized void unlockExclusive ( ) { if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "unlockExclusive" , this ) ; // Synchronize on the locking Mutex. synchronized ( iMutex ) { // Only release the lock if the holder is the current thread. if ( Thread . currentThread ( ) == iExclusiveLockHolder ) { if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Unlocking current thread " + ( iExclusiveLockCount - 1 ) ) ; // Decrement the exclusive lock count, // if the count reaches 0 then we know that // we can safely remove the exclusive lock if ( -- iExclusiveLockCount == 0 ) { // Set the flag to indicate that the exclusive lock // has been released. iExclusivelyLocked = false ; // Set the exclusive lock holder thread to be null iExclusiveLockHolder = null ; // Notify any threads waiting for this lock. notifyAll ( ) ; } } else if ( tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Thread not the current thread to unlock exclusively" ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "unlockExclusive" ) ; }
This method unlocks the exclusive lock that was held .