@Override protected NodeSPI lookupForEviction(InvocationContext ctx, Fqn fqn) { return dataContainer.peek(fqn, false, true); }
public NodeSPI lookUpNode(Fqn fqn) { return container.peek(fqn); }
/** * @return a Set of child node names that hang directly off the backup tree root, or null if the backup tree root doesn't exist. */ @Override @SuppressWarnings("unchecked") protected Set<Object> getBackupRoots() { NodeSPI backupSubtree = dataContainer.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN); if (backupSubtree == null) return null; return backupSubtree.getChildrenNamesDirect(); }
@SuppressWarnings("unchecked") public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes, boolean includeInvalidNodes) { // TODO: clean this up somehow! Anyway, this method should NOT be used outside of testing frameworks. return (usingMvcc) ? mvccPeek(fqn) : (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes, includeInvalidNodes); }
/** * Internal method that acquires a lock and returns the lock object. Currently uses {@link IdentityLock} objects; may change in * future to use standard JDK locks. * * @param fqn Fqn to lock * @param lockType type of lock to acquire * @param owner owner to acquire lock for * @param timeout timeout * @return lock if acquired, null otherwise. */ private NodeLock acquireLock(Fqn fqn, LockType lockType, Object owner, long timeout) { return acquireLock(dataContainer.peek(fqn), lockType, owner, timeout); }
public void rollback() { if (oldValue != null) { NodeSPI targetNode = dataContainer.peek(fqn, false, true); if (targetNode != null) targetNode.putDirect(key, oldValue); } } }
@SuppressWarnings("unchecked") public NodeSPI<K, V> peek(Fqn fqn, boolean includeDeletedNodes) { // TODO: clean this up somehow! Anyway, this method should NOT be used outside of testing frameworks. return (usingMvcc) ? mvccPeek(fqn) : (NodeSPI<K, V>) dataContainer.peek(fqn, includeDeletedNodes); }
public boolean isLocked(Fqn fqn) { return isLocked(dataContainer.peek(fqn)); }
public Object getWriteOwner(Fqn f) { return getWriteOwner(dataContainer.peek(f)); }
public Collection<Object> getReadOwners(Fqn f) { return getReadOwners(dataContainer.peek(f)); }
public boolean lockAndRecord(Fqn fqn, LockType lockType, InvocationContext ctx) { return lockAndRecord(dataContainer.peek(fqn), lockType, ctx); }
public boolean lockAllAndRecord(Fqn fqn, LockType lockType, InvocationContext ctx) { return lockAllAndRecord(dataContainer.peek(fqn), lockType, ctx); }
public boolean ownsLock(Fqn fqn, Object owner) { return ownsLock(dataContainer.peek(fqn, true, true), owner); }
public void rollback() { if (trace) log.trace("rollback(" + globalTransaction + ", " + fqn + ", " + data + ")"); NodeSPI n = dataContainer.peek(fqn, false, true); if (n != null) { n.clearDataDirect(); if (oldData != null) n.putAllDirect(oldData); } } }
public void unlock(Fqn fqn, Object owner) { unlock(dataContainer.peek(fqn).getLock(), owner); }
@Override public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable { List<Fqn> fqns = new ArrayList<Fqn>(); fqns.add(command.getTo()); // peek into Node and get a hold of all child fqns as these need to be in the workspace. NodeSPI node = dataContainer.peek(command.getFqn(), true, true); greedyGetFqns(fqns, node, command.getTo()); if (trace) log.trace("Adding Fqns " + fqns + " for a move() operation."); for (Fqn f : fqns) { createNode(ctx, f, true); } return invokeNextInterceptor(ctx, command); }
public void rollback() { NodeSPI n = dataContainer.peek(fqn, false, false); if (n == null) throw new CacheException("node " + fqn + " not found for rollback!"); if (oldValue == null) { n.removeDirect(key); } else { n.putDirect(key, oldValue); } } }
public void rollback() { NodeSPI n = dataContainer.peek(fqn, false, false); if (n == null) throw new CacheException("node " + fqn + " not found for rollback!"); if (oldValue == null) { n.removeDirect(key); } else { n.putDirect(key, oldValue); } } }
@Override public Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable { Fqn fqn = command.getFqn(); if (fqn != null) { loadIfNeeded(ctx, fqn, null, false, false, false, ctx.getTransactionContext(), false, false, true); NodeSPI n = dataContainer.peek(fqn, true, true); loadChildren(fqn, n, false, false, ctx); } return invokeNextInterceptor(ctx, command); }
public boolean ownsLock(Fqn fqn, LockType lockType, Object owner) { NodeSPI n = dataContainer.peek(fqn, true, true); if (n == null) return false; NodeLock lock = n.getLock(); switch (lockType) { case READ: return lock.isReadLocked() && lock.isOwner(owner); case WRITE: return lock.isWriteLocked() && lock.isOwner(owner); case NONE: default: return false; } }