KQueue Class — netty Architecture
Architecture documentation for the KQueue class in KQueue.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 98c5de2e_e010_8fd9_d8a9_b668471ae568["KQueue"] 40c42890_129c_dc6d_349e_e42fbe22de5a["KQueue.java"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|defined in| 40c42890_129c_dc6d_349e_e42fbe22de5a f0cd3d7b_ce20_be51_9c51_95c36c8ea583["isAvailable()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| f0cd3d7b_ce20_be51_9c51_95c36c8ea583 51c3c902_9df4_e30a_2194_652f6562036b["ensureAvailability()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| 51c3c902_9df4_e30a_2194_652f6562036b c8cd5f22_9e7a_b9b9_7a63_41b857a4f1c2["Throwable()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| c8cd5f22_9e7a_b9b9_7a63_41b857a4f1c2 cd416efa_211f_4640_7781_5fbfa4b2f163["isTcpFastOpenClientSideAvailable()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| cd416efa_211f_4640_7781_5fbfa4b2f163 ba24cd55_040f_9384_ca33_890e3517102a["isTcpFastOpenServerSideAvailable()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| ba24cd55_040f_9384_ca33_890e3517102a 97118aae_f602_b712_e744_c6bfe575d042["KQueue()"] 98c5de2e_e010_8fd9_d8a9_b668471ae568 -->|method| 97118aae_f602_b712_e744_c6bfe575d042
Relationship Graph
Source Code
transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/KQueue.java lines 27–115
public final class KQueue {
private static final Throwable UNAVAILABILITY_CAUSE;
static {
Throwable cause = null;
if (SystemPropertyUtil.getBoolean("io.netty.transport.noNative", false)) {
cause = new UnsupportedOperationException(
"Native transport was explicit disabled with -Dio.netty.transport.noNative=true");
} else {
FileDescriptor kqueueFd = null;
try {
kqueueFd = Native.newKQueue();
} catch (Throwable t) {
cause = t;
} finally {
if (kqueueFd != null) {
try {
kqueueFd.close();
} catch (Exception ignore) {
// ignore
}
}
}
}
if (cause != null) {
InternalLogger logger = InternalLoggerFactory.getInstance(KQueue.class);
if (logger.isTraceEnabled()) {
logger.debug("KQueue support is not available", cause);
} else if (logger.isDebugEnabled()) {
logger.debug("KQueue support is not available: {}", cause.getMessage());
}
}
UNAVAILABILITY_CAUSE = cause;
}
/**
* Returns {@code true} if and only if the <a href="https://netty.io/wiki/native-transports.html">{@code
* netty-transport-native-kqueue}</a> is available.
*/
public static boolean isAvailable() {
return UNAVAILABILITY_CAUSE == null;
}
/**
* Ensure that <a href="https://netty.io/wiki/native-transports.html">{@code netty-transport-native-kqueue}</a> is
* available.
*
* @throws UnsatisfiedLinkError if unavailable
*/
public static void ensureAvailability() {
if (UNAVAILABILITY_CAUSE != null) {
throw (Error) new UnsatisfiedLinkError(
"failed to load the required native library").initCause(UNAVAILABILITY_CAUSE);
}
}
/**
* Returns the cause of unavailability of <a href="https://netty.io/wiki/native-transports.html">{@code
* netty-transport-native-kqueue}</a>.
*
* @return the cause if unavailable. {@code null} if available.
*/
public static Throwable unavailabilityCause() {
return UNAVAILABILITY_CAUSE;
}
/**
* Returns {@code true} if the kqueue native transport is both {@linkplain #isAvailable() available} and supports
* {@linkplain ChannelOption#TCP_FASTOPEN_CONNECT client-side TCP FastOpen}.
*
* @return {@code true} if it's possible to use client-side TCP FastOpen via kqueue, otherwise {@code false}.
*/
public static boolean isTcpFastOpenClientSideAvailable() {
return isAvailable() && Native.IS_SUPPORTING_TCP_FASTOPEN_CLIENT;
}
/**
* Returns {@code true} if the kqueue native transport is both {@linkplain #isAvailable() available} and supports
* {@linkplain ChannelOption#TCP_FASTOPEN server-side TCP FastOpen}.
*
* @return {@code true} if it's possible to use server-side TCP FastOpen via kqueue, otherwise {@code false}.
Source
Frequently Asked Questions
What is the KQueue class?
KQueue is a class in the netty codebase, defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/KQueue.java.
Where is KQueue defined?
KQueue is defined in transport-classes-kqueue/src/main/java/io/netty/channel/kqueue/KQueue.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free