JBossWS SVN: r18187 - in stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core: client and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: asoldano
Date: 2013-12-17 05:33:59 -0500 (Tue, 17 Dec 2013)
New Revision: 18187
Added:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/HttpsNoDelaySocketFactory.java
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/StubExt.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
Log:
[JBPAPP-10911] Commit patch for allowing disabling Nagle's algorithm on ws clients (on behalf of Navin Surtani, thanks!)
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/StubExt.java 2013-12-17 08:34:08 UTC (rev 18186)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/StubExt.java 2013-12-17 10:33:59 UTC (rev 18187)
@@ -73,6 +73,8 @@
static final String PROPERTY_MTOM_ENABLED= "org.jboss.ws.mtom.enabled";
/** HTTP chunk size */
static final String PROPERTY_CHUNKED_ENCODING_SIZE = "http://org.jboss.ws/http#chunksize";
+ /** The NoDelaySocketFactory */
+ static final String PROPERTY_NO_DELAY_SOCKET_ENABLED = "org.jboss.ws.socket.no.delay.socket.enabled";
/**
Modified: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2013-12-17 08:34:08 UTC (rev 18186)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2013-12-17 10:33:59 UTC (rev 18187)
@@ -40,6 +40,7 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.Remoting;
import org.jboss.remoting.Version;
import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.remoting.marshal.Marshaller;
@@ -50,6 +51,7 @@
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.core.StubExt;
import org.jboss.ws.core.WSTimeoutException;
+import org.jboss.ws.core.client.socket.HttpsNoDelaySocketFactory;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.feature.FastInfosetFeature;
import org.jboss.ws.metadata.config.CommonConfig;
@@ -405,6 +407,12 @@
String remotingKey = configMap.get(key);
clientConfig.put(remotingKey, val);
}
+
+ // Check if tcpNoDelay is enabled
+ if (key.equals(StubExt.PROPERTY_NO_DELAY_SOCKET_ENABLED)) {
+ boolean noDelayEnabled = Boolean.valueOf(val.toString());
+ if (noDelayEnabled) metadata.put(Remoting.CUSTOM_SOCKET_FACTORY, HttpsNoDelaySocketFactory.class);
+ }
}
}
Added: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/HttpsNoDelaySocketFactory.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/HttpsNoDelaySocketFactory.java (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/HttpsNoDelaySocketFactory.java 2013-12-17 10:33:59 UTC (rev 18187)
@@ -0,0 +1,48 @@
+package org.jboss.ws.core.client.socket;
+
+import org.jboss.remoting.transport.http.ssl.HTTPSSocketFactory;
+
+import javax.net.ssl.HandshakeCompletedListener;
+import javax.net.ssl.SSLSocketFactory;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * {@link javax.net.SocketFactory} class that will make a call on {@link java.net.Socket#setTcpNoDelay(boolean)}
+ * when createSocket() is called.
+ */
+public class HttpsNoDelaySocketFactory extends HTTPSSocketFactory {
+
+ public HttpsNoDelaySocketFactory(SSLSocketFactory socketFactory, HandshakeCompletedListener listener) {
+ super(socketFactory, listener);
+ }
+
+ public Socket createSocket(Socket socket, String string, int i, boolean b) throws IOException {
+ Socket toReturn = super.createSocket(socket, string, i, b);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ public Socket createSocket(String string, int i) throws IOException {
+ Socket toReturn = super.createSocket(string, i);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
+ Socket toReturn = super.createSocket(inetAddress, i);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+ public Socket createSocket(String string, int i, InetAddress inetAddress, int i1) throws IOException,
+ UnknownHostException {
+ Socket toReturn = super.createSocket(string, i, inetAddress, i1);
+ toReturn.setTcpNoDelay(true);
+ return toReturn;
+ }
+
+
+}
Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/socket/HttpsNoDelaySocketFactory.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native