User: chirino
Date: 02/03/08 22:11:47
Modified: src/main/org/jboss/mq/il/oil OILClientIL.java
OILClientILService.java OILServerIL.java
OILServerILFactory.java OILServerILService.java
OILServerILServiceMBean.java
Log:
Added a EnableTcpNoDelay option to the UIL and OIL mbeans.
Revision Changes Path
1.9 +9 -2 jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java
Index: OILClientIL.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientIL.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- OILClientIL.java 6 Mar 2002 17:27:49 -0000 1.8
+++ OILClientIL.java 9 Mar 2002 06:11:47 -0000 1.9
@@ -31,7 +31,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @created August 16, 2001
*/
public final class OILClientIL
@@ -42,14 +42,21 @@
private InetAddress addr;
private int port;
+ /**
+ * If the TcpNoDelay option should be used on the socket.
+ */
+ private boolean enableTcpNoDelay=false;
+
+
private transient ObjectInputStream in;
private transient ObjectOutputStream out;
private transient Socket socket;
- OILClientIL(InetAddress addr, int port)
+ OILClientIL(InetAddress addr, int port, boolean enableTcpNoDelay)
{
this.addr = addr;
this.port = port;
+ this.enableTcpNoDelay = enableTcpNoDelay;
}
/**
1.9 +13 -2 jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java
Index: OILClientILService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILClientILService.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- OILClientILService.java 6 Mar 2002 17:27:49 -0000 1.8
+++ OILClientILService.java 9 Mar 2002 06:11:47 -0000 1.9
@@ -30,7 +30,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @created August 16, 2001
*/
public final class OILClientILService
@@ -62,6 +62,10 @@
*/
private static int threadNumber= 0;
+ /**
+ * If the TcpNoDelay option should be used on the socket.
+ */
+ private boolean enableTcpNoDelay=false;
/**
* getClientIL method comment.
@@ -87,7 +91,13 @@
{
this.connection = connection;
serverSocket = new ServerSocket(0);
- clientIL = new OILClientIL(java.net.InetAddress.getLocalHost(),
serverSocket.getLocalPort());
+
+ String t = props.getProperty(OILServerILFactory.OIL_TCPNODELAY_KEY);
+ if (t != null)
+ enableTcpNoDelay = t.equals("yes");
+
+ clientIL = new OILClientIL(java.net.InetAddress.getLocalHost(),
serverSocket.getLocalPort(), enableTcpNoDelay);
+
}
/**
@@ -131,6 +141,7 @@
if(running)
{
+ socket.setTcpNoDelay(enableTcpNoDelay);
socket.setSoTimeout(0);
out = new ObjectOutputStream(new
BufferedOutputStream(socket.getOutputStream()));
out.flush();
1.9 +10 -3 jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java
Index: OILServerIL.java
===================================================================
RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerIL.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- OILServerIL.java 6 Mar 2002 17:27:49 -0000 1.8
+++ OILServerIL.java 9 Mar 2002 06:11:47 -0000 1.9
@@ -35,7 +35,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @author Norbert Lataille ([EMAIL PROTECTED])
- * @version $Revision: 1.8 $
+ * @version $Revision: 1.9 $
* @created August 16, 2001
*/
public final class OILServerIL
@@ -61,7 +61,12 @@
* Description of the Field
*/
private int port;
-
+
+ /**
+ * If the TcpNoDelay option should be used on the socket.
+ */
+ private boolean enableTcpNoDelay=false;
+
/**
* Description of the Field
*/
@@ -73,10 +78,11 @@
* @param a Description of Parameter
* @param port Description of Parameter
*/
- public OILServerIL(InetAddress a, int port)
+ public OILServerIL(InetAddress a, int port, boolean enableTcpNoDelay)
{
this.addr = a;
this.port = port;
+ this.enableTcpNoDelay = enableTcpNoDelay;
}
/**
@@ -482,6 +488,7 @@
throws Exception
{
socket = new Socket(addr, port);
+ socket.setTcpNoDelay(enableTcpNoDelay);
in = new ObjectInputStream(new BufferedInputStream(socket.getInputStream()));
out = new ObjectOutputStream(new
BufferedOutputStream(socket.getOutputStream()));
out.flush();
1.3 +8 -2 jbossmq/src/main/org/jboss/mq/il/oil/OILServerILFactory.java
Index: OILServerILFactory.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OILServerILFactory.java 10 Jan 2002 13:38:17 -0000 1.2
+++ OILServerILFactory.java 9 Mar 2002 06:11:47 -0000 1.3
@@ -16,7 +16,7 @@
* Factory class to produce OILServerIL objects.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Hiram Chirino</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public final class OILServerILFactory
implements ServerILFactory
@@ -26,6 +26,7 @@
final public static String CLIENT_IL_SERVICE =
OILClientILService.class.getName();
final public static String OIL_ADDRESS_KEY = "OIL_ADDRESS_KEY";
final public static String OIL_PORT_KEY = "OIL_PORT_KEY";
+ final public static String OIL_TCPNODELAY_KEY = "OIL_TCPNODELAY_KEY";
private ServerIL serverIL;
@@ -45,8 +46,13 @@
if (t == null)
throw new javax.jms.JMSException("A required connection property was not
set: " + OIL_PORT_KEY);
int port = Integer.parseInt(t);
+
+ boolean enableTcpNoDelay=false;
+ t = props.getProperty(OIL_TCPNODELAY_KEY);
+ if (t != null)
+ enableTcpNoDelay = t.equals("yes");
- serverIL = new OILServerIL(address, port);
+ serverIL = new OILServerIL(address, port, enableTcpNoDelay);
}
1.21 +48 -13 jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java
Index: OILServerILService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILService.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- OILServerILService.java 6 Mar 2002 17:27:49 -0000 1.20
+++ OILServerILService.java 9 Mar 2002 06:11:47 -0000 1.21
@@ -47,7 +47,7 @@
* Implements the ServerILJMXService which is used to manage the JVM IL.
*
* @author Hiram Chirino ([EMAIL PROTECTED])
- * @version $Revision: 1.20 $
+ * @version $Revision: 1.21 $
*/
public final class OILServerILService
extends org.jboss.mq.il.ServerILJMXService
@@ -55,6 +55,11 @@
OILServerILServiceMBean
{
/**
+ * logger instance.
+ */
+ final static private Logger log = Logger.getLogger(OILServerILService.class);;
+
+ /**
* The default timeout for the server socket. This is
* set so the socket will periodically return to check
* the running flag.
@@ -66,6 +71,12 @@
*/
//private static JMSServerInvoker server;
private JMSServerInvoker server;
+
+ /**
+ * If the TcpNoDelay option should be used on the socket.
+ */
+ private boolean enableTcpNoDelay=false;
+
/**
* The listening socket that receives incomming connections
* for servicing.
@@ -101,6 +112,11 @@
private int threadNumber = 0;
/**
+ * The connection properties passed to the client to connect to this IL
+ */
+ private Properties connectionProperties;
+
+ /**
* This class is used to encapsulate the basic connection and
* work for a connected client thread. The run() method of this
* class processes requests and sends responses to and from a
@@ -130,13 +146,6 @@
private ObjectInputStream in;
/**
- * Clients logger instance.
- *
- * I get methodNotFound errors on the global log object.
- */
- private Logger log;
-
- /**
* Allocates a new runnable instance to process requests from
* the server's client and pass them to the JMS server. The
* passed socket is used for all communications between the
@@ -150,11 +159,13 @@
Client(Socket s)
throws IOException
{
- log = Logger.getLogger(getClass());
this.sock = s;
this.out= new ObjectOutputStream(new
BufferedOutputStream(this.sock.getOutputStream()));
this.out.flush();
this.in = new ObjectInputStream(new
BufferedInputStream(this.sock.getInputStream()));
+ sock.setTcpNoDelay(enableTcpNoDelay);
+ if( log.isTraceEnabled() )
+ log.trace("Setting TcpNoDelay Option to:"+enableTcpNoDelay);
}
/**
@@ -404,9 +415,7 @@
*/
public java.util.Properties getClientConnectionProperties()
{
- Properties rc = super.getClientConnectionProperties();
- rc.setProperty(ServerILFactory.CLIENT_IL_SERVICE_KEY,
"org.jboss.mq.il.oil.OILClientILService");
- return rc;
+ return connectionProperties;
}
/**
@@ -538,7 +547,14 @@
*/
if( socketAddress.toString().equals("0.0.0.0/0.0.0.0") )
socketAddress = InetAddress.getLocalHost();
- serverIL = new OILServerIL(socketAddress, serverSocket.getLocalPort());
+ serverIL = new OILServerIL(socketAddress, serverSocket.getLocalPort(),
enableTcpNoDelay);
+
+ // Initialize the connection poperties using the base class.
+ connectionProperties = super.getClientConnectionProperties();
+ connectionProperties.setProperty(OILServerILFactory.CLIENT_IL_SERVICE_KEY,
"org.jboss.mq.il.oil.OILClientILService");
+ connectionProperties.setProperty(OILServerILFactory.OIL_PORT_KEY,
""+serverSocket.getLocalPort());
+ connectionProperties.setProperty(OILServerILFactory.OIL_ADDRESS_KEY,
""+socketAddress.getHostAddress());
+ connectionProperties.setProperty(OILServerILFactory.OIL_TCPNODELAY_KEY,
enableTcpNoDelay?"yes":"no");
bindJNDIReferences();
@@ -609,5 +625,24 @@
else
bindAddress = InetAddress.getByName(host);
}
+
+ /**
+ * Gets the enableTcpNoDelay.
+ * @return Returns a boolean
+ */
+ public boolean getEnableTcpNoDelay()
+ {
+ return enableTcpNoDelay;
+ }
+
+ /**
+ * Sets the enableTcpNoDelay.
+ * @param enableTcpNoDelay The enableTcpNoDelay to set
+ */
+ public void setEnableTcpNoDelay(boolean enableTcpNoDelay)
+ {
+ this.enableTcpNoDelay = enableTcpNoDelay;
+ }
+
}
// vim:expandtab:tabstop=3:shiftwidth=3
1.5 +12 -0
jbossmq/src/main/org/jboss/mq/il/oil/OILServerILServiceMBean.java
Index: OILServerILServiceMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/oil/OILServerILServiceMBean.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- OILServerILServiceMBean.java 30 Sep 2001 00:40:16 -0000 1.4
+++ OILServerILServiceMBean.java 9 Mar 2002 06:11:47 -0000 1.5
@@ -25,4 +25,16 @@
public String getBindAddress();
/** Set the interface address the OIL server bind its listening port on */
public void setBindAddress(String host) throws UnknownHostException;
+
+ /**
+ * Gets the disableTPCNODELAY.
+ * @return Returns a boolean
+ */
+ public boolean getEnableTcpNoDelay();
+ /**
+ * Sets the disableTPCNODELAY.
+ * @param disableTPCNODELAY The disableTPCNODELAY to set
+ */
+ public void setEnableTcpNoDelay(boolean disableTPCNODELAY);
+
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development