User: starksm 
  Date: 01/09/29 18:14:11

  Modified:    src/main/org/jboss/mq/il/oil Tag: Branch_2_4
                        OILServerILService.java
                        OILServerILServiceMBean.java
  Log:
  Add support for binding on a specific interface and port
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +42 -9     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.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- OILServerILService.java   2001/08/23 03:57:10     1.2.2.1
  +++ OILServerILService.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 OILServerILService extends org.jboss.mq.il.ServerILJMXService 
implements Runnable, OILServerILServiceMBean {
      protected ServerSocket serverSocket;
  @@ -59,6 +58,7 @@
   
      boolean          running;
      int              serverBindPort = 0;
  +   InetAddress bindAddress = null;
      Thread           worker;
      //The server implementation
      protected static JMSServer server;
  @@ -128,15 +128,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 OIL service available at : " + 
InetAddress.getLocalHost().getHostAddress() + ":" + serverSocket.getLocalPort() );
  -      worker = new Thread( server.threadGroup, this, "OIL Worker" );
  +      InetAddress socketAddress = serverSocket.getInetAddress();
  +      category.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();
   
      }
  @@ -329,4 +329,37 @@
         }
   
      }
  +
  +   /** 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   +13 -2     
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.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- OILServerILServiceMBean.java      2001/08/23 03:57:10     1.2.2.1
  +++ OILServerILServiceMBean.java      2001/09/30 01:14:11     1.2.2.2
  @@ -7,11 +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
  + * @version $Revision: 1.2.2.2 $
    */
  -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