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 2023/04/19 21:05:40 UTC

[cxf] branch 3.4.x-fixes updated (49e3c62e53 -> 8402cfa82a)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a change to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


    from 49e3c62e53 Fix JDK-11 API usage (post-merge issue)
     new 932876f601 CXF-8830: Fix org.apache.cxf.transport.http.netty.client.NettyHttpConduitTest.testCallAsyncCallbackInvokedOnlyOnce (#1214)
     new 22ab64130a Fix Apache Maven warning that some plugin dependencies are in wrong scope
     new a86487d6b1 Fix JDK-11 API usage (post-merge issue)
     new a3bf9d39a6 Recording .gitmergeinfo Changes
     new 8402cfa82a  Fix Apache Maven warning that some plugin dependencies are in wrong scope

The 5 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:
 .gitmergeinfo                                      |   1 +
 maven-plugins/corba/pom.xml                        |   2 +-
 maven-plugins/java2swagger-plugin/pom.xml          |   5 +
 maven-plugins/java2wadl-plugin/pom.xml             |   5 +
 parent/pom.xml                                     |  10 ++
 .../hc5/CXFHttpAsyncResponseConsumer.java          |   2 +
 .../http/netty/client/NettyHttpClientHandler.java  |   2 +-
 .../http/netty/client/NettyHttpConduit.java        | 166 ++++++++++++---------
 .../http/netty/client/NettyHttpConduitTest.java    |   3 +
 9 files changed, 127 insertions(+), 69 deletions(-)


[cxf] 05/05: Fix Apache Maven warning that some plugin dependencies are in wrong scope

Posted by re...@apache.org.
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 8402cfa82a95efca3147eab4f448274be2769682
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Apr 19 16:24:36 2023 -0400

     Fix Apache Maven warning that some plugin dependencies are in wrong scope
---
 maven-plugins/corba/pom.xml            |  2 +-
 maven-plugins/java2wadl-plugin/pom.xml |  5 +++++
 parent/pom.xml                         | 10 ++++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/maven-plugins/corba/pom.xml b/maven-plugins/corba/pom.xml
index bddbf45628..41470f2932 100644
--- a/maven-plugins/corba/pom.xml
+++ b/maven-plugins/corba/pom.xml
@@ -58,7 +58,7 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-plugin-api</artifactId>
-            <scope>compile</scope>
+            <scope>provided</scope>
             <exclusions>
                 <exclusion>
                     <groupId>junit</groupId>
diff --git a/maven-plugins/java2wadl-plugin/pom.xml b/maven-plugins/java2wadl-plugin/pom.xml
index 7ae6f9a3c3..74d9adabdf 100644
--- a/maven-plugins/java2wadl-plugin/pom.xml
+++ b/maven-plugins/java2wadl-plugin/pom.xml
@@ -57,6 +57,7 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-compat</artifactId>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.maven</groupId>
@@ -104,6 +105,10 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
             <exclusions>
+                <exclusion>
+                    <groupId>org.apache.maven</groupId>
+                    <artifactId>maven-model</artifactId>
+                </exclusion>
                 <exclusion>
                     <groupId>org.apache.maven</groupId>
                     <artifactId>maven-project</artifactId>
diff --git a/parent/pom.xml b/parent/pom.xml
index cb17850f23..512fc9584b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -867,6 +867,10 @@
                         <groupId>javax.enterprise</groupId>
                         <artifactId>cdi-api</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>javax.annotation</groupId>
+                        <artifactId>javax.annotation-api</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
             <dependency>
@@ -991,6 +995,12 @@
                 <artifactId>maven-core</artifactId>
                 <scope>provided</scope>
                 <version>${cxf.maven.core.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>javax.annotation</groupId>
+                        <artifactId>javax.annotation-api</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>


[cxf] 04/05: Recording .gitmergeinfo Changes

Posted by re...@apache.org.
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 a3bf9d39a690ad4a0a27552a61f8ba4c0f5674f1
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Apr 19 16:15:56 2023 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 4fc11b6808..74c4807684 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -203,6 +203,7 @@ B b913b8d366af27a07d5c9cb80f10bf7fbf0ee5f2
 B bad8f7cfb19b041e71875e45408902f616e691b2
 B bbfd114ccc7bdbe9c09f1048a8fac13ece19d61e
 B bcde2712f577c400c03d6acf8c33877510505e0e
+B bde0fc203909b7a79058dbbd82116f69ec06a938
 B beebba09bcd47f8905edb34d3170dc92cfa4db67
 B bfd64d8112f211ed3c2409d8b1b04355ce75c8bc
 B c035185add363a99fbacbeb8970dab1a7833c054


[cxf] 02/05: Fix Apache Maven warning that some plugin dependencies are in wrong scope

Posted by re...@apache.org.
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 22ab64130a182499dcf5c33bdecac77c1adbe3d8
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Apr 19 09:31:03 2023 -0400

    Fix Apache Maven warning that some plugin dependencies are in wrong scope
    
    (cherry picked from commit f336f9ba21884e5ff94cce40d4bebf9c71e11ed8)
    (cherry picked from commit 88317d28fae6ee167e33f9ec4563d7229d27af1a)
---
 maven-plugins/java2swagger-plugin/pom.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/maven-plugins/java2swagger-plugin/pom.xml b/maven-plugins/java2swagger-plugin/pom.xml
index 674e1d8e46..ef1e194426 100644
--- a/maven-plugins/java2swagger-plugin/pom.xml
+++ b/maven-plugins/java2swagger-plugin/pom.xml
@@ -62,6 +62,7 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-compat</artifactId>
+            <scope>provided</scope>
             <exclusions>
                 <exclusion>
                     <groupId>org.sonatype.sisu</groupId>
@@ -115,6 +116,10 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
             <exclusions>
+                <exclusion>
+                    <groupId>org.apache.maven</groupId>
+                    <artifactId>maven-model</artifactId>
+                </exclusion>
                 <exclusion>
                     <groupId>org.apache.maven</groupId>
                     <artifactId>maven-project</artifactId>


[cxf] 03/05: Fix JDK-11 API usage (post-merge issue)

Posted by re...@apache.org.
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 a86487d6b1803389e60a4ba93d4e3f2ba7537945
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Apr 19 13:51:00 2023 -0400

    Fix JDK-11 API usage (post-merge issue)
    
    (cherry picked from commit 2f62c5d62fe6eae1a1bda1741e8be0e0a6b88628)
---
 .../transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
index 5808de4870..f59b566b33 100644
--- a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
+++ b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
@@ -83,7 +83,7 @@ public class CXFHttpAsyncResponseConsumer implements AsyncResponseConsumer<Boole
                 break;
             }
 
-            Thread.onSpinWait();
+            Thread.yield();
         }
     }
 


