You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/07/29 20:17:52 UTC
(commons-jxpath) branch master updated (c53f325 -> 0eac847)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git
from c53f325 Merge pull request #251 from Dima1224/value-utils-concurrent-access-fix
new 4349218 Use final
new 0eac847 Make dynamicPropertyHandlerMap in ValueUtils thread-safe #251
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/changes/changes.xml | 1 +
.../apache/commons/jxpath/util/ValueUtilsTest.java | 74 +++++++++++-----------
2 files changed, 38 insertions(+), 37 deletions(-)
(commons-jxpath) 01/02: Use final
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git
commit 4349218887b5d504ff152040b1d8ddd4cd3e8c42
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 29 16:16:40 2025 -0400
Use final
---
.../apache/commons/jxpath/util/ValueUtilsTest.java | 74 +++++++++++-----------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/src/test/java/org/apache/commons/jxpath/util/ValueUtilsTest.java b/src/test/java/org/apache/commons/jxpath/util/ValueUtilsTest.java
index b97c9ef..f8afad8 100644
--- a/src/test/java/org/apache/commons/jxpath/util/ValueUtilsTest.java
+++ b/src/test/java/org/apache/commons/jxpath/util/ValueUtilsTest.java
@@ -37,6 +37,43 @@ import org.junit.jupiter.api.Test;
class ValueUtilsTest {
+ public static class DummyHandler implements DynamicPropertyHandler {
+
+ @Override
+ public Object getProperty(final Object object, final String propertyName) {
+ return null;
+ }
+
+ @Override
+ public String[] getPropertyNames(final Object object) {
+ return new String[0];
+ }
+
+ @Override
+ public void setProperty(final Object object, final String propertyName, final Object value) {
+
+ }
+ }
+
+ @Test
+ void testGetDynamicPropertyHandlerConcurrently() throws InterruptedException, ExecutionException {
+ // This test ensures that ValueUtils::getDynamicPropertyHandler can be accessed concurrently
+ // It does not assert any specific behavior, but rather ensures that no exceptions are thrown on concurrent access
+ final int nThreads = 200; // Number of threads to simulate concurrent access
+ final List<Future<?>> futures = new ArrayList<>();
+ final ExecutorService threadPool = Executors.newFixedThreadPool(nThreads);
+ for (int i = 0; i < nThreads; i++) {
+ futures.add(threadPool.submit(() -> ValueUtils.getDynamicPropertyHandler(DummyHandler.class)));
+ }
+
+ threadPool.shutdown();
+ threadPool.awaitTermination(1, TimeUnit.SECONDS);
+
+ for (final Future<?> future : futures) {
+ future.get(); // This will throw if any thread threw
+ }
+ }
+
@Test
void testGetValueFromArray() {
final Object data = new Object();
@@ -95,41 +132,4 @@ class ValueUtilsTest {
void testGetValueFromSetTooSmall() {
assertNull(ValueUtils.getValue(Collections.EMPTY_SET, 2));
}
-
- @Test
- void testGetDynamicPropertyHandlerConcurrently() throws InterruptedException, ExecutionException {
- // This test ensures that ValueUtils::getDynamicPropertyHandler can be accessed concurrently
- // It does not assert any specific behavior, but rather ensures that no exceptions are thrown on concurrent access
- int nThreads = 200; // Number of threads to simulate concurrent access
- List<Future<?>> futures = new ArrayList<>();
- ExecutorService threadPool = Executors.newFixedThreadPool(nThreads);
- for (int i = 0; i < nThreads; i++) {
- futures.add(threadPool.submit(() -> ValueUtils.getDynamicPropertyHandler(DummyHandler.class)));
- }
-
- threadPool.shutdown();
- threadPool.awaitTermination(1, TimeUnit.SECONDS);
-
- for (Future<?> future : futures) {
- future.get(); // This will throw if any thread threw
- }
- }
-
- public static class DummyHandler implements DynamicPropertyHandler {
-
- @Override
- public Object getProperty(Object object, String propertyName) {
- return null;
- }
-
- @Override
- public String[] getPropertyNames(Object object) {
- return new String[0];
- }
-
- @Override
- public void setProperty(Object object, String propertyName, Object value) {
-
- }
- }
}
(commons-jxpath) 02/02: Make dynamicPropertyHandlerMap in ValueUtils thread-safe #251
Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jxpath.git
commit 0eac847bed04883437c9252ee79c40e354188ed6
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Tue Jul 29 16:17:46 2025 -0400
Make dynamicPropertyHandlerMap in ValueUtils thread-safe #251
---
src/changes/changes.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 31bd19b..69becc1 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,7 @@ The <action> type attribute can be add,update,fix,remove.
<release version="1.4.1" date="YYYY-MM-DD" description="This is a maintenance release. Java 8 or later is required.">
<!-- FIX -->
<action type="fix" dev="ggregory" due-to="Gary Gregory">POM assembly:single does not generate binary convenience files (tar/zip).</action>
+ <action type="fix" dev="ggregory" due-to="Dima1224, Gary Gregory">Make dynamicPropertyHandlerMap in ValueUtils thread-safe #251.</action>
<!-- ADD -->
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">Bump org.apache.commons:commons-parent from 81 to 85 #239.</action>