[cxf] branch 3.2.x-fixes updated: CXF-8282: Set read timeout using netty client. Fixing failing test cases

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch 3.2.x-fixes updated: CXF-8282: Set read timeout using netty client. Fixing failing test cases

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

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


The following commit(s) were added to refs/heads/3.2.x-fixes by this push:
     new 184166a  CXF-8282: Set read timeout using netty client. Fixing failing test cases
184166a is described below

commit 184166a8f335a3d8d727c878bebe4f39cd4a9ff7
Author: reta <[hidden email]>
AuthorDate: Mon May 18 15:43:22 2020 -0400

    CXF-8282: Set read timeout using netty client. Fixing failing test cases
---
 .../cxf/transport/http/netty/client/NettyHttpConduit.java   | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

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 e4919ef..b9f6cbb 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
@@ -305,9 +305,13 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
                             }
                         }
                     };
-                    ChannelFuture channelFuture = getChannel().write(entity);
-                    channelFuture.addListener(listener);
-                    outputStream.close();
+                    
+                    synchronized (entity) {
+                        Channel syncChannel = getChannel();
+                        ChannelFuture channelFuture = syncChannel.write(entity);
+                        channelFuture.addListener(listener);
+                        outputStream.close();
+                    }
                 }
             };
 
@@ -356,6 +360,9 @@ public class NettyHttpConduit extends URLConnectionHTTPConduit implements BusLif
                     } else {
                         setException(future.cause());
                     }
+                    synchronized (entity) {
+                        //ensure entity is write in main thread
+                    }
                 }
             };