Package jenkins.util
Class JenkinsJVM
java.lang.Object
jenkins.util.JenkinsJVM
A utility class to identify if the current JVM is the one that is running
Jenkins- Since:
- 1.653
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtect against people instantiating this class. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidVerify that the classloader that loaded this class is the classloader from whichJenkinshas been started.static voidVerify that the classloader that loaded this class is not the classloader from whichJenkinshas been started.static booleanIdentify whether the classloader that loaded this class is the classloader from whichJenkinshas been started.protected static voidsetJenkinsJVM(boolean jenkinsJVM) Used byWebAppMain.contextInitialized(ServletContextEvent)andWebAppMain.contextDestroyed(ServletContextEvent)to identify the classloader and JVM which startedJenkins
-
Constructor Details
-
JenkinsJVM
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) protected JenkinsJVM()Protect against people instantiating this class.
-
-
Method Details
-
isJenkinsJVM
public static boolean isJenkinsJVM()Identify whether the classloader that loaded this class is the classloader from whichJenkinshas been started.- Returns:
trueif this is the classloader on the JVM that startedJenkinsotherwisefalse
-
checkJenkinsJVM
public static void checkJenkinsJVM()Verify that the classloader that loaded this class is the classloader from whichJenkinshas been started.- Throws:
IllegalStateException- if this is not the classloader on the JVM that startedJenkins.
-
checkNotJenkinsJVM
public static void checkNotJenkinsJVM()Verify that the classloader that loaded this class is not the classloader from whichJenkinshas been started.- Throws:
IllegalStateException- if this is the classloader on the JVM that startedJenkins.
-
setJenkinsJVM
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) protected static void setJenkinsJVM(boolean jenkinsJVM) Used byWebAppMain.contextInitialized(ServletContextEvent)andWebAppMain.contextDestroyed(ServletContextEvent)to identify the classloader and JVM which startedJenkins- Parameters:
jenkinsJVM-trueif and only if this is the classloader and JVM that startedJenkins.
-