Search in sources :

Example 6 with CompatibilitySpace

use of org.apache.derby.iapi.services.locks.CompatibilitySpace in project derby by apache.

the class CacheLock method lockProperties.

/**
 * Lock the database properties for an update.
 */
void lockProperties(TransactionController tc) throws StandardException {
    // lock the property set until the transaction commits.
    // This allows correct operation of the cache. The cache remains
    // valid for all transactions except the one that is modifying
    // it. Thus readers see the old uncommited values. When this
    // thread releases its exclusive lock the cached is cleared
    // and the next reader will re-populate the cache.
    CompatibilitySpace cs = tc.getLockSpace();
    Object csGroup = cs.getOwner();
    lf.lockObject(cs, csGroup, cachedLock, ShExQual.EX, C_LockFactory.TIMED_WAIT);
}
Also used : CompatibilitySpace(org.apache.derby.iapi.services.locks.CompatibilitySpace)

Example 7 with CompatibilitySpace

use of org.apache.derby.iapi.services.locks.CompatibilitySpace in project derby by apache.

the class CacheLock method iHoldTheUpdateLock.

/**
 *	  Return true if the caller holds the exclusive update lock on the
 *	  property conglomerate.
 */
private boolean iHoldTheUpdateLock(TransactionController tc) throws StandardException {
    CompatibilitySpace cs = tc.getLockSpace();
    Object csGroup = cs.getOwner();
    return lf.isLockHeld(cs, csGroup, cachedLock, ShExQual.EX);
}
Also used : CompatibilitySpace(org.apache.derby.iapi.services.locks.CompatibilitySpace)

Aggregations

CompatibilitySpace (org.apache.derby.iapi.services.locks.CompatibilitySpace)7 LockingPolicy (org.apache.derby.iapi.store.raw.LockingPolicy)2 RawTransaction (org.apache.derby.iapi.store.raw.xact.RawTransaction)2 SQLLongint (org.apache.derby.iapi.types.SQLLongint)2 ClassFactoryContext (org.apache.derby.iapi.services.loader.ClassFactoryContext)1 StandardException (org.apache.derby.shared.common.error.StandardException)1