This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 3f3764b CXF-8407: Incorporate changes caused by JEP-396 integration
into JDK-16+ (part 3)
3f3764b is described below
commit 3f3764b5a08dffc6c58c0a69c20851e06ebc2b01
Author: reta <[email protected]>
AuthorDate: Wed Feb 10 21:09:37 2021 -0500
CXF-8407: Incorporate changes caused by JEP-396 integration into JDK-16+
(part 3)
---
.../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 b78c8e2..1800d00 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2383,7 +2383,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>