User: starksm
Date: 01/09/29 18:14:11
Modified: src/main/org/jboss/mq/il/uil Tag: Branch_2_4
UILServerILService.java
UILServerILServiceMBean.java
Log:
Add support for binding on a specific interface and port
Revision Changes Path
No revision
No revision
1.2.2.2 +44 -8 jbossmq/src/main/org/jboss/mq/il/uil/UILServerILService.java
Index: UILServerILService.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/uil/UILServerILService.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- UILServerILService.java 2001/08/23 03:57:10 1.2.2.1
+++ UILServerILService.java 2001/09/30 01:14:11 1.2.2.2
@@ -15,10 +15,9 @@
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
-
import java.net.Socket;
+import java.net.UnknownHostException;
import java.rmi.RemoteException;
-
import java.util.Properties;
import javax.jms.Destination;
import javax.jms.JMSException;
@@ -51,7 +50,7 @@
*
* @author Hiram Chirino ([EMAIL PROTECTED])
* @created August 16, 2001
- * @version $Revision: 1.2.2.1 $
+ * @version $Revision: 1.2.2.2 $
*/
public class UILServerILService extends org.jboss.mq.il.ServerILJMXService
implements Runnable, UILServerILServiceMBean {
protected ServerSocket serverSocket;
@@ -59,6 +58,7 @@
boolean running;
int serverBindPort = 0;
+ InetAddress bindAddress = null;
Thread worker;
//The server implementation
protected static JMSServer server;
@@ -129,14 +129,15 @@
running = true;
this.server = lookupJMSServer();
- serverSocket = new ServerSocket( serverBindPort );
- serverSocket.setSoTimeout( SO_TIMEOUT );
+ serverSocket = new ServerSocket(serverBindPort, 50, bindAddress);
+ serverSocket.setSoTimeout(SO_TIMEOUT);
- category.info( "JBossMQ UIL service available at : " +
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort() );
- worker = new Thread( server.threadGroup, this, "UIL Worker" );
+ InetAddress socketAddress = serverSocket.getInetAddress();
+ category.info("JBossMQ UIL service available at : " + socketAddress + ":" +
serverSocket.getLocalPort());
+ worker = new Thread(server.threadGroup, this, "UIL Worker");
worker.start();
- serverIL = new UILServerIL( InetAddress.getLocalHost(),
serverSocket.getLocalPort() );
+ serverIL = new UILServerIL(socketAddress, serverSocket.getLocalPort());
bindJNDIReferences();
@@ -338,4 +339,39 @@
category.warn( "Connection failure during connection close.", e );
}
}
+
+ /** Getter for property serverBindPort.
+ * @return Value of property serverBindPort.
+ */
+ public int getServerBindPort()
+ {
+ return serverBindPort;
+ }
+
+ /** Setter for property serverBindPort.
+ * @param serverBindPort New value of property serverBindPort.
+ */
+ public void setServerBindPort(int serverBindPort)
+ {
+ this.serverBindPort = serverBindPort;
+ }
+
+ /** Get the interface address the OIL server bind its listening port on */
+ public String getBindAddress()
+ {
+ String addr = "0.0.0.0";
+ if( bindAddress != null )
+ addr = bindAddress.getHostName();
+ return addr;
+ }
+ /** Set the interface address the OIL server bind its listening port on */
+ public void setBindAddress(String host) throws UnknownHostException
+ {
+ if( host != null || host.length() == 0 )
+ bindAddress = null;
+ else
+ bindAddress = InetAddress.getByName(host);
+ }
+
+
}
1.2.2.2 +14 -3
jbossmq/src/main/org/jboss/mq/il/uil/UILServerILServiceMBean.java
Index: UILServerILServiceMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmq/src/main/org/jboss/mq/il/uil/UILServerILServiceMBean.java,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- UILServerILServiceMBean.java 2001/08/23 03:57:10 1.2.2.1
+++ UILServerILServiceMBean.java 2001/09/30 01:14:11 1.2.2.2
@@ -7,11 +7,22 @@
package org.jboss.mq.il.uil;
import java.lang.Object;
+import java.net.UnknownHostException;
/**
* This interface is used to define which methods will be exposed via JMX.
*
- * @created August 16, 2001
+ * @version $Revision: 1.2.2.2 $
*/
-public interface UILServerILServiceMBean extends
org.jboss.mq.il.ServerILJMXServiceMBean {
-}
+public interface UILServerILServiceMBean extends
org.jboss.mq.il.ServerILJMXServiceMBean
+{
+ /** Get the UIL server listening port */
+ public int getServerBindPort();
+ /** Set the UIL server listening port */
+ public void setServerBindPort(int serverBindPort);
+
+ /** Get the interface address the UIL server bind its listening port on */
+ public String getBindAddress();
+ /** Set the interface address the UIL server bind its listening port on */
+ public void setBindAddress(String host) throws UnknownHostException;
+}
\ No newline at end of file
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development