Home / Class/ OpenSslParametersUtil Class — netty Architecture

OpenSslParametersUtil Class — netty Architecture

Architecture documentation for the OpenSslParametersUtil class in OpenSslParametersUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  5c8c564e_0b08_292c_d30d_4e6623e5aed4["OpenSslParametersUtil"]
  2e7cd3bd_b5e2_0d4f_2a06_f34d7193743b["OpenSslParametersUtil.java"]
  5c8c564e_0b08_292c_d30d_4e6623e5aed4 -->|defined in| 2e7cd3bd_b5e2_0d4f_2a06_f34d7193743b
  3e485ca0_3749_a306_3b1f_5d067c3c156f["MethodHandle()"]
  5c8c564e_0b08_292c_d30d_4e6623e5aed4 -->|method| 3e485ca0_3749_a306_3b1f_5d067c3c156f
  ce141b1a_7658_9688_3afd_75201b05d68d["getNamesGroups()"]
  5c8c564e_0b08_292c_d30d_4e6623e5aed4 -->|method| ce141b1a_7658_9688_3afd_75201b05d68d
  c2e0eebf_f7d4_fe24_32dc_4eb846726366["setNamesGroups()"]
  5c8c564e_0b08_292c_d30d_4e6623e5aed4 -->|method| c2e0eebf_f7d4_fe24_32dc_4eb846726366
  b3600a1f_0dfb_9a00_8563_bcb32458ff1c["OpenSslParametersUtil()"]
  5c8c564e_0b08_292c_d30d_4e6623e5aed4 -->|method| b3600a1f_0dfb_9a00_8563_bcb32458ff1c

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/OpenSslParametersUtil.java lines 27–83

final class OpenSslParametersUtil {

    private static final MethodHandle GET_NAMED_GROUPS;
    private static final MethodHandle SET_NAMED_GROUPS;

    static {
        MethodHandle getNamedGroups = null;
        MethodHandle setNamedGroups = null;
        if (PlatformDependent.javaVersion() >= 20) {
            final MethodHandles.Lookup lookup = MethodHandles.lookup();
            getNamedGroups = obtainHandle(lookup, "getNamedGroups",
                    MethodType.methodType(String[].class));
            setNamedGroups = obtainHandle(lookup, "setNamedGroups",
                    MethodType.methodType(void.class, String[].class));
        }
        GET_NAMED_GROUPS = getNamedGroups;
        SET_NAMED_GROUPS = setNamedGroups;
    }

    private static MethodHandle obtainHandle(final MethodHandles.Lookup lookup,
                                             final String methodName, final MethodType type) {
        return AccessController.doPrivileged((PrivilegedAction<MethodHandle>) () -> {
            try {
                return lookup.findVirtual(SSLParameters.class, methodName, type);
            } catch (UnsupportedOperationException | SecurityException |
                     NoSuchMethodException | IllegalAccessException e) {
                // Just ignore it.
                return null;
            }
        });
    }

    static String[] getNamesGroups(SSLParameters parameters) {
        if (GET_NAMED_GROUPS == null) {
            return null;
        }
        try {
            return (String[]) GET_NAMED_GROUPS.invoke(parameters);
        } catch (Throwable t) {
            // Just ignore it.
            return null;
        }
    }

    static void setNamesGroups(SSLParameters parameters, String[] names) {
        if (SET_NAMED_GROUPS == null) {
            return;
        }
        try {
            SET_NAMED_GROUPS.invoke(parameters, names);
        } catch (Throwable ignore) {
            // Ignore
        }
    }

    private OpenSslParametersUtil() { }
}

Frequently Asked Questions

What is the OpenSslParametersUtil class?
OpenSslParametersUtil is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/OpenSslParametersUtil.java.
Where is OpenSslParametersUtil defined?
OpenSslParametersUtil is defined in handler/src/main/java/io/netty/handler/ssl/OpenSslParametersUtil.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free