Enum ExecutorType

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

    public enum ExecutorType
    extends java.lang.Enum<ExecutorType>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AUTO
      Automatically choose the best executor type for the current Java version.
      This will try to use the other types in reverse order and use the first one that is available.
      e.g. if HTTP_CLIENT is available it will be used, otherwise URL_CONNECTION will be used.
      HTTP_CLIENT
      Use the new HttpClient executor which was added in Java 11.
      This implementation is faster than the URLConnection executor and supports HTTP/2.
      Sadly the only supported proxy type is HTTP, SOCKS is not supported.
      URL_CONNECTION
      Use the default URLConnection executor.
      This is the default executor for Java 10 and below.
    • Enum Constant Detail

      • AUTO

        public static final ExecutorType AUTO
        Automatically choose the best executor type for the current Java version.
        This will try to use the other types in reverse order and use the first one that is available.
        e.g. if HTTP_CLIENT is available it will be used, otherwise URL_CONNECTION will be used.
      • URL_CONNECTION

        public static final ExecutorType URL_CONNECTION
        Use the default URLConnection executor.
        This is the default executor for Java 10 and below.
      • HTTP_CLIENT

        public static final ExecutorType HTTP_CLIENT
        Use the new HttpClient executor which was added in Java 11.
        This implementation is faster than the URLConnection executor and supports HTTP/2.
        Sadly the only supported proxy type is HTTP, SOCKS is not supported.
    • Method Detail

      • values

        public static ExecutorType[] 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 (ExecutorType c : ExecutorType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ExecutorType 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
      • isAvailable

        public final boolean isAvailable()
      • init

        protected void init()
                     throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • initExecutor

        protected abstract RequestExecutor initExecutor​(HttpClient client)
                                                 throws java.lang.Throwable
        Throws:
        java.lang.Throwable