[cxf] 01/05: CXF-8830: Fix org.apache.cxf.transport.http.netty.client.NettyHttpConduitTest.testCallAsyncCallbackInvokedOnlyOnce (#1214)

Posted by re...@apache.org.
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 932876f601ce92d98c009b7fc0f980a8dfc19a13
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Wed Apr 19 07:59:29 2023 -0400

    CXF-8830: Fix org.apache.cxf.transport.http.netty.client.NettyHttpConduitTest.testCallAsyncCallbackInvokedOnlyOnce (#1214)
    
    (cherry picked from commit 9cb9eb0cfc3c6628793129c7660e0e6de557c963)
    (cherry picked from commit 362d16cc0d71445521e319126845a0943cff7447)
    (cherry picked from commit 0a72fb59a9b55695aff172228c7d2eb1eca7d7cf)
---
 .../hc5/CXFHttpAsyncResponseConsumer.java          |   2 +
 .../http/netty/client/NettyHttpClientHandler.java  |   2 +-
 .../http/netty/client/NettyHttpConduit.java        | 166 ++++++++++++---------
 .../http/netty/client/NettyHttpConduitTest.java    |   3 +
 4 files changed, 105 insertions(+), 68 deletions(-)

diff --git a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
index d8851635ba..5808de4870 100644
--- a/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
+++ b/rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/CXFHttpAsyncResponseConsumer.java
@@ -82,6 +82,8 @@ public class CXFHttpAsyncResponseConsumer implements AsyncResponseConsumer<Boole
                 buf.consumeContent(src, completed);
                 break;
             }
+
+            Thread.onSpinWait();
         }
     }
 
