@Override public void restart() { Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } System.exit(exitOnRestart); } }
/** * In SMF managed environment, just commit a suicide and the service will be restarted by SMF. */ @Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } System.exit(0); }
@Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.info(String.format("Shutting down VM as requested by %s from %s", exitUser, exitAddr)); // Wait 'til we have no active executors. doQuietDown(true, 0); // Make sure isQuietingDown is still true. if (isQuietingDown) { cleanUp(); System.exit(0); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e); } } }.start();
public void contextDestroyed(ServletContextEvent event) { try (ACLContext old = ACL.as(ACL.SYSTEM)) { Jenkins instance = Jenkins.getInstanceOrNull(); try { if (instance != null) { instance.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } terminated = true; Thread t = initThread; if (t != null && t.isAlive()) { LOGGER.log(Level.INFO, "Shutting down a Jenkins instance that was still starting up", new Throwable("reason")); t.interrupt(); } // Logger is in the system classloader, so if we don't do this // the whole web app will never be undeployed. Logger.getLogger("").removeHandler(handler); } finally { JenkinsJVMAccess._setJenkinsJVM(false); } }
Jenkins.getInstance().cleanUp(); System.exit(0); } catch (InterruptedException e) {
@Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.info(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req != null ? req.getRemoteAddr() : "???")); cleanUp(); System.exit(0); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e); } } }.start();
@Override public void run() { boolean success = false; try { Jenkins instance = new Hudson(_home, context); // one last check to make sure everything is in order before we go live if (Thread.interrupted()) throw new InterruptedException(); context.setAttribute(APP, instance); BootFailure.getBootFailureFile(_home).delete(); // at this point we are open for business and serving requests normally LOGGER.info("Jenkins is fully up and running"); success = true; } catch (Error e) { new HudsonFailedToLoad(e).publish(context,_home); throw e; } catch (Exception e) { new HudsonFailedToLoad(e).publish(context,_home); } finally { Jenkins instance = Jenkins.getInstanceOrNull(); if(!success && instance!=null) instance.cleanUp(); } } };
@Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } File me = getHudsonWar(); File home = me.getParentFile(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamTaskListener task = new StreamTaskListener(baos); task.getLogger().println("Restarting a service"); String exe = System.getenv("WINSW_EXECUTABLE"); File executable; if (exe!=null) executable = new File(exe); else executable = new File(home, "hudson.exe"); if (!executable.exists()) executable = new File(home, "jenkins.exe"); // use restart! to run hudson/jenkins.exe restart in a separate process, so it doesn't kill itself int r = new LocalLauncher(task).launch().cmds(executable, "restart!") .stdout(task).pwd(home).join(); if(r!=0) throw new IOException(baos.toString()); }
@Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } // close all files upon exec, except stdin, stdout, and stderr int sz = LIBC.getdtablesize(); for(int i=3; i<sz; i++) { int flags = LIBC.fcntl(i, F_GETFD); if(flags<0) continue; LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC); } // exec to self String exe = args.get(0); LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()]))); throw new IOException("Failed to exec '"+exe+"' "+LIBC.strerror(Native.getLastError())); }
/** * In SMF managed environment, just commit a suicide and the service will be restarted by SMF. */ @Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } System.exit(0); }
@Override public void run() { try { ACL.impersonate(ACL.SYSTEM); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", exitUser, exitAddr)); // Wait 'til we have no active executors. doQuietDown(true, 0); // Make sure isQuietingDown is still true. if (isQuietingDown) { cleanUp(); System.exit(0); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e); } } }.start();
public void contextDestroyed(ServletContextEvent event) { try (ACLContext old = ACL.as(ACL.SYSTEM)) { Jenkins instance = Jenkins.getInstanceOrNull(); try { if (instance != null) { instance.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } terminated = true; Thread t = initThread; if (t != null && t.isAlive()) { LOGGER.log(Level.INFO, "Shutting down a Jenkins instance that was still starting up", new Throwable("reason")); t.interrupt(); } // Logger is in the system classloader, so if we don't do this // the whole web app will never be undeployed. Logger.getLogger("").removeHandler(handler); } finally { JenkinsJVMAccess._setJenkinsJVM(false); } }
Jenkins.getInstance().cleanUp(); System.exit(0); } catch (InterruptedException e) {
@Override public void run() { boolean success = false; try { Jenkins instance = new Hudson(_home, context); // one last check to make sure everything is in order before we go live if (Thread.interrupted()) throw new InterruptedException(); context.setAttribute(APP, instance); BootFailure.getBootFailureFile(_home).delete(); // at this point we are open for business and serving requests normally LOGGER.info("Jenkins is fully up and running"); success = true; } catch (Error e) { new HudsonFailedToLoad(e).publish(context,_home); throw e; } catch (Exception e) { new HudsonFailedToLoad(e).publish(context,_home); } finally { Jenkins instance = Jenkins.getInstanceOrNull(); if(!success && instance!=null) instance.cleanUp(); } } };
@Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } File me = getHudsonWar(); File home = me.getParentFile(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamTaskListener task = new StreamTaskListener(baos); task.getLogger().println("Restarting a service"); String exe = System.getenv("WINSW_EXECUTABLE"); File executable; if (exe!=null) executable = new File(exe); else executable = new File(home, "hudson.exe"); if (!executable.exists()) executable = new File(home, "jenkins.exe"); // use restart! to run hudson/jenkins.exe restart in a separate process, so it doesn't kill itself int r = new LocalLauncher(task).launch().cmds(executable, "restart!") .stdout(task).pwd(home).join(); if(r!=0) throw new IOException(baos.toString()); }
jenkins.cleanUp(); ExtensionList.clearLegacyInstances(); DescriptorExtensionList.clearLegacyInstances();
jenkins.cleanUp(); ExtensionList.clearLegacyInstances(); DescriptorExtensionList.clearLegacyInstances();
/** * Shutdown the system. * @since 1.161 */ @CLIMethod(name="shutdown") @RequirePOST public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException { checkPermission(ADMINISTER); LOGGER.severe(String.format("Shutting down VM as requested by %s from %s", getAuthentication().getName(), req!=null?req.getRemoteAddr():"???")); if (rsp!=null) { rsp.setStatus(HttpServletResponse.SC_OK); rsp.setContentType("text/plain"); try (PrintWriter w = rsp.getWriter()) { w.println("Shutting down"); } } cleanUp(); System.exit(0); }
jenkins.cleanUp(); ExtensionList.clearLegacyInstances(); DescriptorExtensionList.clearLegacyInstances();
@Override public void restart() throws IOException, InterruptedException { Jenkins jenkins = Jenkins.getInstanceOrNull(); // guard against repeated concurrent calls to restart try { if (jenkins != null) { jenkins.cleanUp(); } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Failed to clean up. Restart will continue.", e); } // close all files upon exec, except stdin, stdout, and stderr int sz = LIBC.getdtablesize(); for(int i=3; i<sz; i++) { int flags = LIBC.fcntl(i, F_GETFD); if(flags<0) continue; LIBC.fcntl(i, F_SETFD,flags| FD_CLOEXEC); } // exec to self String exe = args.get(0); LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()]))); throw new IOException("Failed to exec '"+exe+"' "+LIBC.strerror(Native.getLastError())); }