Merge branch 'master' of github.com:jenkinsci/jenkins into 2.0

Conflicts:
	changelog.html
	cli/pom.xml
	core/pom.xml
	core/src/main/java/hudson/ProxyConfiguration.java
	core/src/main/java/jenkins/model/Jenkins.java
	core/src/main/java/jenkins/slaves/JnlpSlaveHandshake.java
	core/src/main/resources/hudson/model/Messages_da.properties
	pom.xml
	test/pom.xml
	war/pom.xml
This commit is contained in:
Daniel Beck committed 2016-03-16 19:00:40 +01:00
commit 869f66cc07
105 files changed
+2049 -772

No files matched your search

+24 -13
View File
@@ -40,6 +40,7 @@ import hudson.util.IncompatibleAntVersionDetected;
import hudson.util.HudsonFailedToLoad;
import hudson.util.ChartUtil;
import hudson.util.AWTProblem;
import jenkins.util.JenkinsJVM;
import org.jvnet.localizer.LocaleProvider;
import org.kohsuke.stapler.jelly.JellyFacet;
import org.apache.tools.ant.types.FileSet;
@@ -89,6 +90,7 @@ public class WebAppMain implements ServletContextListener {
* Creates the sole instance of {@link jenkins.model.Jenkins} and register it to the {@link ServletContext}.
*/
public void contextInitialized(ServletContextEvent event) {
JenkinsJVMAccess._setJenkinsJVM(true);
final ServletContext context = event.getServletContext();
File home=null;
try {
@@ -234,7 +236,7 @@ public class WebAppMain implements ServletContextListener {
} catch (Exception e) {
new HudsonFailedToLoad(e).publish(context,_home);
} finally {
Jenkins instance = Jenkins.getInstance();
Jenkins instance = Jenkins.getInstanceOrNull();
if(!success && instance!=null)
instance.cleanUp();
}
@@ -364,23 +366,32 @@ public class WebAppMain implements ServletContextListener {
}
public void contextDestroyed(ServletContextEvent event) {
terminated = true;
Jenkins instance = Jenkins.getInstance();
if(instance!=null)
instance.cleanUp();
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();
}
try {
terminated = true;
Jenkins instance = Jenkins.getInstanceOrNull();
if(instance!=null)
instance.cleanUp();
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 undepoyed.
Logger.getLogger("").removeHandler(handler);
// Logger is in the system classloader, so if we don't do this
// the whole web app will never be undepoyed.
Logger.getLogger("").removeHandler(handler);
} finally {
JenkinsJVMAccess._setJenkinsJVM(false);
}
}
private static final Logger LOGGER = Logger.getLogger(WebAppMain.class.getName());
private static final class JenkinsJVMAccess extends JenkinsJVM {
private static void _setJenkinsJVM(boolean jenkinsJVM) {
JenkinsJVM.setJenkinsJVM(jenkinsJVM);
}
}
private static final String[] HOME_NAMES = {"JENKINS_HOME","HUDSON_HOME"};
}