diff --git a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpClientHandler.java b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpClientHandler.java
index 1a357b42fa..e92117b3c5 100644
--- a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpClientHandler.java
+++ b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpClientHandler.java
@@ -62,7 +62,7 @@ public class NettyHttpClientHandler extends ChannelDuplexHandler {
         if (msg instanceof NettyHttpClientRequest) {
             NettyHttpClientRequest request = (NettyHttpClientRequest)msg;
             sendedQueue.put(request);
-            ctx.writeAndFlush(request.getRequest());
+            ctx.writeAndFlush(request.getRequest(), promise);
         } else {
             super.write(ctx, msg, promise);
         }
diff --git a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
index cd358d4314..de94af8ddf 100644
--- a/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
+++ b/rt/transports/http-netty/netty-client/src/main/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduit.java
@@ -37,6 +37,10 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Level;
 
 import javax.net.ssl.HostnameVerifier;
@@ -222,6 +226,10 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
         ByteBuf outBuffer;
         OutputStream outputStream;
 
+        final Lock syncLock = new ReentrantLock();
+        final Condition connected = syncLock.newCondition();
+        final Condition responded = syncLock.newCondition();
+
         protected NettyWrappedOutputStream(Message message, boolean possibleRetransmit,
                                            boolean isChunking, int chunkThreshold, String conduitName, URI url) {
             super(message, possibleRetransmit, isChunking, chunkThreshold, conduitName, url);
@@ -237,31 +245,36 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
         }
 
 
-        protected synchronized HttpResponse getHttpResponse() throws IOException {
-            while (httpResponse == null) {
-                if (exception == null) { //already have an exception, skip waiting
-                    try {
-                        wait(entity.getReceiveTimeout());
-                    } catch (InterruptedException e) {
-                        throw new IOException(e);
-                    }
-                }
-                if (httpResponse == null) {
-
-                    if (exception != null) {
-                        if (exception instanceof IOException) {
-                            throw (IOException)exception;
+        protected HttpResponse getHttpResponse() throws IOException {
+            syncLock.lock();
+            try {
+                while (httpResponse == null) {
+                    if (exception == null) { //already have an exception, skip waiting
+                        try {
+                            responded.await(entity.getReceiveTimeout(), TimeUnit.MILLISECONDS);
+                        } catch (InterruptedException e) {
+                            throw new IOException(e);
                         }
-                        if (exception instanceof RuntimeException) {
-                            throw (RuntimeException)exception;
+                    }
+                    if (httpResponse == null) {
+    
+                        if (exception != null) {
+                            if (exception instanceof IOException) {
+                                throw (IOException)exception;
+                            }
+                            if (exception instanceof RuntimeException) {
+                                throw (RuntimeException)exception;
+                            }
+                            throw new IOException(exception);
                         }
-                        throw new IOException(exception);
+    
+                        throw new SocketTimeoutException("Read Timeout");
                     }
-
-                    throw new SocketTimeoutException("Read Timeout");
                 }
+                return httpResponse;
+            } finally {
+                syncLock.unlock();
             }
-            return httpResponse;
         }
 
         protected HttpContent getHttpResponseContent() throws IOException {
@@ -269,33 +282,37 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
         }
 
 
-        protected synchronized Channel getChannel() throws IOException {
-            while (channel == null) {
-                if (exception == null) { //already have an exception, skip waiting
-                    try {
-                        // connection timeout
-                        wait(entity.getConnectionTimeout());
-                    } catch (InterruptedException e) {
-                        throw new IOException(e);
-                    }
-                }
-                if (channel == null) {
-
-                    if (exception != null) {
-                        if (exception instanceof IOException) {
-                            throw (IOException)exception;
+        protected Channel getChannel() throws IOException {
+            syncLock.lock();
+            try {
+                while (channel == null) {
+                    if (exception == null) { //already have an exception, skip waiting
+                        try {
+                            // connection timeout
+                            connected.await(entity.getConnectionTimeout(), TimeUnit.MILLISECONDS);
+                        } catch (InterruptedException e) {
+                            throw new IOException(e);
                         }
-                        if (exception instanceof RuntimeException) {
-                            throw (RuntimeException)exception;
+                    }
+                    if (channel == null) {
+    
+                        if (exception != null) {
+                            if (exception instanceof IOException) {
+                                throw (IOException)exception;
+                            }
+                            if (exception instanceof RuntimeException) {
+                                throw (RuntimeException)exception;
+                            }
+                            throw new IOException(exception);
                         }
-                        throw new IOException(exception);
+    
+                        throw new SocketTimeoutException("Connection Timeout");
                     }
-
-                    throw new SocketTimeoutException("Connection Timeout");
                 }
+                return channel;
+            } finally {
+                syncLock.unlock();
             }
-            return channel;
-
         }
 
 
@@ -655,37 +672,52 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
             //entity.getRequest().setChunked(true);
         }
 
-        protected synchronized void setHttpResponse(HttpResponse r) {
-            httpResponse = r;
-            if (isAsync) {
-                //got a response, need to start the response processing now
-                try {
-                    handleResponseOnWorkqueue(false, true);
-                    isAsync = false; // don't trigger another start on next block. :-)
-                } catch (Exception ex) {
-                    //ignore, we'll try again on the next consume;
+        protected void setHttpResponse(HttpResponse r) {
+            syncLock.lock();
+            try {
+                httpResponse = r;
+                if (isAsync) {
+                    //got a response, need to start the response processing now
+                    try {
+                        handleResponseOnWorkqueue(false, true);
+                        isAsync = false; // don't trigger another start on next block. :-)
+                    } catch (Exception ex) {
+                        //ignore, we'll try again on the next consume;
+                    }
                 }
+                responded.signalAll();
+            } finally {
+                syncLock.unlock();
             }
-            notifyAll();
-        }
-
-        protected synchronized void setException(Throwable ex) {
-            exception = ex;
-            if (isAsync) {
-                //got a response, need to start the response processing now
-                try {
-                    handleResponseOnWorkqueue(false, true);
-                    isAsync = false; // don't trigger another start on next block. :-)
-                } catch (Exception ex2) {
-                    ex2.printStackTrace();
+        }
+
+        protected void setException(Throwable ex) {
+            syncLock.lock();
+            try {
+                exception = ex;
+                if (isAsync) {
+                    //got a response, need to start the response processing now
+                    try {
+                        handleResponseOnWorkqueue(false, true);
+                        isAsync = false; // don't trigger another start on next block. :-)
+                    } catch (Exception ex2) {
+                        ex2.printStackTrace();
+                    }
                 }
+                responded.signalAll();
+            } finally {
+                syncLock.unlock();
             }
-            notifyAll();
         }
 
-        protected synchronized void setChannel(Channel ch) {
-            channel = ch;
-            notifyAll();
+        protected void setChannel(Channel ch) {
+            syncLock.lock();
+            try {
+                channel = ch;
+                connected.signalAll();
+            } finally {
+                syncLock.unlock();
+            }
         }
     }
 
diff --git a/rt/transports/http-netty/netty-client/src/test/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitTest.java b/rt/transports/http-netty/netty-client/src/test/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitTest.java
index 7077842312..1ef3e1c515 100644
--- a/rt/transports/http-netty/netty-client/src/test/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitTest.java
+++ b/rt/transports/http-netty/netty-client/src/test/java/org/apache/cxf/transport/http/netty/client/NettyHttpConduitTest.java
@@ -22,7 +22,9 @@ package org.apache.cxf.transport.http.netty.client;
 import java.net.URL;
 import java.util.Collections;
 import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.LockSupport;
 
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Endpoint;
@@ -89,6 +91,7 @@ public class NettyHttpConduitTest extends AbstractBusClientServerTestBase {
                     return "Hello, finally! " + cnt;
                 }
                 public String greetMe(String me) {
+                    LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10L));
                     if (me.equals(FILL_BUFFER)) {
                         return String.join("", Collections.nCopies(16093, " "));
                     } else {