shm.unregisterSlot(slot.getSlotIdx()); if (shm.isDisconnected()) { Preconditions.checkState(!full.containsKey(shm.getShmId())); Preconditions.checkState(!notFull.containsKey(shm.getShmId())); if (shm.isEmpty()) { LOG.trace("{}: freeing empty stale {}", this, shm); shm.free(); ShmId shmId = shm.getShmId(); if (shm.isEmpty()) { notFull.remove(shmId);
/** * Pull a slot out of a preexisting shared memory segment. * * Must be called with the manager lock held. * * @param blockId The blockId to put inside the Slot object. * * @return null if none of our shared memory segments contain a * free slot; the slot object otherwise. */ private Slot allocSlotFromExistingShm(ExtendedBlockId blockId) { if (notFull.isEmpty()) { return null; } Entry<ShmId, DfsClientShm> entry = notFull.firstEntry(); DfsClientShm shm = entry.getValue(); ShmId shmId = shm.getShmId(); Slot slot = shm.allocAndRegisterSlot(blockId); if (shm.isFull()) { LOG.trace("{}: pulled the last slot {} out of {}", this, slot.getSlotIdx(), shm); DfsClientShm removedShm = notFull.remove(shmId); Preconditions.checkState(removedShm == shm); full.put(shmId, shm); } else { LOG.trace("{}: pulled slot {} out of {}", this, slot.getSlotIdx(), shm); } return slot; }
public void freeSlot(Slot slot) { lock.lock(); try { DfsClientShm shm = (DfsClientShm)slot.getShm(); shm.getEndpointShmManager().freeSlot(slot); } finally { lock.unlock(); } }
/** * Handle the closure of the UNIX domain socket associated with this shared * memory segment by marking this segment as stale. * * If there are no slots associated with this shared memory segment, it will * be freed immediately in this function. */ @Override public boolean handle(DomainSocket sock) { manager.unregisterShm(getShmId()); synchronized (this) { Preconditions.checkState(!disconnected); disconnected = true; boolean hadSlots = false; for (Iterator<Slot> iter = slotIterator(); iter.hasNext(); ) { Slot slot = iter.next(); slot.makeInvalid(); hadSlots = true; } if (!hadSlots) { free(); } } return true; } }
finishedLoading.signalAll(); if (shm.isDisconnected()) { notFull.put(shm.getShmId(), shm);
LOG.trace("{}: about to release {}", ShortCircuitCache.this, slot); final DfsClientShm shm = (DfsClientShm)slot.getShm(); final DomainSocket shmSock = shm.getPeer().getDomainSocket(); final String path = shmSock.getPath(); boolean success = false; shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(shm);
@Override public void visit(HashMap<DatanodeInfo, PerDatanodeVisitorInfo> info) throws IOException { Assert.assertTrue(info.get(datanode).full.isEmpty()); Assert.assertFalse(info.get(datanode).disabled); Assert.assertEquals(1, info.get(datanode).notFull.values().size()); DfsClientShm shm = info.get(datanode).notFull.values().iterator().next(); Assert.assertFalse(shm.isDisconnected()); } });
final void shutdown(DfsClientShm shm) { try { shm.getPeer().getDomainSocket().shutdown(); } catch (IOException e) { LOG.warn(this + ": error shutting down shm: got IOException calling " + "shutdown(SHUT_RDWR)", e); } } }
new DfsClientShm(PBHelperClient.convert(resp.getId()), fis[0], this, peer); LOG.trace("{}: createNewShm: created {}", this, shm);
/** * Handle the closure of the UNIX domain socket associated with this shared * memory segment by marking this segment as stale. * * If there are no slots associated with this shared memory segment, it will * be freed immediately in this function. */ @Override public boolean handle(DomainSocket sock) { manager.unregisterShm(getShmId()); synchronized (this) { Preconditions.checkState(!disconnected); disconnected = true; boolean hadSlots = false; for (Iterator<Slot> iter = slotIterator(); iter.hasNext(); ) { Slot slot = iter.next(); slot.makeInvalid(); hadSlots = true; } if (!hadSlots) { free(); } } return true; } }
finishedLoading.signalAll(); if (shm.isDisconnected()) { + "the shm.", this); } else { notFull.put(shm.getShmId(), shm);
final DomainSocket shmSock = shm.getPeer().getDomainSocket(); DomainSocket sock = null; DataOutputStream out = null; shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(shm);
final void shutdown(DfsClientShm shm) { try { shm.getPeer().getDomainSocket().shutdown(); } catch (IOException e) { LOG.warn(this + ": error shutting down shm: got IOException calling " + "shutdown(SHUT_RDWR)", e); } } }
new DfsClientShm(PBHelper.convert(resp.getId()), fis[0], this, peer); if (LOG.isTraceEnabled()) {
shm.unregisterSlot(slot.getSlotIdx()); if (shm.isDisconnected()) { Preconditions.checkState(!full.containsKey(shm.getShmId())); Preconditions.checkState(!notFull.containsKey(shm.getShmId())); if (shm.isEmpty()) { if (LOG.isTraceEnabled()) { LOG.trace(this + ": freeing empty stale " + shm); shm.free(); ShmId shmId = shm.getShmId(); if (shm.isEmpty()) { notFull.remove(shmId);
/** * Handle the closure of the UNIX domain socket associated with this shared * memory segment by marking this segment as stale. * * If there are no slots associated with this shared memory segment, it will * be freed immediately in this function. */ @Override public boolean handle(DomainSocket sock) { manager.unregisterShm(getShmId()); synchronized (this) { Preconditions.checkState(!disconnected); disconnected = true; boolean hadSlots = false; for (Iterator<Slot> iter = slotIterator(); iter.hasNext(); ) { Slot slot = iter.next(); slot.makeInvalid(); hadSlots = true; } if (!hadSlots) { free(); } } return true; } }
ShmId shmId = shm.getShmId(); Slot slot = shm.allocAndRegisterSlot(blockId); if (shm.isFull()) { if (LOG.isTraceEnabled()) { LOG.trace(this + ": pulled the last slot " + slot.getSlotIdx() +
finishedLoading.signalAll(); if (shm.isDisconnected()) { notFull.put(shm.getShmId(), shm);
final DomainSocket shmSock = shm.getPeer().getDomainSocket(); DomainSocket sock = null; DataOutputStream out = null; shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(shm);
final void shutdown(DfsClientShm shm) { try { shm.getPeer().getDomainSocket().shutdown(); } catch (IOException e) { LOG.warn(this + ": error shutting down shm: got IOException calling " + "shutdown(SHUT_RDWR)", e); } } }