mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-26 19:15:09 +00:00
Lifecycle.onBootFailure (#9483)
This commit is contained in:
1 parent
62e4ac4778
commit
7680da0cef
3 files changed
+18
No files matched your search
@@ -26,6 +26,7 @@ package hudson.lifecycle;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import hudson.Extension;
|
||||
import hudson.util.BootFailure;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import jenkins.model.Jenkins;
|
||||
@@ -72,4 +73,9 @@ public class ExitLifecycle extends Lifecycle {
|
||||
|
||||
System.exit(exitOnRestart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBootFailure(BootFailure problem) {
|
||||
restart();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ import hudson.PluginManager;
|
||||
import hudson.Util;
|
||||
import hudson.init.InitMilestone;
|
||||
import hudson.init.Initializer;
|
||||
import hudson.util.BootFailure;
|
||||
import hudson.util.JenkinsReloadFailed;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
@@ -324,6 +326,14 @@ public abstract class Lifecycle implements ExtensionPoint {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when Jenkins has failed to boot.
|
||||
* @param problem a boot failure (could be {@link JenkinsReloadFailed})
|
||||
* @since TODO
|
||||
*/
|
||||
public void onBootFailure(BootFailure problem) {
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
public static final class PlaceholderLifecycle extends ExitLifecycle {
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.servlet.ServletContext;
|
||||
import jenkins.model.Jenkins;
|
||||
import jenkins.util.groovy.GroovyHookScript;
|
||||
import org.kohsuke.stapler.WebApp;
|
||||
|
||||
@@ -51,6 +52,7 @@ public abstract class BootFailure extends ErrorObject {
|
||||
.bind("servletContext", context)
|
||||
.bind("attempts", loadAttempts(home))
|
||||
.run();
|
||||
Jenkins.get().getLifecycle().onBootFailure(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user