/** * stop the QuartzServerDemo * * @param pidfile PID文件路径 * @throws Exception */ public void stop(String pidfile) throws Exception { File pid = new File(pidfile); if (!pidFileHelper.pidExists(pid)) { log.info("no service started"); } else { this.sendCommandToServer(pid, "stop"); } }
/** * start the QuartzServerDemo * * @param args */ public void start(String pid_file_path) throws Exception { File pidfile = new File(pid_file_path); if (pidFileHelper.pidExists(pidfile)) { // 检查进程ID是否存在 log.info("QuartzServer already started."); } else { if (serverDaemon == null) { init(); } Method method = serverDaemon.getClass().getMethod("start", new Class[] {String.class}); method.invoke(serverDaemon, new Object[] {pid_file_path}); } }