Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pattern for the field name when checking the classpath #2411

Merged
merged 1 commit into from Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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