Enum CustomClassLoaderCloseStrategy

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CustomClassLoaderCloseStrategy>

    @API(status=INTERNAL,
         since="1.13")
    public enum CustomClassLoaderCloseStrategy
    extends java.lang.Enum<CustomClassLoaderCloseStrategy>
    Defines the strategy for closing custom class loaders created for test discovery and execution.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CLOSE_AFTER_CALLING_LAUNCHER
      Close the custom class loader after calling the Launcher for test discovery or execution.
      KEEP_OPEN
      Rely on the JVM to release resources held by the custom class loader when it terminates.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void handle​(java.lang.ClassLoader classLoader)
      Handle the class loader according to the strategy.
      static CustomClassLoaderCloseStrategy valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CustomClassLoaderCloseStrategy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • CLOSE_AFTER_CALLING_LAUNCHER

        public static final CustomClassLoaderCloseStrategy CLOSE_AFTER_CALLING_LAUNCHER
        Close the custom class loader after calling the Launcher for test discovery or execution.
      • KEEP_OPEN

        public static final CustomClassLoaderCloseStrategy KEEP_OPEN
        Rely on the JVM to release resources held by the custom class loader when it terminates.

        This mode is only safe to use when calling System.exit(int) afterward.

    • Constructor Detail

      • CustomClassLoaderCloseStrategy

        private CustomClassLoaderCloseStrategy()
    • Method Detail

      • values

        public static CustomClassLoaderCloseStrategy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CustomClassLoaderCloseStrategy c : CustomClassLoaderCloseStrategy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CustomClassLoaderCloseStrategy valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • handle

        public abstract void handle​(java.lang.ClassLoader classLoader)
        Handle the class loader according to the strategy.