提交 a59814e8 编写于 作者: M mindless

[FIXED HUDSON-6804] call Hudson.cleanUp from lifecycle classes and in Hudson.doSafeExit

so that safeRestart and safeExit propertly cleanup before terminating the process;
in particular, so the contents of the build queue is saved so it can be restored
after restart.  Also increased delay before restart from 5 to 10 seconds,
as I saw one build get interrupted at restart in my testing.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33184 71c3de6d-444a-0410-be80-ed276b4c234a
上级 93eb8759
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
* Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
......@@ -23,6 +23,7 @@
*/
package hudson.lifecycle;
import hudson.model.Hudson;
import java.io.IOException;
/**
......@@ -36,6 +37,9 @@ public class SolarisSMFLifecycle extends Lifecycle {
*/
@Override
public void restart() throws IOException, InterruptedException {
Hudson h = Hudson.getInstance();
if (h != null)
h.cleanUp();
System.exit(0);
}
}
......@@ -61,6 +61,10 @@ public class UnixLifecycle extends Lifecycle {
@Override
public void restart() throws IOException, InterruptedException {
Hudson h = Hudson.getInstance();
if (h != null)
h.cleanUp();
// close all files upon exec, except stdin, stdout, and stderr
int sz = LIBC.getdtablesize();
for(int i=3; i<sz; i++) {
......
......@@ -2963,8 +2963,8 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
if (isQuietingDown) {
servletContext.setAttribute("app",new HudsonIsRestarting());
// give some time for the browser to load the "reloading" page
LOGGER.info("Restart in 5 seconds");
Thread.sleep(5000);
LOGGER.info("Restart in 10 seconds");
Thread.sleep(10000);
lifecycle.restart();
} else {
LOGGER.info("Safe-restart mode cancelled");
......@@ -3024,6 +3024,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
}
// Make sure isQuietingDown is still true.
if (isQuietingDown) {
cleanUp();
System.exit(0);
}
} catch (InterruptedException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册