Esempio n. 1
0
  public Lock transferMultiple(
      Long nodeId, Locker currentLocker, Locker[] destLockers, MemoryBudget mb, int lockTableIndex)
      throws DatabaseException {

    Lock newLock = new LockImpl(new LockInfo(this.locker, this.lockType));
    return newLock.transferMultiple(nodeId, currentLocker, destLockers, mb, lockTableIndex);
  }
Esempio n. 2
0
  /** Do the real work of transferMultiple */
  void transferMultipleInternal(
      long nodeId, Locker owningLocker, Locker[] destLockers, int lockTableIndex)
      throws DatabaseException {

    Map<Long, Lock> lockTable = lockTables[lockTableIndex];
    Lock useLock = lockTable.get(Long.valueOf(nodeId));

    assert useLock != null : "Transfer, lock " + nodeId + " was null";
    useLock.demote(owningLocker);

    Lock newLock =
        useLock.transferMultiple(nodeId, owningLocker, destLockers, memoryBudget, lockTableIndex);
    if (newLock != useLock) {
      /* The lock mutated from ThinLockImpl to LockImpl. */
      lockTable.put(nodeId, newLock);
      /* We still have the overhead of the hashtable (locktable). */
      memoryBudget.updateLockMemoryUsage(THINLOCK_MUTATE_OVERHEAD, lockTableIndex);
    }

    owningLocker.removeLock(nodeId);
  }