psmith      2003/06/16 20:56:40

  Modified:    src/java/org/apache/log4j/net SocketReceiver.java
  Log:
  added getConnetedSocketDetails method which returns a Vector
  of Strings that represent the sockets that are being managed by this receiver.
  
  I think it's probably best if we eventually make this a Collection
  of SocketReceiver.SocketDetails instances (a small inner class representing
  Hostname/IP) rather than just plain string.
  
  Will do that in the next commit.
  
  Revision  Changes    Path
  1.4       +17 -0     
jakarta-log4j-sandbox/src/java/org/apache/log4j/net/SocketReceiver.java
  
  Index: SocketReceiver.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/net/SocketReceiver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SocketReceiver.java       16 Jun 2003 03:19:33 -0000      1.3
  +++ SocketReceiver.java       17 Jun 2003 03:56:40 -0000      1.4
  @@ -56,6 +56,8 @@
   import java.net.ServerSocket;
   import java.net.Socket;
   
  +import java.util.Enumeration;
  +import java.util.Iterator;
   import java.util.Vector;
   
   
  @@ -225,6 +227,21 @@
       }
   
       setActive(false);
  +  }
  +  
  +  /**
  +   * Returns a Vector of Strings representing the IP/Domain name
  +   * of the currently connected sockets that this receiver has
  +   * been responsible for creating.
  +   * @return
  +   */
  +  public Vector getConnectedSocketDetails() {
  +    Vector details = new Vector(socketList.size());
  +    for(Enumeration enum = socketList.elements(); enum.hasMoreElements();) {
  +      Socket socket = (Socket)enum.nextElement();
  +      details.add(socket.getInetAddress().getHostName() + ":" + socket.getPort());
  +    }
  +    return details; 
     }
     
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to