directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nik...@apache.org
Subject svn commit: r427902 - in /directory/trunks/mina/core/src/main/java/org/apache/mina: common/ common/support/ transport/socket/nio/ transport/socket/nio/support/ transport/vmpipe/
Date Wed, 02 Aug 2006 05:38:37 GMT
Author: niklas
Date: Tue Aug  1 22:38:36 2006
New Revision: 427902

URL: http://svn.apache.org/viewvc?rev=427902&view=rev
Log:
Added the getBoundAddresses() method to IoAcceptor which returns all SocketAddress objects
currently bound by the acceptor.

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoAcceptor.java?rev=427902&r1=427901&r2=427902&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoAcceptor.java (original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/IoAcceptor.java Tue Aug
 1 22:38:36 2006
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
+import java.util.Set;
 
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
@@ -75,6 +76,15 @@
      * bound by this acceptor.
      */
     boolean isBound( SocketAddress address );
+    
+    /**
+     * Returns a set of {@link SocketAddress} objects representing the addresses 
+     * which have been bound by this acceptor.
+     * 
+     * @return the set of {@link SocketAddress} objects or an empty set if 
+     *         nothing has been bound.
+     */
+    Set getBoundAddresses();
     
     /**
      * (Optional) Returns an {@link IoSession} that is bound to the specified

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java?rev=427902&r1=427901&r2=427902&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
Tue Aug  1 22:38:36 2006
@@ -80,6 +80,11 @@
         return delegate.isBound( address );
     }
 
+    public Set getBoundAddresses()
+    {
+        return delegate.getBoundAddresses();
+    }
+
     public Set getManagedSessions( SocketAddress address )
     {
         return delegate.getManagedSessions( address );

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=427902&r1=427901&r2=427902&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
Tue Aug  1 22:38:36 2006
@@ -339,6 +339,14 @@
         }
     }
 
+    public Set getBoundAddresses()
+    {
+        synchronized( channels )
+        {
+            return new HashSet( channels.keySet() );
+        }
+    }
+    
     private class Worker extends Thread
     {
         Worker()

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?rev=427902&r1=427901&r2=427902&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
Tue Aug  1 22:38:36 2006
@@ -26,6 +26,7 @@
 import java.nio.channels.Selector;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -188,6 +189,14 @@
         synchronized( channels )
         {
             return channels.containsKey( address );
+        }
+    }
+    
+    public Set getBoundAddresses()
+    {
+        synchronized( channels )
+        {
+            return new HashSet( channels.keySet() );
         }
     }
     

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?rev=427902&r1=427901&r2=427902&view=diff
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Tue Aug  1 22:38:36 2006
@@ -24,6 +24,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -199,6 +200,14 @@
         synchronized( boundHandlers )
         {
             return boundHandlers.containsKey( address );
+        }
+    }
+    
+    public Set getBoundAddresses()
+    {
+        synchronized( boundHandlers )
+        {
+            return new HashSet( boundHandlers.keySet() );
         }
     }
     



Mime
View raw message