public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer, MutableBoolean usedPeer, ExtendedBlockId blockId, String clientName) throws IOException { lock.lock(); try { if (closed) { LOG.trace(this + ": the DfsClientShmManager isclosed."); return null; } EndpointShmManager shmManager = datanodes.get(datanode); if (shmManager == null) { shmManager = new EndpointShmManager(datanode); datanodes.put(datanode, shmManager); } return shmManager.allocSlot(peer, usedPeer, clientName, blockId); } finally { lock.unlock(); } }
public void freeSlot(Slot slot) { lock.lock(); try { DfsClientShm shm = (DfsClientShm)slot.getShm(); shm.getEndpointShmManager().freeSlot(slot); } finally { lock.unlock(); } }
@VisibleForTesting public void visit(Visitor visitor) throws IOException { lock.lock(); try { HashMap<DatanodeInfo, PerDatanodeVisitorInfo> info = new HashMap<DatanodeInfo, PerDatanodeVisitorInfo>(); for (Entry<DatanodeInfo, EndpointShmManager> entry : datanodes.entrySet()) { info.put(entry.getKey(), entry.getValue().getVisitorInfo()); } visitor.visit(info); } finally { lock.unlock(); } }
Slot slot = allocSlotFromExistingShm(blockId); if (slot != null) { return slot; DfsClientShm shm; try { shm = requestNewShm(clientName, peer); if (shm == null) continue;
Slot slot = allocSlotFromExistingShm(blockId); if (slot != null) { return slot; DfsClientShm shm; try { shm = requestNewShm(clientName, peer); if (shm == null) continue;
Slot slot = allocSlotFromExistingShm(blockId); if (slot != null) { return slot; DfsClientShm shm; try { shm = requestNewShm(clientName, peer); if (shm == null) continue;
"empty " + shm); shutdown(shm); } else { notFull.put(shmId, shm);
"empty " + shm); shutdown(shm); } else { notFull.put(shmId, shm);
shutdown(shm); } else { notFull.put(shmId, shm);
shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(shm);
shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(shm);
shmManager.freeSlot(slot); } else { shm.getEndpointShmManager().shutdown(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; } }
/** * 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; } }
/** * 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; } }
public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer, MutableBoolean usedPeer, ExtendedBlockId blockId, String clientName) throws IOException { lock.lock(); try { if (closed) { LOG.trace(this + ": the DfsClientShmManager isclosed."); return null; } EndpointShmManager shmManager = datanodes.get(datanode); if (shmManager == null) { shmManager = new EndpointShmManager(datanode); datanodes.put(datanode, shmManager); } return shmManager.allocSlot(peer, usedPeer, clientName, blockId); } finally { lock.unlock(); } }
public Slot allocSlot(DatanodeInfo datanode, DomainPeer peer, MutableBoolean usedPeer, ExtendedBlockId blockId, String clientName) throws IOException { lock.lock(); try { if (closed) { LOG.trace(this + ": the DfsClientShmManager isclosed."); return null; } EndpointShmManager shmManager = datanodes.get(datanode); if (shmManager == null) { shmManager = new EndpointShmManager(datanode); datanodes.put(datanode, shmManager); } return shmManager.allocSlot(peer, usedPeer, clientName, blockId); } finally { lock.unlock(); } }
@VisibleForTesting public void visit(Visitor visitor) throws IOException { lock.lock(); try { HashMap<DatanodeInfo, PerDatanodeVisitorInfo> info = new HashMap<DatanodeInfo, PerDatanodeVisitorInfo>(); for (Entry<DatanodeInfo, EndpointShmManager> entry : datanodes.entrySet()) { info.put(entry.getKey(), entry.getValue().getVisitorInfo()); } visitor.visit(info); } finally { lock.unlock(); } }
@VisibleForTesting public void visit(Visitor visitor) throws IOException { lock.lock(); try { HashMap<DatanodeInfo, PerDatanodeVisitorInfo> info = new HashMap<>(); for (Entry<DatanodeInfo, EndpointShmManager> entry : datanodes.entrySet()) { info.put(entry.getKey(), entry.getValue().getVisitorInfo()); } visitor.visit(info); } finally { lock.unlock(); } }
public void freeSlot(Slot slot) { lock.lock(); try { DfsClientShm shm = (DfsClientShm)slot.getShm(); shm.getEndpointShmManager().freeSlot(slot); } finally { lock.unlock(); } }