Esempio n. 1
0
 /// <exception cref="Org.Apache.Hadoop.FS.InvalidRequestException"/>
 public virtual void UnregisterSlot(ShortCircuitShm.SlotId slotId)
 {
     lock (this)
     {
         if (!enabled)
         {
             if (Log.IsTraceEnabled())
             {
                 Log.Trace("unregisterSlot: ShortCircuitRegistry is " + "not enabled.");
             }
             throw new NotSupportedException();
         }
         ShortCircuitShm.ShmId shmId            = slotId.GetShmId();
         ShortCircuitRegistry.RegisteredShm shm = segments[shmId];
         if (shm == null)
         {
             throw new InvalidRequestException("there is no shared memory segment " + "registered with shmId "
                                               + shmId);
         }
         ShortCircuitShm.Slot slot = shm.GetSlot(slotId.GetSlotIdx());
         slot.MakeInvalid();
         shm.UnregisterSlot(slotId.GetSlotIdx());
         slots.Remove(slot.GetBlockId(), slot);
     }
 }
Esempio n. 2
0
 /// <exception cref="Org.Apache.Hadoop.FS.InvalidRequestException"/>
 public virtual void RegisterSlot(ExtendedBlockId blockId, ShortCircuitShm.SlotId
                                  slotId, bool isCached)
 {
     lock (this)
     {
         if (!enabled)
         {
             if (Log.IsTraceEnabled())
             {
                 Log.Trace(this + " can't register a slot because the " + "ShortCircuitRegistry is not enabled."
                           );
             }
             throw new NotSupportedException();
         }
         ShortCircuitShm.ShmId shmId            = slotId.GetShmId();
         ShortCircuitRegistry.RegisteredShm shm = segments[shmId];
         if (shm == null)
         {
             throw new InvalidRequestException("there is no shared memory segment " + "registered with shmId "
                                               + shmId);
         }
         ShortCircuitShm.Slot slot = shm.RegisterSlot(slotId.GetSlotIdx(), blockId);
         if (isCached)
         {
             slot.MakeAnchorable();
         }
         else
         {
             slot.MakeUnanchorable();
         }
         bool added = slots.Put(blockId, slot);
         Preconditions.CheckState(added);
         if (Log.IsTraceEnabled())
         {
             Log.Trace(this + ": registered " + blockId + " with slot " + slotId + " (isCached="
                       + isCached + ")");
         }
     }
 }