public void killWatchdog(String serverId) throws IOException { ActorSender conn = getConnection(); try { ResultStatus status = (ResultStatus) conn.query(WATCHDOG_ADDRESS, new WatchdogKillQuery(serverId), BAM_TIMEOUT); if (!status.isSuccess()) throw new RuntimeException( L.l("{0}: watchdog kill failed because of '{1}'", this, status.getMessage())); } catch (RuntimeException e) { throw e; } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } }
public boolean shutdown() throws IOException { ActorSender conn = getConnection(); try { ResultStatus status = (ResultStatus) conn.query(WATCHDOG_ADDRESS, new WatchdogShutdownQuery(), BAM_TIMEOUT); if (!status.isSuccess()) throw new RuntimeException( L.l("{0}: watchdog shutdown failed because of '{1}'", this, status.getMessage())); } catch (RuntimeException e) { throw e; } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } return true; }
public void restartWatchdog(String id, String[] argv) throws IOException { // cloud/1295 ActorSender conn = getConnection(); try { ResultStatus status = (ResultStatus) conn.query(WATCHDOG_ADDRESS, new WatchdogRestartQuery(id, argv), BAM_TIMEOUT); if (!status.isSuccess()) throw new RuntimeException( L.l("{0}: watchdog restartfailed because of '{1}'", this, status.getMessage())); } catch (RuntimeException e) { throw e; } catch (Exception e) { log.log(Level.FINE, e.toString(), e); } }
public Process startWatchdog(String[] argv) throws ConfigException, IOException { if (getUserName() != null && !hasBoot()) { String message = getTroubleshootMessage(); if (message == null) message = "Check the $RESIN_HOME/libexec or $RESIN_HOME/libexec64 directory for libresin_os.so."; throw new ConfigException(L.l("<user-name> requires compiled JNI.\n{0}", message)); } if (getGroupName() != null && !hasBoot()) { String message = getTroubleshootMessage(); if (message == null) message = "Check the $RESIN_HOME/libexec or $RESIN_HOME/libexec64 directory for libresin_os.so."; throw new ConfigException(L.l("<group-name> requires compiled JNI.\n{0}", message)); } ActorSender conn = null; try { conn = getConnection(); ResultStatus status = (ResultStatus) conn.query(WATCHDOG_ADDRESS, new WatchdogStartQuery(argv), BAM_TIMEOUT); if (status.isSuccess()) return null; throw new ConfigException( L.l("{0}: watchdog start failed because of '{1}'", this, status.getMessage())); } catch (RemoteConnectionFailedException e) { log.log(Level.FINE, e.toString(), e); } catch (RuntimeException e) { throw e; } finally { if (conn != null) conn.close(); } return launchManager(argv); }
public String statusWatchdog() throws IOException { ActorSender conn = getConnection(); try { ResultStatus status = (ResultStatus) conn.query(WATCHDOG_ADDRESS, new WatchdogStatusQuery()); if (status.isSuccess()) return status.getMessage(); throw new RuntimeException( L.l("{0}: watchdog status failed because of '{1}'", this, status.getMessage())); } catch (Exception e) { Throwable e1 = e; while (e1.getCause() != null) e1 = e1.getCause(); log.log(Level.FINE, e.toString(), e); return e1.toString(); } }