Home / Class/ NioDomainSocketUtil Class — netty Architecture

NioDomainSocketUtil Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  a63434b2_8add_f5fd_79a6_29feedc3e4f7["NioDomainSocketUtil"]
  8e2b467a_09dc_5fb9_b54d_70081404c4be["NioDomainSocketUtil.java"]
  a63434b2_8add_f5fd_79a6_29feedc3e4f7 -->|defined in| 8e2b467a_09dc_5fb9_b54d_70081404c4be
  f0b5c212_7866_6e57_fe39_d8a19c1f2f02["SocketAddress()"]
  a63434b2_8add_f5fd_79a6_29feedc3e4f7 -->|method| f0b5c212_7866_6e57_fe39_d8a19c1f2f02
  0fa49c38_e9a3_d9bf_1b20_bfc3660124f6["deleteSocketFile()"]
  a63434b2_8add_f5fd_79a6_29feedc3e4f7 -->|method| 0fa49c38_e9a3_d9bf_1b20_bfc3660124f6
  75bd0e30_da18_d4af_b807_796523fbd792["NioDomainSocketUtil()"]
  a63434b2_8add_f5fd_79a6_29feedc3e4f7 -->|method| 75bd0e30_da18_d4af_b807_796523fbd792

Relationship Graph

Source Code

transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketUtil.java lines 23–70

final class NioDomainSocketUtil {

    private static final Method OF_METHOD;
    private static final Method GET_PATH_METHOD;

    static {
        Method ofMethod;
        Method getPathMethod;
        try {
            Class<?> clazz = Class.forName("java.net.UnixDomainSocketAddress");
            ofMethod = clazz.getMethod("of", String.class);
            getPathMethod = clazz.getMethod("getPath");

        } catch (Throwable error) {
            ofMethod = null;
            getPathMethod = null;
        }
        OF_METHOD = ofMethod;
        GET_PATH_METHOD = getPathMethod;
    }

    static SocketAddress newUnixDomainSocketAddress(String path) {
        if (OF_METHOD == null) {
            throw new IllegalStateException();
        }
        try {
            return (SocketAddress) OF_METHOD.invoke(null, path);
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new IllegalStateException(e);
        }
    }

    static void deleteSocketFile(SocketAddress address) {
        if (GET_PATH_METHOD == null) {
            throw new IllegalStateException();
        }
        try {
            Path path = (Path) GET_PATH_METHOD.invoke(address);
            if (path != null) {
                path.toFile().delete();
            }
        } catch (IllegalAccessException | InvocationTargetException e) {
            throw new IllegalStateException(e);
        }
    }

    private NioDomainSocketUtil() { }
}

Frequently Asked Questions

What is the NioDomainSocketUtil class?
NioDomainSocketUtil is a class in the netty codebase, defined in transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketUtil.java.
Where is NioDomainSocketUtil defined?
NioDomainSocketUtil is defined in transport/src/main/java/io/netty/channel/socket/nio/NioDomainSocketUtil.java at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free