Package jenkins.util

Class JenkinsJVM


  • public class JenkinsJVM
    extends Object
    A utility class to identify if the current JVM is the one that is running Jenkins
    Since:
    1.653
    • Constructor Detail

      • JenkinsJVM

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        protected JenkinsJVM()
        Protect against people instantiating this class.
    • Method Detail

      • isJenkinsJVM

        public static boolean isJenkinsJVM()
        Identify whether the classloader that loaded this class is the classloader from which Jenkins has been started.
        Returns:
        true if this is the classloader on the JVM that started Jenkins otherwise false
      • checkJenkinsJVM

        public static void checkJenkinsJVM()
        Verify that the classloader that loaded this class is the classloader from which Jenkins has been started.
        Throws:
        IllegalStateException - if this is not the classloader on the JVM that started Jenkins.
      • checkNotJenkinsJVM

        public static void checkNotJenkinsJVM()
        Verify that the classloader that loaded this class is not the classloader from which Jenkins has been started.
        Throws:
        IllegalStateException - if this is the classloader on the JVM that started Jenkins.