User: starksm 
  Date: 01/09/29 17:40:17

  Modified:    src/main/org/jboss/mq/il/oil OILServerILService.java
                        OILServerILServiceMBean.java
  Log:
  Add support for binding to a specific interface
  
  Revision  Changes    Path
  1.9       +28 -8     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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- OILServerILService.java   2001/09/27 04:21:28     1.8
  +++ OILServerILService.java   2001/09/30 00:40:16     1.9
  @@ -15,8 +15,8 @@
   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;
  @@ -46,7 +46,7 @@
    * Implements the ServerILJMXService which is used to manage the JVM IL.
    *
    * @author    Hiram Chirino ([EMAIL PROTECTED])
  - * @version   $Revision: 1.8 $
  + * @version   $Revision: 1.9 $
    */
   public class OILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, OILServerILServiceMBean
   {
  @@ -86,6 +86,7 @@
   
      boolean running;
      int serverBindPort = 0;
  +   InetAddress bindAddress = null;
      Thread worker;
   
      /**
  @@ -357,14 +358,15 @@
         running = true;
         this.server = lookupJMSServer();
   
  -      serverSocket = new ServerSocket(serverBindPort);
  +      serverSocket = new ServerSocket(serverBindPort, 50, bindAddress);
         serverSocket.setSoTimeout(SO_TIMEOUT);
   
  -      log.info("JBossMQ OIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort());
  +      InetAddress socketAddress = serverSocket.getInetAddress();
  +      log.info("JBossMQ OIL service available at : " + socketAddress + ":" + 
serverSocket.getLocalPort());
         worker = new Thread(server.threadGroup, this, "OIL Worker");
         worker.start();
   
  -      serverIL = new OILServerIL(InetAddress.getLocalHost(), 
serverSocket.getLocalPort());
  +      serverIL = new OILServerIL(socketAddress, serverSocket.getLocalPort());
   
         bindJNDIReferences();
   
  @@ -389,15 +391,33 @@
      /** Getter for property serverBindPort.
       * @return Value of property serverBindPort.
       */
  -   public int getServerBindPort() {
  +   public int getServerBindPort()
  +   {
         return serverBindPort;
      }
      
      /** Setter for property serverBindPort.
       * @param serverBindPort New value of property serverBindPort.
       */
  -   public void setServerBindPort(int 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.4       +10 -1     
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OILServerILServiceMBean.java      2001/09/27 04:21:28     1.3
  +++ OILServerILServiceMBean.java      2001/09/30 00:40:16     1.4
  @@ -7,13 +7,22 @@
   package org.jboss.mq.il.oil;
   
   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
    */
  -public interface OILServerILServiceMBean extends 
org.jboss.mq.il.ServerILJMXServiceMBean {
  +public interface OILServerILServiceMBean extends 
org.jboss.mq.il.ServerILJMXServiceMBean
  +{
  +   /** Get the OIL server listening port */
      public int getServerBindPort();
  +   /** Set the OIL server listening port */
      public void setServerBindPort(int serverBindPort);
  +
  +   /** Get the interface address the OIL server bind its listening port on */
  +   public String getBindAddress();
  +   /** Set the interface address the OIL server bind its listening port on */
  +   public void setBindAddress(String host) throws UnknownHostException;
   }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to