Skip to content

Commit

Permalink
[Wisp] solve port issue from JDK8
Browse files Browse the repository at this point in the history
Summary:
Due to some code diff between JDK8 and JDK11, there is an issue:
WEA using in EPollSelectorImpl.java
Before we initialize EPollSelectorImpl, we need to initialize
WispEngine. But this assumption does not hold true in JDK11.

Solution: remove WispEngineAccess dependency in nio when wisp
is disabled.

Test Plan:
cases under java/nio/channels/ and java/net/httpclient
jdk/java/net/httpclient/DigestEchoClient.java
jdk/java/net/httpclient/DigestEchoClientSSL.java
jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java
jdk/java/nio/channels/Selector/LotsOfUpdatesTest.java

Reviewers: 梁希,李卓

Issue: https://aone.alibaba-inc.com/task/22795753

CR: https://code.aone.alibaba-inc.com/xcode/jdk11/codereview/1920546
  • Loading branch information
shiyue.xw authored and Sere-Fu committed Aug 19, 2021
1 parent 8ea43b5 commit 83674d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/java.base/linux/classes/sun/nio/ch/EPollSelectorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private int processEvents(int numEntries, Consumer<SelectionKey> action)
}
}

if (interrupted || WEA.useDirectSelectorWakeup() && status.get() == INTERRUPTED) {
if (interrupted || WispEngine.transparentWispSwitch() && WEA.useDirectSelectorWakeup() && status.get() == INTERRUPTED) {
clearInterrupt();
}

Expand Down Expand Up @@ -269,7 +269,7 @@ public void setEventOps(SelectionKeyImpl ski) {
public Selector wakeup() {
synchronized (interruptLock) {
if (!interruptTriggered) {
if (WEA.useDirectSelectorWakeup()) {
if (WispEngine.transparentWispSwitch() && WEA.useDirectSelectorWakeup()) {
WEA.interruptEpoll(status, INTERRUPTED, fd1);
} else {
try {
Expand All @@ -286,7 +286,7 @@ public Selector wakeup() {

private void clearInterrupt() throws IOException {
synchronized (interruptLock) {
if (WEA.useDirectSelectorWakeup()) {
if (WispEngine.transparentWispSwitch() && WEA.useDirectSelectorWakeup()) {
assert status.get() == INTERRUPTED;
status.lazySet(null);
if (!WEA.isAllThreadAsWisp()) {
Expand Down

0 comments on commit 83674d1

Please sign in to comment.