public void removeProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToRemoveNonExistentProcess(processName); // ignore return; } boolean removed = processes.remove(processName) != null; processesByKey.remove(new Key(process.getAuthKey().getBytes(Charset.forName("US-ASCII")))); if(removed) { processRemoved(processName); } lock.notifyAll(); } }
public void removeProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToRemoveNonExistentProcess(processName); // ignore return; } boolean removed = processes.remove(processName) != null; processesByKey.remove(new Key(process.getAuthKey().getBytes(Charset.forName("US-ASCII")))); if(removed) { processRemoved(processName); } lock.notifyAll(); } }
public void removeProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ROOT_LOGGER.attemptToRemoveNonExistentProcess(processName); // ignore return; } boolean removed = processes.remove(processName) != null; processesByKey.remove(new Key(process.getAuthKey())); if(removed) { processRemoved(processName); } lock.notifyAll(); } }
void sendInventory() { synchronized (lock) { for (Connection connection : managedConnections) { try { final OutputStream os = connection.writeMessage(); try { os.write(Protocol.PROCESS_INVENTORY); final Collection<ManagedProcess> processCollection = processes.values(); StreamUtils.writeInt(os, processCollection.size()); for (ManagedProcess process : processCollection) { StreamUtils.writeUTFZBytes(os, process.getProcessName()); os.write(process.getAuthKey().getBytes(Charset.forName("US-ASCII"))); StreamUtils.writeBoolean(os, process.isRunning()); StreamUtils.writeBoolean(os, process.isStopping()); } os.close(); } finally { StreamUtils.safeClose(os); } } catch (IOException e) { ProcessLogger.ROOT_LOGGER.failedToWriteMessage("PROCESS_INVENTORY", e); removeManagedConnection(connection); } } } }
void sendInventory() { synchronized (lock) { for (Connection connection : managedConnections) { try { final OutputStream os = connection.writeMessage(); try { os.write(Protocol.PROCESS_INVENTORY); final Collection<ManagedProcess> processCollection = processes.values(); StreamUtils.writeInt(os, processCollection.size()); for (ManagedProcess process : processCollection) { StreamUtils.writeUTFZBytes(os, process.getProcessName()); os.write(process.getAuthKey().getBytes(Charset.forName("US-ASCII"))); StreamUtils.writeBoolean(os, process.isRunning()); StreamUtils.writeBoolean(os, process.isStopping()); } os.close(); } finally { StreamUtils.safeClose(os); } } catch (IOException e) { ProcessLogger.ROOT_LOGGER.failedToWriteMessage("PROCESS_INVENTORY", e); removeManagedConnection(connection); } } } }
void sendInventory() { synchronized (lock) { for (Connection connection : managedConnections) { try { final OutputStream os = connection.writeMessage(); try { os.write(Protocol.PROCESS_INVENTORY); final Collection<ManagedProcess> processCollection = processes.values(); StreamUtils.writeInt(os, processCollection.size()); for (ManagedProcess process : processCollection) { StreamUtils.writeUTFZBytes(os, process.getProcessName()); os.write(process.getAuthKey()); StreamUtils.writeBoolean(os, process.isRunning()); StreamUtils.writeBoolean(os, process.isStopping()); } os.close(); } finally { StreamUtils.safeClose(os); } } catch (IOException e) { ROOT_LOGGER.failedToWriteMessage("PROCESS_INVENTORY", e); removeManagedConnection(connection); } } } }