public void stopProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToStopNonExistentProcess(processName); // ignore return; } process.stop(); } }
public void stopProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ProcessLogger.ROOT_LOGGER.attemptToStopNonExistentProcess(processName); // ignore return; } process.stop(); } }
public void stopProcess(final String processName) { synchronized (lock) { final Map<String, ManagedProcess> processes = this.processes; final ManagedProcess process = processes.get(processName); if (process == null) { ROOT_LOGGER.attemptToStopNonExistentProcess(processName); // ignore return; } process.stop(); } }
public void destroy() { synchronized (lock) { Thread jt = joinThread; if(state != State.STOPPING) { stop(); // Try to stop before destroying the process } final long timeout = 5000; if (state != State.DOWN && jt != null) { try { // Give stop() a small amount of time to work, // in case the user asked for a destroy when a normal stop // was sufficient. But the base assumption is the destroy // is needed jt.join(timeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if (state != State.DOWN || jt == null || jt.isAlive()) { // Cover all bases just to be robust log.destroyingProcess(processName, timeout); process.destroyForcibly(); } } }
public void destroy() { synchronized (lock) { Thread jt = joinThread; if(state != State.STOPPING) { stop(); // Try to stop before destroying the process } final long timeout = 5000; if (state != State.DOWN && jt != null) { try { // Give stop() a small amount of time to work, // in case the user asked for a destroy when a normal stop // was sufficient. But the base assumption is the destroy // is needed jt.join(timeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if (state != State.DOWN || jt == null || jt.isAlive()) { // Cover all bases just to be robust log.destroyingProcess(processName, timeout); process.destroyForcibly(); } } }
public void kill() { synchronized (lock) { Thread jt = joinThread; if(state != State.STOPPING) { stop(); // Try to stop before killing the process } final long timeout = 5000; if (state != State.DOWN && jt != null) { try { // Give stop() a small amount of time to work, // in case the user asked for a kill when a normal stop // was sufficient. But the base assumption is the kill // is needed jt.join(timeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if (state != State.DOWN || jt == null || jt.isAlive()) { // Cover all bases just to be robust log.attemptingToKillProcess(processName, timeout); if (!ProcessUtils.killProcess(processName, id)) { // Fallback to destroy if kill is not available log.failedToKillProcess(processName); process.destroyForcibly(); } } } }
public void kill() { synchronized (lock) { Thread jt = joinThread; if(state != State.STOPPING) { stop(); // Try to stop before killing the process } final long timeout = 5000; if (state != State.DOWN && jt != null) { try { // Give stop() a small amount of time to work, // in case the user asked for a kill when a normal stop // was sufficient. But the base assumption is the kill // is needed jt.join(timeout); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } if (state != State.DOWN || jt == null || jt.isAlive()) { // Cover all bases just to be robust log.attemptingToKillProcess(processName, timeout); if (!ProcessUtils.killProcess(processName, id)) { // Fallback to destroy if kill is not available log.failedToKillProcess(processName); process.destroyForcibly(); } } } }