public synchronized void registerSlot(ExtendedBlockId blockId, SlotId slotId, boolean isCached) throws InvalidRequestException { if (!enabled) { if (LOG.isTraceEnabled()) { LOG.trace(this + " can't register a slot because the " + "ShortCircuitRegistry is not enabled."); } throw new UnsupportedOperationException(); } ShmId shmId = slotId.getShmId(); RegisteredShm shm = segments.get(shmId); if (shm == null) { throw new InvalidRequestException("there is no shared memory segment " + "registered with shmId " + shmId); } Slot slot = shm.registerSlot(slotId.getSlotIdx(), blockId); if (isCached) { slot.makeAnchorable(); } else { slot.makeUnanchorable(); } boolean added = slots.put(blockId, slot); Preconditions.checkState(added); if (LOG.isTraceEnabled()) { LOG.trace(this + ": registered " + blockId + " with slot " + slotId + " (isCached=" + isCached + ")"); } }
public synchronized void registerSlot(ExtendedBlockId blockId, SlotId slotId, boolean isCached) throws InvalidRequestException { if (!enabled) { if (LOG.isTraceEnabled()) { LOG.trace(this + " can't register a slot because the " + "ShortCircuitRegistry is not enabled."); } throw new UnsupportedOperationException(); } ShmId shmId = slotId.getShmId(); RegisteredShm shm = segments.get(shmId); if (shm == null) { throw new InvalidRequestException("there is no shared memory segment " + "registered with shmId " + shmId); } Slot slot = shm.registerSlot(slotId.getSlotIdx(), blockId); if (isCached) { slot.makeAnchorable(); } else { slot.makeUnanchorable(); } boolean added = slots.put(blockId, slot); Preconditions.checkState(added); if (LOG.isTraceEnabled()) { LOG.trace(this + ": registered " + blockId + " with slot " + slotId + " (isCached=" + isCached + ")"); } }
/** * Make the replica unanchorable. Normally this can only be done by the * DataNode. This method is only for testing. */ @VisibleForTesting void forceUnanchorable() { replica.getSlot().makeUnanchorable(); } }
public synchronized void registerSlot(ExtendedBlockId blockId, SlotId slotId, boolean isCached) throws InvalidRequestException { if (!enabled) { if (LOG.isTraceEnabled()) { LOG.trace(this + " can't register a slot because the " + "ShortCircuitRegistry is not enabled."); } throw new UnsupportedOperationException(); } ShmId shmId = slotId.getShmId(); RegisteredShm shm = segments.get(shmId); if (shm == null) { throw new InvalidRequestException("there is no shared memory segment " + "registered with shmId " + shmId); } Slot slot = shm.registerSlot(slotId.getSlotIdx(), blockId); if (isCached) { slot.makeAnchorable(); } else { slot.makeUnanchorable(); } boolean added = slots.put(blockId, slot); Preconditions.checkState(added); if (LOG.isTraceEnabled()) { LOG.trace(this + ": registered " + blockId + " with slot " + slotId + " (isCached=" + isCached + ")"); } }
/** * Mark any slots associated with this blockId as unanchorable. * * @param blockId The block ID. * @return True if we should allow the munlock request. */ public synchronized boolean processBlockMunlockRequest( ExtendedBlockId blockId) { if (!enabled) return true; boolean allowMunlock = true; Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { slot.makeUnanchorable(); if (slot.isAnchored()) { allowMunlock = false; } } return allowMunlock; }
/** * Mark any slots associated with this blockId as unanchorable. * * @param blockId The block ID. * @return True if we should allow the munlock request. */ public synchronized boolean processBlockMunlockRequest( ExtendedBlockId blockId) { if (!enabled) return true; boolean allowMunlock = true; Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { slot.makeUnanchorable(); if (slot.isAnchored()) { allowMunlock = false; } } return allowMunlock; }
/** * Make the replica unanchorable. Normally this can only be done by the * DataNode. This method is only for testing. */ @VisibleForTesting void forceUnanchorable() { replica.getSlot().makeUnanchorable(); }
/** * Make the replica unanchorable. Normally this can only be done by the * DataNode. This method is only for testing. */ @VisibleForTesting void forceUnanchorable() { replica.getSlot().makeUnanchorable(); } }
/** * Mark any slots associated with this blockId as unanchorable. * * @param blockId The block ID. * @return True if we should allow the munlock request. */ public synchronized boolean processBlockMunlockRequest( ExtendedBlockId blockId) { if (!enabled) return true; boolean allowMunlock = true; Set<Slot> affectedSlots = slots.get(blockId); for (Slot slot : affectedSlots) { slot.makeUnanchorable(); if (slot.isAnchored()) { allowMunlock = false; } } return allowMunlock; }