You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/02/16 02:57:09 UTC
[cxf] 01/03: CXF-8407: Incorporate changes caused by JEP-396
integration into JDK-16+ (part 3)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 4081beda24e2ea35462a9a34f116e70fd550873f
Author: reta <dr...@gmail.com>
AuthorDate: Wed Feb 10 21:09:37 2021 -0500
CXF-8407: Incorporate changes caused by JEP-396 integration into JDK-16+ (part 3)
(cherry picked from commit 3f3764b5a08dffc6c58c0a69c20851e06ebc2b01)
---
.../org/apache/cxf/workqueue/AutomaticWorkQueueTest.java | 12 +++++++++++-
parent/pom.xml | 2 +-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java b/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
index f40f42c..79060ce 100644
--- a/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
+++ b/core/src/test/java/org/apache/cxf/workqueue/AutomaticWorkQueueTest.java
@@ -20,6 +20,7 @@
package org.apache.cxf.workqueue;
import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
@@ -32,6 +33,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeNoException;
public class AutomaticWorkQueueTest {
@@ -151,11 +153,19 @@ public class AutomaticWorkQueueTest {
}
@Test
public void testEnqueueImmediate() throws InterruptedException {
+ // Check if JDK internals could be accessed, see please:
+ // - https://issues.apache.org/jira/browse/CXF-8407
+ // - https://openjdk.java.net/jeps/396
+ try {
+ ThreadPoolExecutor.class.getDeclaredField("mainLock").setAccessible(true);
+ } catch (final Exception ex) {
+ assumeNoException("The module has no access to JDK internals", ex);
+ }
+
workqueue = new AutomaticWorkQueueImpl(DEFAULT_MAX_QUEUE_SIZE, INITIAL_SIZE,
DEFAULT_HIGH_WATER_MARK,
DEFAULT_LOW_WATER_MARK,
DEFAULT_DEQUEUE_TIMEOUT);
-
Thread.sleep(100L);
// We haven't enqueued anything yet, so should there shouldn't be
diff --git a/parent/pom.xml b/parent/pom.xml
index e7e0956..6a3716b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2381,7 +2381,7 @@
</activation>
<properties>
<!-- EasyMock stills uses JDK Internal APIs: see please https://bugs.openjdk.java.net/browse/JDK-8255363 -->
- <cxf.surefire.fork.vmargs>-ea --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</cxf.surefire.fork.vmargs>
+ <cxf.surefire.fork.vmargs>-ea --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED</cxf.surefire.fork.vmargs>
</properties>
</profile>
</profiles>