directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r325869 - in /directory/network/trunk/src/java/org/apache/mina: common/ transport/socket/nio/ transport/vmpipe/
Date Mon, 17 Oct 2005 09:49:28 GMT
Author: trustin
Date: Mon Oct 17 02:49:18 2005
New Revision: 325869

URL: http://svn.apache.org/viewcvs?rev=325869&view=rev
Log:
Resolving DIRMINA-93
* Changed the semantic of IoAcceptor.unbind(SocketAddress) to close all client connections
* Added IoAcceptor.unbind(SocketAddress,boolean) so that users can choose to close client
connections
* Added BaseIoAcceptor to provide the default unbind(SocketAddress) implementation which calls
unbind(SocketAddress, true)
* Fixed all compilation errors occurred due to the changes above
* Marked FIXMES because unbind() doesn't work properly yet

Added:
    directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java   (with props)
Modified:
    directory/network/trunk/src/java/org/apache/mina/common/BaseIoSessionManager.java
    directory/network/trunk/src/java/org/apache/mina/common/IoAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java

Added: directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java?rev=325869&view=auto
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java (added)
+++ directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java Mon Oct 17
02:49:18 2005
@@ -0,0 +1,39 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.common;
+
+import java.net.SocketAddress;
+
+/**
+ * Base implementation of {@link IoAcceptor}s.
+ * 
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$
+ */
+public abstract class BaseIoAcceptor extends BaseIoSessionManager implements IoAcceptor
+{
+    protected BaseIoAcceptor()
+    {
+    }
+
+    public void unbind( SocketAddress address )
+    {
+        unbind( address, true );
+    }
+}

Propchange: directory/network/trunk/src/java/org/apache/mina/common/BaseIoAcceptor.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/network/trunk/src/java/org/apache/mina/common/BaseIoSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/BaseIoSessionManager.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/BaseIoSessionManager.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/BaseIoSessionManager.java Mon
Oct 17 02:49:18 2005
@@ -34,7 +34,7 @@
     protected BaseIoSessionManager()
     {
     }
-
+    
     public ExceptionMonitor getExceptionMonitor()
     {
         return exceptionMonitor;

Modified: directory/network/trunk/src/java/org/apache/mina/common/IoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/IoAcceptor.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/IoAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/IoAcceptor.java Mon Oct 17 02:49:18
2005
@@ -51,7 +51,17 @@
     void bind( SocketAddress address, IoHandler handler ) throws IOException;
 
     /**
-     * Unbinds from the specified <code>address</code>.
+     * Unbinds from the specified <code>address</code> and disconnects all clients
+     * connected there.
      */
     void unbind( SocketAddress address );
+    
+    /**
+     * Unbinds from the specified <code>address</code>.
+     * 
+     * @param disconnectClients <tt>true</tt> if and only if you want to disconnect
+     *                          all clients connected to <tt>address</tt>.
+     *                          <tt>false</tt> otherwise.
+     */
+    void unbind( SocketAddress address, boolean disconnectClients );
 }

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramAcceptor.java
Mon Oct 17 02:49:18 2005
@@ -121,6 +121,12 @@
 
     public void unbind( SocketAddress address )
     {
+        unbind( address, true );
+    }
+
+    public void unbind( SocketAddress address, boolean disconnectClients )
+    {
+        // FIXME: Make this work properly when disconnectClients is true.
         if( address == null )
             throw new NullPointerException( "address" );
 

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/DatagramSessionManager.java
Mon Oct 17 02:49:18 2005
@@ -19,7 +19,6 @@
 package org.apache.mina.transport.socket.nio;
 
 import org.apache.mina.common.BaseIoSessionManager;
-import org.apache.mina.common.IoSessionManager;
 
 /**
  * A base class for {@link DatagramAcceptor} and {@link DatagramConnector}.
@@ -29,7 +28,7 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-abstract class DatagramSessionManager extends BaseIoSessionManager implements IoSessionManager
+abstract class DatagramSessionManager extends BaseIoSessionManager
 {
     /**
      * Requests this processor to flush the write buffer of the specified

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
Mon Oct 17 02:49:18 2005
@@ -30,7 +30,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.mina.common.BaseIoSessionManager;
+import org.apache.mina.common.BaseIoAcceptor;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
@@ -44,7 +44,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class SocketAcceptor extends BaseIoSessionManager implements IoAcceptor
+public class SocketAcceptor extends BaseIoAcceptor
 {
     private static volatile int nextId = 0;
 
@@ -148,9 +148,9 @@
         }
     }
 
-
-    public void unbind( SocketAddress address )
+    public void unbind( SocketAddress address, boolean disconnectClients )
     {
+        // FIXME: Make this work properly when disconnectClients is true.
         if( address == null )
         {
             throw new NullPointerException( "address" );
@@ -449,11 +449,8 @@
     private static class RegistrationRequest
     {
         private final SocketAddress address;
-        
         private final IoHandler handler;
-        
-        private IOException exception; 
-        
+        private IOException exception;
         private boolean done;
         
         private RegistrationRequest( SocketAddress address, IoHandler handler )

Modified: directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?rev=325869&r1=325868&r2=325869&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Mon Oct 17 02:49:18 2005
@@ -8,9 +8,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.mina.common.BaseIoAcceptor;
 import org.apache.mina.common.BaseIoAcceptorConfig;
-import org.apache.mina.common.BaseIoSessionManager;
-import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSessionManagerConfig;
@@ -22,7 +21,7 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public class VmPipeAcceptor extends BaseIoSessionManager implements IoAcceptor
+public class VmPipeAcceptor extends BaseIoAcceptor
 {
     static final Map boundHandlers = new HashMap();
 
@@ -71,6 +70,12 @@
 
     public void unbind( SocketAddress address )
     {
+        unbind( address, true );
+    }
+    
+    public void unbind( SocketAddress address, boolean disconnectClients )
+    {
+        // FIXME: Make this work properly when disconnectClients is true.
         if( address == null )
             throw new NullPointerException( "address" );
 



Mime
View raw message