@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { ProcessLogger.SERVER_LOGGER.tracef("not trying to respawn process %s.", process.getProcessName()); }
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { ProcessLogger.SERVER_LOGGER.tracef("not trying to respawn process %s.", process.getProcessName()); }
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { ProcessLogger.SERVER_LOGGER.tracef("not trying to respawn process %s.", process.getProcessName()); }
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { if (unlimited || count <= MAX_RESTARTS) { try { final int[] waits = slowRespawn ? SLOW_WAITS : NORMAL_WAITS; int waitPeriod; if (count <= waits.length) { waitPeriod = waits[count - 1]; } else { waitPeriod = slowRespawn ? MAX_SLOW_WAIT : MAX_NORMAL_WAIT; } ProcessLogger.SERVER_LOGGER.waitingToRestart(waitPeriod, process.getProcessName()); TimeUnit.SECONDS.sleep(waitPeriod); } catch (InterruptedException e) { return; } process.respawn(); } } };
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { if (unlimited || count <= MAX_RESTARTS) { try { final int[] waits = slowRespawn ? SLOW_WAITS : NORMAL_WAITS; int waitPeriod; if (count <= waits.length) { waitPeriod = waits[count - 1]; } else { waitPeriod = slowRespawn ? MAX_SLOW_WAIT : MAX_NORMAL_WAIT; } ProcessLogger.SERVER_LOGGER.waitingToRestart(waitPeriod, process.getProcessName()); TimeUnit.SECONDS.sleep(waitPeriod); } catch (InterruptedException e) { return; } process.respawn(); } } };
@Override public void respawn(final int count, final ManagedProcess process, boolean slowRespawn, boolean unlimited) { if (unlimited || count <= MAX_RESTARTS) { try { final int[] waits = slowRespawn ? SLOW_WAITS : NORMAL_WAITS; int waitPeriod; if (count <= waits.length) { waitPeriod = waits[count - 1]; } else { waitPeriod = slowRespawn ? MAX_SLOW_WAIT : MAX_NORMAL_WAIT; } ProcessLogger.SERVER_LOGGER.waitingToRestart(waitPeriod, process.getProcessName()); TimeUnit.SECONDS.sleep(waitPeriod); } catch (InterruptedException e) { return; } process.respawn(); } } };
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); } } } }