Skip to content

Commit

Permalink
Use pattern for the field name when checking the classpath (#2411)
Browse files Browse the repository at this point in the history
In preparation for better GraalVM support
  • Loading branch information
violetagg committed Jul 29, 2022
1 parent ff3a27d commit 911d0b6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2011-2022 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -103,7 +103,7 @@ public boolean supportGroup(EventLoopGroup group) {

static final Logger log = Loggers.getLogger(DefaultLoopEpoll.class);

static final boolean epoll;
static final boolean isEpollAvailable;

static {
boolean epollCheck = false;
Expand All @@ -114,9 +114,9 @@ public boolean supportGroup(EventLoopGroup group) {
catch (ClassNotFoundException cnfe) {
// noop
}
epoll = epollCheck;
isEpollAvailable = epollCheck;
if (log.isDebugEnabled()) {
log.debug("Default Epoll support : " + epoll);
log.debug("Default Epoll support : " + isEpollAvailable);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2020-2022 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -87,7 +87,7 @@ public boolean supportGroup(EventLoopGroup group) {

static final Logger log = Loggers.getLogger(DefaultLoopIOUring.class);

static final boolean ioUring;
static final boolean isIoUringAvailable;

static {
boolean ioUringCheck = false;
Expand All @@ -98,9 +98,9 @@ public boolean supportGroup(EventLoopGroup group) {
catch (ClassNotFoundException cnfe) {
// noop
}
ioUring = ioUringCheck;
isIoUringAvailable = ioUringCheck;
if (log.isDebugEnabled()) {
log.debug("Default io_uring support : " + ioUring);
log.debug("Default io_uring support : " + isIoUringAvailable);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2018-2022 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -102,7 +102,7 @@ public boolean supportGroup(EventLoopGroup group) {

static final Logger log = Loggers.getLogger(DefaultLoopKQueue.class);

static final boolean kqueue;
static final boolean isKqueueAvailable;

static {
boolean kqueueCheck = false;
Expand All @@ -113,9 +113,9 @@ public boolean supportGroup(EventLoopGroup group) {
catch (ClassNotFoundException cnfe) {
// noop
}
kqueue = kqueueCheck;
isKqueueAvailable = kqueueCheck;
if (log.isDebugEnabled()) {
log.debug("Default KQueue support : " + kqueue);
log.debug("Default KQueue support : " + isKqueueAvailable);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2018-2022 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,13 +29,13 @@ final class DefaultLoopNativeDetector {
static {
NIO = new DefaultLoopNIO();

if (DefaultLoopIOUring.ioUring) {
if (DefaultLoopIOUring.isIoUringAvailable) {
INSTANCE = new DefaultLoopIOUring();
}
else if (DefaultLoopEpoll.epoll) {
else if (DefaultLoopEpoll.isEpollAvailable) {
INSTANCE = new DefaultLoopEpoll();
}
else if (DefaultLoopKQueue.kqueue) {
else if (DefaultLoopKQueue.isKqueueAvailable) {
INSTANCE = new DefaultLoopKQueue();
}
else {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021 VMware, Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2019-2022 VMware, Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,7 +37,7 @@ final class HAProxyMessageReader extends ChannelInboundHandlerAdapter {
private static final AttributeKey<InetSocketAddress> REMOTE_ADDRESS_FROM_PROXY_PROTOCOL =
AttributeKey.valueOf("remoteAddressFromProxyProtocol");

private static final boolean hasProxyProtocol;
private static final boolean isProxyProtocolAvailable;

static {
boolean proxyProtocolCheck = true;
Expand All @@ -47,16 +47,16 @@ final class HAProxyMessageReader extends ChannelInboundHandlerAdapter {
catch (ClassNotFoundException cnfe) {
proxyProtocolCheck = false;
}
hasProxyProtocol = proxyProtocolCheck;
isProxyProtocolAvailable = proxyProtocolCheck;
}

static boolean hasProxyProtocol() {
return hasProxyProtocol;
static boolean isProxyProtocolAvailable() {
return isProxyProtocolAvailable;
}

@Nullable
static SocketAddress resolveRemoteAddressFromProxyProtocol(Channel channel) {
if (HAProxyMessageReader.hasProxyProtocol()) {
if (HAProxyMessageReader.isProxyProtocolAvailable()) {
return channel.attr(REMOTE_ADDRESS_FROM_PROXY_PROTOCOL).getAndSet(null);
}

Expand Down
Expand Up @@ -689,7 +689,7 @@ public final HttpServer proxyProtocol(ProxyProtocolSupportType proxyProtocolSupp
}
if (proxyProtocolSupportType == ProxyProtocolSupportType.ON ||
proxyProtocolSupportType == ProxyProtocolSupportType.AUTO) {
if (!HAProxyMessageReader.hasProxyProtocol()) {
if (!HAProxyMessageReader.isProxyProtocolAvailable()) {
throw new UnsupportedOperationException(
"To enable proxyProtocol, you must add the dependency `io.netty:netty-codec-haproxy`" +
" to the class path first");
Expand Down

0 comments on commit 911d0b6

Please sign in to comment.