コード例 #1
0
ファイル: ThinLockImpl.java プロジェクト: geniot/elex
  public Lock transfer(
      Long nodeId, Locker currentLocker, Locker destLocker, MemoryBudget mb, int lockTableIndex)
      throws DatabaseException {

    Lock newLock = new LockImpl(new LockInfo(this.locker, this.lockType));
    return newLock.transfer(nodeId, currentLocker, destLocker, mb, lockTableIndex);
  }
コード例 #2
0
ファイル: LockManager.java プロジェクト: lzimm/qluster
  /** Do the real work of transfer */
  void transferInternal(
      long nodeId, Locker owningLocker, Locker destLocker, boolean demoteToRead, 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";
    if (demoteToRead) {
      useLock.demote(owningLocker);
    }
    Lock newLock = useLock.transfer(nodeId, owningLocker, destLocker, 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);
  }