directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r158884 - directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
Date Thu, 24 Mar 2005 06:08:16 GMT
Author: trustin
Date: Wed Mar 23 22:08:15 2005
New Revision: 158884

URL: http://svn.apache.org/viewcvs?view=rev&rev=158884
Log:
Removed SocketAcceptor.bind() which includes backlog parameter.
Instead, I added backlog property to let users configure it easily.

Modified:
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java?view=diff&r1=158883&r2=158884
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java Wed Mar
23 22:08:15 2005
@@ -61,6 +61,8 @@
     private final Queue registerQueue = new Queue();
 
     private final Queue cancelQueue = new Queue();
+    
+    private int backlog = 50;
 
     private ExceptionMonitor exceptionMonitor = new DefaultExceptionMonitor();
 
@@ -78,21 +80,14 @@
     }
 
 
-    public void bind( SocketAddress address, IoHandler handler ) throws IOException
-    {
-        this.bind( address, 50, handler );
-    }
-
-
     /**
      * Binds to the specified <code>address</code> and handles incoming
-     * connections with the specified <code>handler</code>.
+     * connections with the specified <code>handler</code>.  Backlog value
+     * is configured to the value of <code>backlog</code> property.
      *
-     * @param backlog the listen backlog length 
      * @throws IOException if failed to bind
      */
-    public void bind( SocketAddress address, int backlog, IoHandler handler )
-            throws IOException
+    public void bind( SocketAddress address, IoHandler handler ) throws IOException
     {
         if( address == null )
         {
@@ -200,6 +195,26 @@
 
             throw request.exception;
         }
+    }
+    
+    /**
+     * Returns the default backlog value which is used when user binds. 
+     */
+    public int getBacklog()
+    {
+        return backlog;
+    }
+    
+    /**
+     * Sets the default backlog value which is used when user binds. 
+     */
+    public void setBacklog( int defaultBacklog )
+    {
+        if( defaultBacklog <= 0 )
+        {
+            throw new IllegalArgumentException( "defaultBacklog: " + defaultBacklog );
+        }
+        this.backlog = defaultBacklog;
     }
 
 



Mime
View raw message