MCPcopy Create free account
hub / github.com/grpc/grpc-java / loadEpollInfo

Method loadEpollInfo

netty/src/main/java/io/grpc/netty/TcpMetrics.java:67–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65 }
66
67 static EpollInfo loadEpollInfo() {
68 boolean epollAvailable = false;
69 try {
70 Class<?> epollClass = Class.forName("io.netty.channel.epoll.Epoll");
71 Method isAvailableMethod = epollClass.getDeclaredMethod("isAvailable");
72 epollAvailable = (Boolean) isAvailableMethod.invoke(null);
73 if (epollAvailable) {
74 Class<?> channelClass = Class.forName("io.netty.channel.epoll.EpollSocketChannel");
75 Class<?> infoClass = Class.forName("io.netty.channel.epoll.EpollTcpInfo");
76 return new EpollInfo(
77 channelClass,
78 infoClass.getDeclaredConstructor(),
79 channelClass.getMethod("tcpInfo", infoClass),
80 infoClass.getMethod("totalRetrans"),
81 infoClass.getMethod("retrans"),
82 infoClass.getMethod("rtt"));
83 }
84 } catch (ReflectiveOperationException e) {
85 log.log(Level.FINE, "Failed to initialize Epoll tcp_info reflection", e);
86 } finally {
87 log.log(Level.INFO, "Epoll available during static init of TcpMetrics:"
88 + "{0}", epollAvailable);
89 }
90 return null;
91 }
92
93 private static final long RECORD_INTERVAL_MILLIS = TimeUnit.MINUTES.toMillis(5);
94 private final MetricRecorder metricRecorder;

Callers 2

tearDownMethod · 0.95
TcpMetricsClass · 0.95

Calls 4

invokeMethod · 0.65
forNameMethod · 0.45
getMethodMethod · 0.45
logMethod · 0.45

Tested by 1

tearDownMethod · 0.76