directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r165586 [1/2] - in /directory/network/trunk/src: examples/org/apache/mina/examples/echoserver/ examples/org/apache/mina/examples/reverser/ java/org/apache/mina/common/ java/org/apache/mina/io/ java/org/apache/mina/io/datagram/ java/org/apache/mina/io/filter/ java/org/apache/mina/io/socket/ java/org/apache/mina/protocol/ java/org/apache/mina/protocol/filter/ java/org/apache/mina/protocol/io/ java/org/apache/mina/protocol/vmpipe/ java/org/apache/mina/registry/ java/org/apache/mina/util/ test/org/apache/mina/examples/echoserver/ test/org/apache/mina/io/ test/org/apache/mina/protocol/
Date Mon, 02 May 2005 06:27:28 GMT
Author: trustin
Date: Sun May  1 23:27:27 2005
New Revision: 165586

URL: http://svn.apache.org/viewcvs?rev=165586&view=rev
Log:
* Removed SessionInitializer and its related methods and classes
** Added IoHandler/ProtocolHandler.sessionCreated() instead
** All filter and handler methods can throw checked exception now.

Added:
    directory/network/trunk/src/java/org/apache/mina/util/SessionUtil.java   (with props)
Removed:
    directory/network/trunk/src/java/org/apache/mina/common/DefaultSessionInitializer.java
    directory/network/trunk/src/java/org/apache/mina/common/SessionInitializer.java
Modified:
    directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
    directory/network/trunk/src/examples/org/apache/mina/examples/reverser/ReverseProtocolHandler.java
    directory/network/trunk/src/java/org/apache/mina/common/BaseSessionManager.java
    directory/network/trunk/src/java/org/apache/mina/common/SessionManager.java
    directory/network/trunk/src/java/org/apache/mina/io/AbstractIoFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/io/IoAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/IoConnector.java
    directory/network/trunk/src/java/org/apache/mina/io/IoFilter.java
    directory/network/trunk/src/java/org/apache/mina/io/IoFilterAdapter.java
    directory/network/trunk/src/java/org/apache/mina/io/IoHandler.java
    directory/network/trunk/src/java/org/apache/mina/io/IoHandlerAdapter.java
    directory/network/trunk/src/java/org/apache/mina/io/IoSessionManagerFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java
    directory/network/trunk/src/java/org/apache/mina/io/filter/BlacklistFilter.java
    directory/network/trunk/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
    directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/io/socket/SocketConnector.java
    directory/network/trunk/src/java/org/apache/mina/protocol/AbstractProtocolFilterChain.java
    directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolConnector.java
    directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolFilter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandler.java
    directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandlerAdapter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
    directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
    directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeFilter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeSession.java
    directory/network/trunk/src/java/org/apache/mina/registry/ServiceRegistry.java
    directory/network/trunk/src/java/org/apache/mina/registry/SimpleServiceRegistry.java
    directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
    directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AcceptorTest.java
    directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
    directory/network/trunk/src/test/org/apache/mina/io/IoFilterChainTest.java
    directory/network/trunk/src/test/org/apache/mina/protocol/ProtocolFilterChainTest.java

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java Sun May  1 23:27:27 2005
@@ -19,9 +19,9 @@
 package org.apache.mina.examples.echoserver;
 
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
+import org.apache.mina.io.IoHandlerAdapter;
 import org.apache.mina.io.IoSession;
 import org.apache.mina.io.socket.SocketSessionConfig;
 
@@ -31,13 +31,10 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class EchoProtocolHandler implements IoHandler
+public class EchoProtocolHandler extends IoHandlerAdapter
 {
     public void sessionOpened( IoSession session )
     {
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": OPEN" );
-        
         SessionConfig cfg = session.getConfig();
         if( cfg instanceof SocketSessionConfig )
         {
@@ -45,23 +42,8 @@
         }
     }
 
-    public void sessionClosed( IoSession session )
-    {
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": CLOSED" );
-    }
-
-    public void sessionIdle( IoSession session, IdleStatus status )
-    {
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": IDLE" );
-    }
-
     public void exceptionCaught( IoSession session, Throwable cause )
     {
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": EXCEPTION" );
-        cause.printStackTrace( System.out );
         session.close();
     }
 
@@ -71,15 +53,6 @@
         ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
         wb.put( rb );
         wb.flip();
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": READ ("
-                            + wb.remaining() + "B)" );
         session.write( wb, null );
-    }
-
-    public void dataWritten( IoSession session, Object marker )
-    {
-        System.out.println( Thread.currentThread().getName() + ' '
-                            + session.getRemoteAddress() + ": WRITTEN" );
     }
 }

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/reverser/ReverseProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/reverser/ReverseProtocolHandler.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/reverser/ReverseProtocolHandler.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/reverser/ReverseProtocolHandler.java Sun May  1 23:27:27 2005
@@ -18,8 +18,8 @@
  */
 package org.apache.mina.examples.reverser;
 
-import org.apache.mina.common.IdleStatus;
 import org.apache.mina.protocol.ProtocolHandler;
+import org.apache.mina.protocol.ProtocolHandlerAdapter;
 import org.apache.mina.protocol.ProtocolSession;
 
 /**
@@ -28,25 +28,8 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class ReverseProtocolHandler implements ProtocolHandler
+public class ReverseProtocolHandler extends ProtocolHandlerAdapter
 {
-
-    public void sessionOpened( ProtocolSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " OPENED" );
-    }
-
-    public void sessionClosed( ProtocolSession session )
-    {
-        System.out.println( session.getRemoteAddress() + " CLOSED" );
-    }
-
-    public void sessionIdle( ProtocolSession session, IdleStatus status )
-    {
-        System.out.println( session.getRemoteAddress() + " IDLE(" + status
-                            + ")" );
-    }
-
     public void exceptionCaught( ProtocolSession session, Throwable cause )
     {
         System.out.println( session.getRemoteAddress() + " EXCEPTION" );
@@ -70,11 +53,5 @@
 
         // and write it back.
         session.write( buf.toString() );
-    }
-
-    public void messageSent( ProtocolSession session, Object message )
-    {
-        // Invoked the reversed string is actually written to socket channel.
-        System.out.println( session.getRemoteAddress() + " SENT: " + message );
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/common/BaseSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/BaseSessionManager.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/BaseSessionManager.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/BaseSessionManager.java Sun May  1 23:27:27 2005
@@ -18,12 +18,6 @@
  */
 package org.apache.mina.common;
 
-import org.apache.mina.common.DefaultExceptionMonitor;
-import org.apache.mina.common.DefaultSessionInitializer;
-import org.apache.mina.common.ExceptionMonitor;
-import org.apache.mina.common.SessionInitializer;
-import org.apache.mina.common.SessionManager;
-
 /**
  * Base implementation of {@link SessionManager}s.
  * 
@@ -33,32 +27,12 @@
 public class BaseSessionManager implements SessionManager {
 
     /**
-     * Default session initializer.
-     */
-    protected SessionInitializer defaultInitializer = new DefaultSessionInitializer();
-
-    /**
      * Current exception monitor.
      */
     protected ExceptionMonitor exceptionMonitor = new DefaultExceptionMonitor();
     
     protected BaseSessionManager()
     {
-    }
-
-    public SessionInitializer getDefaultSessionInitializer()
-    {
-        return defaultInitializer;
-    }
-
-    public void setDefaultSessionInitializer( SessionInitializer defaultInitializer )
-    {
-        if( defaultInitializer == null )
-        {
-            defaultInitializer = new DefaultSessionInitializer();
-        }
-        
-        this.defaultInitializer = defaultInitializer;
     }
 
     public ExceptionMonitor getExceptionMonitor()

Modified: directory/network/trunk/src/java/org/apache/mina/common/SessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/SessionManager.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/SessionManager.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/SessionManager.java Sun May  1 23:27:27 2005
@@ -22,8 +22,6 @@
  * Base interface for all acceptors and connectors that manage
  * sessions.
  * <p>
- * The default {@link SessionInitializer} is {@link DefaultSessionInitializer}.
- * <p>
  * You can monitor any uncaught exceptions by setting {@link ExceptionMonitor}
  * by calling {@link #setExceptionMonitor(ExceptionMonitor)}.  The default
  * monitor is {@link DefaultExceptionMonitor}.
@@ -32,23 +30,6 @@
  * @version $Rev$, $Date$
  */
 public interface SessionManager {
-    
-    /**
-     * Returns default {@link SessionInitializer} when no initializer
-     * is specified as a parameter when user call <tt>bind(...)</tt>
-     * and <tt>connect(...)</tt> methods.
-     */
-    SessionInitializer getDefaultSessionInitializer();
-    
-    /**
-     * Sets default {@link SessionInitializer} when no initializer
-     * is specified as a parameter when user call <tt>bind(...)</tt>
-     * and <tt>connect(...)</tt> methods.
-     * 
-     * @param initializer A new instance of {@link DefaultSessionInitializer}
-     *                    is set if <tt>null</tt> is specified.
-     */
-    void setDefaultSessionInitializer( SessionInitializer initializer );
     
     /**
      * Returns the current exception monitor.

Modified: directory/network/trunk/src/java/org/apache/mina/io/AbstractIoFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/AbstractIoFilterChain.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/AbstractIoFilterChain.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/AbstractIoFilterChain.java Sun May  1 23:27:27 2005
@@ -72,42 +72,42 @@
     {
         return new IoFilter()
         {
-            public void sessionOpened( NextFilter nextFilter, IoSession session )
+            public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 nextFilter.sessionOpened( session );
             }
 
-            public void sessionClosed( NextFilter nextFilter, IoSession session )
+            public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 nextFilter.sessionClosed( session );
             }
 
             public void sessionIdle( NextFilter nextFilter, IoSession session,
-                                    IdleStatus status )
+                                    IdleStatus status ) throws Exception
             {
                 nextFilter.sessionIdle( session, status );
             }
 
             public void exceptionCaught( NextFilter nextFilter,
-                                        IoSession session, Throwable cause )
+                                        IoSession session, Throwable cause ) throws Exception
             {
                 nextFilter.exceptionCaught( session, cause );
             }
 
             public void dataRead( NextFilter nextFilter, IoSession session,
-                                 ByteBuffer buf )
+                                 ByteBuffer buf ) throws Exception
             {
                 nextFilter.dataRead( session, buf );
             }
 
             public void dataWritten( NextFilter nextFilter, IoSession session,
-                                    Object marker )
+                                    Object marker ) throws Exception
             {
                 nextFilter.dataWritten( session, marker );
             }
             
             public void filterWrite( NextFilter nextFilter, IoSession session,
-                                     ByteBuffer buf, Object marker )
+                                     ByteBuffer buf, Object marker ) throws Exception
             {
                 doWrite( session, buf, marker );
             }
@@ -121,30 +121,30 @@
     {
         return new IoFilter()
         {
-            public void sessionOpened( NextFilter nextFilter, IoSession session )
+            public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 session.getHandler().sessionOpened( session );
             }
 
-            public void sessionClosed( NextFilter nextFilter, IoSession session )
+            public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 session.getHandler().sessionClosed( session );
             }
 
             public void sessionIdle( NextFilter nextFilter, IoSession session,
-                                    IdleStatus status )
+                                    IdleStatus status ) throws Exception
             {
                 session.getHandler().sessionIdle( session, status );
             }
 
             public void exceptionCaught( NextFilter nextFilter,
-                                        IoSession session, Throwable cause )
+                                        IoSession session, Throwable cause ) throws Exception
             {
                 session.getHandler().exceptionCaught( session, cause );
             }
 
             public void dataRead( NextFilter nextFilter, IoSession session,
-                                 ByteBuffer buf )
+                                 ByteBuffer buf ) throws Exception
             {
                 IoHandler handler = session.getHandler();
                 handler.dataRead( session, buf );
@@ -152,13 +152,13 @@
             }
 
             public void dataWritten( NextFilter nextFilter, IoSession session,
-                                    Object marker )
+                                    Object marker ) throws Exception
             {
                 session.getHandler().dataWritten( session, marker );
             }
 
             public void filterWrite( NextFilter nextFilter,
-                                     IoSession session, ByteBuffer buf, Object marker )
+                                     IoSession session, ByteBuffer buf, Object marker ) throws Exception
             {
                 nextFilter.filterWrite( session, buf, marker );
             }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoAcceptor.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoAcceptor.java Sun May  1 23:27:27 2005
@@ -21,8 +21,6 @@
 import java.io.IOException;
 import java.net.SocketAddress;
 
-import org.apache.mina.common.SessionInitializer;
-
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
  * {@link IoHandler}s.
@@ -41,8 +39,6 @@
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
- * 
- * @see SessionInitializer
  */
 public interface IoAcceptor extends IoSessionManager
 {
@@ -53,14 +49,6 @@
      * @throws IOException if failed to bind
      */
     void bind( SocketAddress address, IoHandler handler ) throws IOException;
-
-    /**
-     * Binds to the specified <code>address</code> and handles incoming
-     * connections with the specified <code>handler</code>.
-     * 
-     * @throws IOException if failed to bind
-     */
-    void bind( SocketAddress address, IoHandler handler, SessionInitializer initializer ) throws IOException;
 
     /**
      * Unbinds from the specified <code>address</code>.

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoConnector.java Sun May  1 23:27:27 2005
@@ -21,8 +21,6 @@
 import java.io.IOException;
 import java.net.SocketAddress;
 
-import org.apache.mina.common.SessionInitializer;
-
 /**
  * Connects to endpoint, communicates with the server, and fires events to
  * {@link IoHandler}s.
@@ -41,8 +39,6 @@
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
- * 
- * @see SessionInitializer
  */
 public interface IoConnector extends IoSessionManager
 {
@@ -87,47 +83,4 @@
      */
     IoSession connect( SocketAddress address, SocketAddress localAddress,
                        int timeout, IoHandler handler ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code>.  If communication starts
-     * successfully, events are fired to the specified
-     * <code>handler</code>.  This method blocks.
-     * 
-     * @throws IOException if failed to connect
-     */
-    IoSession connect( SocketAddress address, IoHandler handler,
-                       SessionInitializer initializer ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code>.  If communication starts
-     * successfully, events are fired to the specified
-     * <code>handler</code>.  This method blocks.
-     * 
-     * @param localAddress the local address the channel is bound to
-     * @throws IOException if failed to connect
-     */
-    IoSession connect( SocketAddress address, SocketAddress localAddress,
-                       IoHandler handler, SessionInitializer initializer ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code> with timeout.  If
-     * communication starts successfully, events are fired to the specified
-     * <code>handler</code>.  This method blocks.
-     * 
-     * @throws IOException if failed to connect
-     */
-    IoSession connect( SocketAddress address, int timeout, IoHandler handler,
-                       SessionInitializer initializer ) throws IOException;
-    
-    /**
-     * Connects to the specified <code>address</code> with timeout.  If
-     * communication starts successfully, events are fired to the specified
-     * <code>handler</code>.  This method blocks.
-     * 
-     * @param localAddress the local address the channel is bound to
-     * @throws IOException if failed to connect
-     */
-    IoSession connect( SocketAddress address, SocketAddress localAddress,
-                       int timeout, IoHandler handler,
-                       SessionInitializer initializer ) throws IOException;
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoFilter.java Sun May  1 23:27:27 2005
@@ -49,42 +49,48 @@
     /**
      * Filters {@link IoHandler#sessionOpened(IoSession)} event.
      */
-    void sessionOpened( NextFilter nextFilter, IoSession session );
+    void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception;
 
     /**
      * Filters {@link IoHandler#sessionClosed(IoSession)} event.
      */
-    void sessionClosed( NextFilter nextFilter, IoSession session );
+    void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception;
 
     /**
      * Filters {@link IoHandler#sessionIdle(IoSession, IdleStatus)} event.
      */
     void sessionIdle( NextFilter nextFilter, IoSession session,
-                      IdleStatus status );
+                      IdleStatus status ) throws Exception;
 
     /**
      * Filters {@link IoHandler#exceptionCaught(IoSession, Throwable)} event.
      */
     void exceptionCaught( NextFilter nextFilter, IoSession session,
-                          Throwable cause );
+                          Throwable cause ) throws Exception;
 
     /**
      * Filters {@link IoHandler#dataRead(IoSession, ByteBuffer)} event.
      */
-    void dataRead( NextFilter nextFilter, IoSession session, ByteBuffer buf );
+    void dataRead( NextFilter nextFilter, IoSession session, ByteBuffer buf ) throws Exception;
 
     /**
      * Filters {@link IoHandler#dataWritten(IoSession, Object)} event.
      */
-    void dataWritten( NextFilter nextFilter, IoSession session, Object marker );
+    void dataWritten( NextFilter nextFilter, IoSession session, Object marker ) throws Exception;
 
     /**
      * Filters {@link IoSession#write(ByteBuffer, Object)} method invocation.
      */
-    void filterWrite( NextFilter nextFilter, IoSession session, ByteBuffer buf, Object marker );
+    void filterWrite( NextFilter nextFilter, IoSession session, ByteBuffer buf, Object marker ) throws Exception;
     
-    public interface NextFilter extends IoHandler
+    public interface NextFilter
     {
+        void sessionOpened( IoSession session );
+        void sessionClosed( IoSession session );
+        void sessionIdle( IoSession session, IdleStatus status );
+        void exceptionCaught( IoSession session, Throwable cause );
+        void dataRead( IoSession session, ByteBuffer buf );
+        void dataWritten( IoSession session, Object marker );
         void filterWrite( IoSession session, ByteBuffer buf, Object marker );
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoFilterAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoFilterAdapter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoFilterAdapter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoFilterAdapter.java Sun May  1 23:27:27 2005
@@ -35,42 +35,42 @@
  */
 public class IoFilterAdapter implements IoFilter
 {
-    public void sessionOpened( NextFilter nextFilter, IoSession session )
+    public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
     {
         nextFilter.sessionOpened( session );
     }
 
-    public void sessionClosed( NextFilter nextFilter, IoSession session )
+    public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
     {
         nextFilter.sessionClosed( session );
     }
 
     public void sessionIdle( NextFilter nextFilter, IoSession session,
-                            IdleStatus status )
+                            IdleStatus status ) throws Exception
     {
         nextFilter.sessionIdle( session, status );
     }
 
     public void exceptionCaught( NextFilter nextFilter, IoSession session,
-                                Throwable cause )
+                                Throwable cause ) throws Exception
     {
         nextFilter.exceptionCaught( session, cause );
     }
 
     public void dataRead( NextFilter nextFilter, IoSession session,
-                         ByteBuffer buf )
+                         ByteBuffer buf ) throws Exception
     {
         nextFilter.dataRead( session, buf );
     }
 
     public void dataWritten( NextFilter nextFilter, IoSession session,
-                            Object marker )
+                            Object marker ) throws Exception
     {
         nextFilter.dataWritten( session, marker );
     }
 
     public void filterWrite( NextFilter nextFilter, IoSession session,
-                             ByteBuffer buf, Object marker )
+                             ByteBuffer buf, Object marker ) throws Exception
     {
         nextFilter.filterWrite( session, buf, marker );
     }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoHandler.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoHandler.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoHandler.java Sun May  1 23:27:27 2005
@@ -41,29 +41,35 @@
 public interface IoHandler
 {
     /**
+     * Invoked when the session is created.  Initialize default socket
+     * parameters and user-defined attributes here.
+     */
+    void sessionCreated( IoSession session ) throws Exception;
+    
+    /**
      * Invoked when the connection is opened.  This method is not invoked if the
      * transport type is UDP.
      */
-    void sessionOpened( IoSession session );
+    void sessionOpened( IoSession session ) throws Exception;
 
     /**
      * Invoked when the connection is closed.  This method is not invoked if the
      * transport type is UDP.
      */
-    void sessionClosed( IoSession session );
+    void sessionClosed( IoSession session ) throws Exception;
 
     /**
      * Invoked when the connection is idle.  Refer to {@link IdleStatus}.  This
      * method is not invoked if the transport type is UDP.
      */
-    void sessionIdle( IoSession session, IdleStatus status );
+    void sessionIdle( IoSession session, IdleStatus status ) throws Exception;
 
     /**
      * Invoked when any exception is thrown by user {@link IoHandler}
      * implementation or by MINA.  If <code>cause</code> is instanceof
      * {@link IOException}, MINA will close the connection automatically.
      */
-    void exceptionCaught( IoSession session, Throwable cause );
+    void exceptionCaught( IoSession session, Throwable cause ) throws Exception;
 
     /**
      * Invoked when data is read from the connection.  You can access
@@ -71,12 +77,12 @@
      * the internal buffer pool of MINA after this method is invoked, so
      * please don't try to reuse it.
      */
-    void dataRead( IoSession session, ByteBuffer buf );
+    void dataRead( IoSession session, ByteBuffer buf ) throws Exception;
 
     /**
      * Invoked when MINA wrote {@link IoSession#write(ByteBuffer, Object)}
      * request successfully.  <code>marker</code> is what you specified at the
      * point of invocation of {@link IoSession#write(ByteBuffer, Object)}.
      */
-    void dataWritten( IoSession session, Object marker );
+    void dataWritten( IoSession session, Object marker ) throws Exception;
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoHandlerAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoHandlerAdapter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoHandlerAdapter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoHandlerAdapter.java Sun May  1 23:27:27 2005
@@ -20,6 +20,7 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
+import org.apache.mina.util.SessionUtil;
 
 /**
  * An abstract adapter class for {@link IoHandler}.  You can extend this class
@@ -35,28 +36,32 @@
  */
 public class IoHandlerAdapter implements IoHandler
 {
+    public void sessionCreated( IoSession session ) throws Exception
+    {
+        SessionUtil.initialize( session );
+    }
 
-    public void sessionOpened( IoSession session )
+    public void sessionOpened( IoSession session ) throws Exception
     {
     }
 
-    public void sessionClosed( IoSession session )
+    public void sessionClosed( IoSession session ) throws Exception
     {
     }
 
-    public void sessionIdle( IoSession session, IdleStatus status )
+    public void sessionIdle( IoSession session, IdleStatus status ) throws Exception
     {
     }
 
-    public void exceptionCaught( IoSession session, Throwable cause )
+    public void exceptionCaught( IoSession session, Throwable cause ) throws Exception
     {
     }
 
-    public void dataRead( IoSession session, ByteBuffer buf )
+    public void dataRead( IoSession session, ByteBuffer buf ) throws Exception
     {
     }
 
-    public void dataWritten( IoSession session, Object marker )
+    public void dataWritten( IoSession session, Object marker ) throws Exception
     {
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/IoSessionManagerFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/IoSessionManagerFilterChain.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/IoSessionManagerFilterChain.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/IoSessionManagerFilterChain.java Sun May  1 23:27:27 2005
@@ -50,42 +50,42 @@
     {
         return new IoFilter()
         {
-            public void sessionOpened( NextFilter nextFilter, IoSession session )
+            public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionOpened( session );
             }
 
-            public void sessionClosed( NextFilter nextFilter, IoSession session )
+            public void sessionClosed( NextFilter nextFilter, IoSession session ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionClosed( session );
             }
 
             public void sessionIdle( NextFilter nextFilter, IoSession session,
-                                    IdleStatus status )
+                                    IdleStatus status ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).sessionIdle( session, status );
             }
 
             public void exceptionCaught( NextFilter nextFilter,
-                                        IoSession session, Throwable cause )
+                                        IoSession session, Throwable cause ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).exceptionCaught( session, cause );
             }
 
             public void dataRead( NextFilter nextFilter, IoSession session,
-                                 ByteBuffer buf )
+                                 ByteBuffer buf ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).dataRead( session, buf );
             }
 
             public void dataWritten( NextFilter nextFilter, IoSession session,
-                                    Object marker )
+                                    Object marker ) throws Exception
             {
                 ( ( IoSessionFilterChain ) session.getFilterChain() ).dataWritten( session, marker );
             }
 
             public void filterWrite( NextFilter nextFilter,
-                                     IoSession session, ByteBuffer buf, Object marker )
+                                     IoSession session, ByteBuffer buf, Object marker ) throws Exception
             {
                 nextFilter.filterWrite( session, buf, marker );
             }

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java Sun May  1 23:27:27 2005
@@ -30,10 +30,9 @@
 import java.util.Set;
 
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoAcceptor;
-import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoFilterChain;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSessionManagerFilterChain;
 import org.apache.mina.util.ExceptionUtil;
 import org.apache.mina.util.Queue;
@@ -78,12 +77,6 @@
     public void bind( SocketAddress address, IoHandler handler )
             throws IOException
     {
-        bind( address, handler, null );
-    }
-
-    public void bind( SocketAddress address, IoHandler handler, SessionInitializer initializer )
-            throws IOException
-    {
         if( address == null )
             throw new NullPointerException( "address" );
         if( handler == null )
@@ -95,12 +88,7 @@
         if( ( ( InetSocketAddress ) address ).getPort() == 0 )
             throw new IllegalArgumentException( "Unsupported port number: 0" );
         
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
-
-        RegistrationRequest request = new RegistrationRequest( address, handler, initializer );
+        RegistrationRequest request = new RegistrationRequest( address, handler );
         synchronized( this )
         {
             synchronized( registerQueue )
@@ -268,7 +256,7 @@
             
             try
             {
-                req.initializer.initializeSession( session );
+                req.handler.sessionCreated( session );
 
                 if( key.isReadable() )
                 {
@@ -528,18 +516,14 @@
         
         private final IoHandler handler;
         
-        private final SessionInitializer initializer;
-        
         private Throwable exception; 
         
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, IoHandler handler,
-                                     SessionInitializer initializer )
+        private RegistrationRequest( SocketAddress address, IoHandler handler )
         {
             this.address = address;
             this.handler = handler;
-            this.initializer = initializer;
         }
     }
 

Modified: directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/datagram/DatagramConnector.java Sun May  1 23:27:27 2005
@@ -28,10 +28,9 @@
 import java.util.Set;
 
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoConnector;
-import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoFilterChain;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
 import org.apache.mina.io.IoSessionManagerFilterChain;
 import org.apache.mina.util.ExceptionUtil;
@@ -74,41 +73,21 @@
 
     public IoSession connect( SocketAddress address, IoHandler handler ) throws IOException
     {
-        return connect( address, null, handler, null );
-    }
-
-    public IoSession connect( SocketAddress address, SocketAddress localAddress, IoHandler handler ) throws IOException
-    {
-        return connect( address, localAddress, handler, null );
+        return connect( address, null, handler);
     }
 
     public IoSession connect( SocketAddress address, int timeout, IoHandler handler ) throws IOException
     {
-        return connect( address, null, handler, null );
+        return connect( address, null, handler );
     }
 
     public IoSession connect( SocketAddress address, SocketAddress localAddress, int timeout, IoHandler handler ) throws IOException
     {
-        return connect( address, localAddress, handler, null );
-    }
-
-    public IoSession connect( SocketAddress address, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, handler, initializer );
-    }
-
-    public IoSession connect( SocketAddress address, int timeout, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, handler, initializer );
-    }
-
-    public IoSession connect( SocketAddress address, SocketAddress localAddress, int timeout, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, localAddress, handler, initializer );
+        return connect( address, localAddress, handler );
     }
 
     public IoSession connect( SocketAddress address, SocketAddress localAddress,
-                              IoHandler handler, SessionInitializer initializer ) throws IOException
+                              IoHandler handler ) throws IOException
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -125,11 +104,6 @@
                                                 + localAddress.getClass() );
         }
         
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
-
         DatagramChannel ch = DatagramChannel.open();
         boolean initialized = false;
         try
@@ -151,7 +125,7 @@
             }
         }
 
-        RegistrationRequest request = new RegistrationRequest( ch, handler, initializer );
+        RegistrationRequest request = new RegistrationRequest( ch, handler );
         synchronized( this )
         {
             synchronized( registerQueue )
@@ -446,7 +420,7 @@
 
             try
             {
-                req.initializer.initializeSession( session );
+                req.handler.sessionCreated( session );
 
                 SelectionKey key = req.channel.register( selector,
                         SelectionKey.OP_READ, session );
@@ -524,8 +498,6 @@
 
         private final IoHandler handler;
         
-        private final SessionInitializer initializer;
-
         private boolean done;
         
         private DatagramSession session;
@@ -533,11 +505,10 @@
         private Throwable exception;
 
         private RegistrationRequest( DatagramChannel channel,
-                                     IoHandler handler, SessionInitializer initializer )
+                                     IoHandler handler )
         {
             this.channel = channel;
             this.handler = handler;
-            this.initializer = initializer;
         }
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/BlacklistFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/filter/BlacklistFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/filter/BlacklistFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/filter/BlacklistFilter.java Sun May  1 23:27:27 2005
@@ -61,7 +61,7 @@
      * blacklisted.
      */
     public void dataRead( NextFilter nextFilter, IoSession session,
-                         ByteBuffer buf )
+                         ByteBuffer buf ) throws Exception
     {
         if( !isBlocked( session ) )
         {
@@ -74,7 +74,7 @@
      * Close connection immediately if the remote address of session is
      * blacklisted.
      */
-    public void sessionOpened( NextFilter nextFilter, IoSession session )
+    public void sessionOpened( NextFilter nextFilter, IoSession session ) throws Exception
     {
         if( isBlocked( session ) )
         {

Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java Sun May  1 23:27:27 2005
@@ -117,7 +117,7 @@
         }
     }
 
-    public void filterWrite( NextFilter nextFilter, IoSession session, ByteBuffer buf, Object marker )
+    public void filterWrite( NextFilter nextFilter, IoSession session, ByteBuffer buf, Object marker ) throws Exception
     {
         nextFilter.filterWrite( session, buf, marker );
     }

Modified: directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java Sun May  1 23:27:27 2005
@@ -23,8 +23,8 @@
 
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoFilter;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
 
 /**
@@ -34,7 +34,8 @@
  * {@link #log(IoSession, String, Throwable)} to log protocol-specific messages.
  * <p>
  * Set {@link #PREFIX}, {@link #LOGGER}, {@link #LEVEL} session attributes
- * to override prefix string, logger, and log level. (See {@link SessionInitializer})
+ * to override prefix string, logger, and log level.
+ * (See {@link IoHandler#sessionCreated(IoSession)}))
  * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)

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?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- 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 Sun May  1 23:27:27 2005
@@ -31,10 +31,9 @@
 import java.util.Set;
 
 import org.apache.mina.common.BaseSessionManager;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoAcceptor;
-import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoFilterChain;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSessionManagerFilterChain;
 import org.apache.mina.util.Queue;
 
@@ -84,19 +83,6 @@
      */
     public void bind( SocketAddress address, IoHandler handler ) throws IOException
     {
-        bind( address, handler, null );
-    }
-
-    /**
-     * Binds to the specified <code>address</code> and handles incoming
-     * connections with the specified <code>handler</code>.  Backlog value
-     * is configured to the value of <code>backlog</code> property.
-     *
-     * @throws IOException if failed to bind
-     */
-    public void bind( SocketAddress address, IoHandler handler,
-                      SessionInitializer initializer ) throws IOException
-    {
         if( address == null )
         {
             throw new NullPointerException( "address" );
@@ -117,12 +103,7 @@
             throw new IllegalArgumentException( "Unsupported port number: 0" );
         }
         
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
-
-        RegistrationRequest request = new RegistrationRequest( address, backlog, handler, initializer );
+        RegistrationRequest request = new RegistrationRequest( address, backlog, handler );
 
         synchronized( this )
         {
@@ -310,7 +291,7 @@
                 {
                     RegistrationRequest req = ( RegistrationRequest ) key.attachment();
                     SocketSession session = new SocketSession( filters, ch, req.handler );
-                    req.initializer.initializeSession( session );
+                    req.handler.sessionCreated( session );
                     SocketIoProcessor.getInstance().addSession( session );
                     success = true;
                 }
@@ -461,19 +442,15 @@
 
         private final IoHandler handler;
         
-        private final SessionInitializer initializer;
-        
         private IOException exception; 
         
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, int backlog, IoHandler handler,
-                                     SessionInitializer initializer )
+        private RegistrationRequest( SocketAddress address, int backlog, IoHandler handler )
         {
             this.address = address;
             this.backlog = backlog;
             this.handler = handler;
-            this.initializer = initializer;
         }
     }
 

Modified: directory/network/trunk/src/java/org/apache/mina/io/socket/SocketConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/socket/SocketConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/socket/SocketConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/io/socket/SocketConnector.java Sun May  1 23:27:27 2005
@@ -29,12 +29,12 @@
 import java.util.Set;
 
 import org.apache.mina.common.BaseSessionManager;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoConnector;
-import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoFilterChain;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
 import org.apache.mina.io.IoSessionManagerFilterChain;
+import org.apache.mina.util.ExceptionUtil;
 import org.apache.mina.util.Queue;
 
 /**
@@ -69,42 +69,21 @@
 
     public IoSession connect( SocketAddress address, IoHandler handler ) throws IOException
     {
-        return connect( address, null, Integer.MAX_VALUE, handler, null);
+        return connect( address, null, Integer.MAX_VALUE, handler);
     }
 
     public IoSession connect( SocketAddress address, SocketAddress localAddress, IoHandler handler ) throws IOException
     {
-        return connect( address, localAddress, Integer.MAX_VALUE, handler, null);
+        return connect( address, localAddress, Integer.MAX_VALUE, handler);
     }
 
     public IoSession connect( SocketAddress address, int timeout, IoHandler handler ) throws IOException
     {
-        return connect( address, null, timeout, handler, null);
-    }
-
-    public IoSession connect( SocketAddress address, SocketAddress localAddress, int timeout, IoHandler handler ) throws IOException
-    {
-        return connect( address, localAddress, timeout, handler, null);
-    }
-
-    public IoSession connect( SocketAddress address, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, Integer.MAX_VALUE, handler, initializer );
-    }
-
-    public IoSession connect( SocketAddress address, SocketAddress localAddress, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, localAddress, Integer.MAX_VALUE, handler, initializer );
-    }
-
-    public IoSession connect( SocketAddress address, int timeout, IoHandler handler, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, timeout, handler, initializer );
+        return connect( address, null, timeout, handler);
     }
 
     public IoSession connect( SocketAddress address, SocketAddress localAddress,
-                              int timeout, IoHandler handler,
-                              SessionInitializer initializer ) throws IOException
+                              int timeout, IoHandler handler ) throws IOException
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -122,11 +101,6 @@
             throw new IllegalArgumentException( "Unexpected local address type: "
                                                 + localAddress.getClass() );
 
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
-
         SocketChannel ch = SocketChannel.open();
         boolean success = false;
         try
@@ -141,7 +115,7 @@
 
             if( ch.connect( address ) )
             {
-                SocketSession session = newSession( ch, handler, initializer );
+                SocketSession session = newSession( ch, handler );
                 success = true;
                 return session;
             }
@@ -156,7 +130,7 @@
             }
         }
         
-        ConnectionRequest request = new ConnectionRequest( ch, timeout, handler, initializer );
+        ConnectionRequest request = new ConnectionRequest( ch, timeout, handler );
         synchronized( this )
         {
             synchronized( connectQueue )
@@ -183,7 +157,7 @@
 
         if( request.exception != null )
         {
-            throw request.exception;
+            ExceptionUtil.throwException( request.exception );
         }
 
         return request.session;
@@ -248,10 +222,10 @@
             try
             {
                 ch.finishConnect();
-                SocketSession session = newSession( ch, entry.handler, entry.initializer );
+                SocketSession session = newSession( ch, entry.handler );
                 entry.session = session;
             }
-            catch( IOException e )
+            catch( Throwable e )
             {
                 entry.exception = e;
             }
@@ -310,10 +284,17 @@
         }
     }
 
-    private SocketSession newSession( SocketChannel ch, IoHandler handler, SessionInitializer initializer ) throws IOException
+    private SocketSession newSession( SocketChannel ch, IoHandler handler ) throws IOException
     {
         SocketSession session = new SocketSession( filters, ch, handler );
-        initializer.initializeSession( session );
+        try
+        {
+            handler.sessionCreated( session );
+        }
+        catch( Throwable e )
+        {
+            ExceptionUtil.throwException( e );
+        }
         SocketIoProcessor.getInstance().addSession( session );
         return session;
     }
@@ -379,20 +360,17 @@
 
         private final IoHandler handler;
         
-        private final SessionInitializer initializer;
-
         private SocketSession session;
 
         private boolean done;
 
-        private IOException exception;
+        private Throwable exception;
 
-        private ConnectionRequest( SocketChannel channel, int timeout, IoHandler handler, SessionInitializer initializer )
+        private ConnectionRequest( SocketChannel channel, int timeout, IoHandler handler )
         {
             this.channel = channel;
             this.deadline = System.currentTimeMillis() + timeout * 1000L;
             this.handler = handler;
-            this.initializer = initializer;
         }
     }
 

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/AbstractProtocolFilterChain.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/AbstractProtocolFilterChain.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/AbstractProtocolFilterChain.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/AbstractProtocolFilterChain.java Sun May  1 23:27:27 2005
@@ -120,43 +120,43 @@
     {
         return new ProtocolFilter()
         {
-            public void sessionOpened( NextFilter nextFilter, ProtocolSession session )
+            public void sessionOpened( NextFilter nextFilter, ProtocolSession session ) throws Exception
             {
                 session.getHandler().sessionOpened( session );
             }
 
-            public void sessionClosed( NextFilter nextFilter, ProtocolSession session )
+            public void sessionClosed( NextFilter nextFilter, ProtocolSession session ) throws Exception
             {
                 session.getHandler().sessionClosed( session );
             }
 
             public void sessionIdle( NextFilter nextFilter, ProtocolSession session,
-                                    IdleStatus status )
+                                    IdleStatus status ) throws Exception
             {
                 session.getHandler().sessionIdle( session, status );
             }
 
             public void exceptionCaught( NextFilter nextFilter,
-                                        ProtocolSession session, Throwable cause )
+                                        ProtocolSession session, Throwable cause ) throws Exception
             {
                 session.getHandler().exceptionCaught( session, cause );
             }
 
             public void messageReceived( NextFilter nextFilter, ProtocolSession session,
-                                         Object message )
+                                         Object message ) throws Exception
             {
                 ProtocolHandler handler = session.getHandler();
                 handler.messageReceived( session, message );
             }
 
             public void messageSent( NextFilter nextFilter, ProtocolSession session,
-                                     Object message )
+                                     Object message ) throws Exception
             {
                 session.getHandler().messageSent( session, message );
             }
 
             public void filterWrite( NextFilter nextFilter,
-                                     ProtocolSession session, Object message )
+                                     ProtocolSession session, Object message ) throws Exception
             {
                 nextFilter.filterWrite( session, message );
             }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolAcceptor.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolAcceptor.java Sun May  1 23:27:27 2005
@@ -21,8 +21,6 @@
 import java.io.IOException;
 import java.net.SocketAddress;
 
-import org.apache.mina.common.SessionInitializer;
-
 /**
  * Accepts incoming connection, communicates with clients, and fires events to
  * {@link ProtocolHandler}s.
@@ -41,8 +39,6 @@
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
- * 
- * @see SessionInitializer
  */
 public interface ProtocolAcceptor extends ProtocolSessionManager
 {
@@ -53,15 +49,6 @@
      * @throws IOException if failed to bind
      */
     void bind( SocketAddress address, ProtocolProvider protocolProvider )
-            throws IOException;
-
-    /**
-     * Binds to the specified <code>address</code> and handles incoming
-     * connections with the specified <code>protocolProvider</code>.
-     * 
-     * @throws IOException if failed to bind
-     */
-    void bind( SocketAddress address, ProtocolProvider protocolProvider, SessionInitializer initializer )
             throws IOException;
 
     /**

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolConnector.java Sun May  1 23:27:27 2005
@@ -21,8 +21,6 @@
 import java.io.IOException;
 import java.net.SocketAddress;
 
-import org.apache.mina.common.SessionInitializer;
-
 /**
  * Connects to endpoint, communicates with the server, and fires events to
  * {@link ProtocolProvider}s.
@@ -41,8 +39,6 @@
  * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
- * 
- * @see SessionInitializer
  */
 public interface ProtocolConnector extends ProtocolSessionManager
 {
@@ -87,50 +83,4 @@
      */
     ProtocolSession connect( SocketAddress address, SocketAddress localAddress,
                              int timeout, ProtocolProvider protocolProvider ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code>.  If communication starts
-     * successfully, events are fired to the specified
-     * <code>protocolProvider</code>.  This method blocks.
-     * 
-     * @throws IOException if failed to connect
-     */
-    ProtocolSession connect( SocketAddress address,
-                             ProtocolProvider protocolProvider,
-                             SessionInitializer initializer ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code>.  If communication starts
-     * successfully, events are fired to the specified
-     * <code>protocolProvider</code>.  This method blocks.
-     * 
-     * @param localAddress the local address the channel is bound to
-     * @throws IOException if failed to connect
-     */
-    ProtocolSession connect( SocketAddress address, SocketAddress localAddress,
-                             ProtocolProvider protocolProvider,
-                             SessionInitializer initializer ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code> with timeout.  If
-     * communication starts successfully, events are fired to the specified
-     * <code>protocolProvider</code>.  This method blocks.
-     * 
-     * @throws IOException if failed to connect
-     */
-    ProtocolSession connect( SocketAddress address, int timeout,
-                             ProtocolProvider protocolProvider,
-                             SessionInitializer initializer ) throws IOException;
-
-    /**
-     * Connects to the specified <code>address</code> with timeout.  If
-     * communication starts successfully, events are fired to the specified
-     * <code>protocolProvider</code>.  This method blocks.
-     * 
-     * @param localAddress the local address the channel is bound to
-     * @throws IOException if failed to connect
-     */
-    ProtocolSession connect( SocketAddress address, SocketAddress localAddress,
-                             int timeout, ProtocolProvider protocolProvider,
-                             SessionInitializer initializer ) throws IOException;
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolFilter.java Sun May  1 23:27:27 2005
@@ -46,48 +46,54 @@
     /**
      * Filters {@link ProtocolHandler#sessionOpened(ProtocolSession)} event.
      */
-    void sessionOpened( NextFilter nextFilter, ProtocolSession session );
+    void sessionOpened( NextFilter nextFilter, ProtocolSession session ) throws Exception;
 
     /**
      * Filters {@link ProtocolHandler#sessionClosed(ProtocolSession)} event.
      */
-    void sessionClosed( NextFilter nextFilter, ProtocolSession session );
+    void sessionClosed( NextFilter nextFilter, ProtocolSession session ) throws Exception;
 
     /**
      * Filters {@link ProtocolHandler#sessionIdle(ProtocolSession,IdleStatus)}
      * event.
      */
     void sessionIdle( NextFilter nextFilter, ProtocolSession session,
-                     IdleStatus status );
+                     IdleStatus status ) throws Exception;
 
     /**
      * Filters {@link ProtocolHandler#exceptionCaught(ProtocolSession,Throwable)}
      * event.
      */
     void exceptionCaught( NextFilter nextFilter,
-                         ProtocolSession session, Throwable cause );
+                         ProtocolSession session, Throwable cause ) throws Exception;
 
     /**
      * Filters {@link ProtocolHandler#messageReceived(ProtocolSession,Object)}
      * event.
      */
     void messageReceived( NextFilter nextFilter,
-                         ProtocolSession session, Object message );
+                         ProtocolSession session, Object message ) throws Exception;
 
     /**
      * Filters {@link ProtocolHandler#messageSent(ProtocolSession,Object)}
      * event.
      */
     void messageSent( NextFilter nextFilter, ProtocolSession session,
-                     Object message );
+                     Object message ) throws Exception;
 
     /**
      * Filters {@link ProtocolSession#write(Object)} method invocation.
      */
-    void filterWrite( NextFilter nextFilter, ProtocolSession session, Object message );
+    void filterWrite( NextFilter nextFilter, ProtocolSession session, Object message ) throws Exception;
     
-    public interface NextFilter extends ProtocolHandler
+    public interface NextFilter
     {
+        void sessionOpened( ProtocolSession session );
+        void sessionClosed( ProtocolSession session );
+        void sessionIdle( ProtocolSession session, IdleStatus status );
+        void exceptionCaught( ProtocolSession session, Throwable cause );
+        void messageReceived( ProtocolSession session, Object message );
+        void messageSent( ProtocolSession session, Object message );
         void filterWrite( ProtocolSession session, Object message );
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandler.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandler.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandler.java Sun May  1 23:27:27 2005
@@ -40,39 +40,45 @@
 public interface ProtocolHandler
 {
     /**
+     * Invoked when the session is created.  Initialize default socket
+     * parameters and user-defined attributes here.
+     */
+    void sessionCreated( ProtocolSession session ) throws Exception;
+    
+    /**
      * Invoked when the connection is opened.  This method is not invoked if the
      * transport type is UDP.
      */
-    void sessionOpened( ProtocolSession session );
+    void sessionOpened( ProtocolSession session ) throws Exception;
 
     /**
      * Invoked when the connection is closed.  This method is not invoked if the
      * transport type is UDP.
      */
-    void sessionClosed( ProtocolSession session );
+    void sessionClosed( ProtocolSession session ) throws Exception;
 
     /**
      * Invoked when the connection is idle.  Refer to {@link IdleStatus}.  This
      * method is not invoked if the transport type is UDP.
      */
-    void sessionIdle( ProtocolSession session, IdleStatus status );
+    void sessionIdle( ProtocolSession session, IdleStatus status ) throws Exception;
 
     /**
      * Invoked when any exception is thrown by user {@link ProtocolHandler}
      * implementation or by MINA.  If <code>cause</code> is instanceof
      * {@link IOException}, MINA will close the connection automatically.
      */
-    void exceptionCaught( ProtocolSession session, Throwable cause );
+    void exceptionCaught( ProtocolSession session, Throwable cause ) throws Exception;
 
     /**
      * Invoked when protocol message is received.  Implement your protocol flow
      * here.
      */
-    void messageReceived( ProtocolSession session, Object message );
+    void messageReceived( ProtocolSession session, Object message ) throws Exception;
 
     /**
      * Invoked when protocol message that user requested by
      * {@link ProtocolSession#write(Object)} is sent out actually.
      */
-    void messageSent( ProtocolSession session, Object message );
+    void messageSent( ProtocolSession session, Object message ) throws Exception;
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandlerAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandlerAdapter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandlerAdapter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/ProtocolHandlerAdapter.java Sun May  1 23:27:27 2005
@@ -19,6 +19,7 @@
 package org.apache.mina.protocol;
 
 import org.apache.mina.common.IdleStatus;
+import org.apache.mina.util.SessionUtil;
 
 /**
  * An abstract adapter class for {@link ProtocolHandler}.  You can extend this
@@ -30,28 +31,32 @@
  */
 public class ProtocolHandlerAdapter implements ProtocolHandler
 {
+    public void sessionCreated( ProtocolSession session ) throws Exception
+    {
+        SessionUtil.initialize( session );
+    }
 
-    public void sessionOpened( ProtocolSession session )
+    public void sessionOpened( ProtocolSession session ) throws Exception
     {
     }
 
-    public void sessionClosed( ProtocolSession session )
+    public void sessionClosed( ProtocolSession session ) throws Exception
     {
     }
 
-    public void sessionIdle( ProtocolSession session, IdleStatus status )
+    public void sessionIdle( ProtocolSession session, IdleStatus status ) throws Exception
     {
     }
 
-    public void exceptionCaught( ProtocolSession session, Throwable cause )
+    public void exceptionCaught( ProtocolSession session, Throwable cause ) throws Exception
     {
     }
 
-    public void messageReceived( ProtocolSession session, Object message )
+    public void messageReceived( ProtocolSession session, Object message ) throws Exception
     {
     }
 
-    public void messageSent( ProtocolSession session, Object message )
+    public void messageSent( ProtocolSession session, Object message ) throws Exception
     {
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java Sun May  1 23:27:27 2005
@@ -22,8 +22,8 @@
 import java.util.logging.Logger;
 
 import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.protocol.ProtocolFilter;
+import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolSession;
 
 /**
@@ -33,7 +33,8 @@
  * {@link #log(ProtocolSession, String, Throwable)} to log protocol-specific messages.
  * <p>
  * Set {@link #PREFIX}, {@link #LOGGER}, {@link #LEVEL} session attributes
- * to override prefix string, logger, and log level. (See {@link SessionInitializer})
+ * to override prefix string, logger, and log level in
+ * {@link ProtocolHandler#sessionCreated(ProtocolSession)}.
  * 
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @author Trustin Lee (trustin@apache.org)

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/io/IoAdapter.java Sun May  1 23:27:27 2005
@@ -99,6 +99,10 @@
             codecFactory = protocolProvider.getCodecFactory();
             this.handler = protocolProvider.getHandler();
         }
+        
+        public void sessionCreated( IoSession session )
+        {
+        }
 
         public void sessionOpened( IoSession session )
         {

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolAcceptor.java Sun May  1 23:27:27 2005
@@ -7,7 +7,6 @@
 import java.net.SocketAddress;
 
 import org.apache.mina.common.ExceptionMonitor;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoAcceptor;
 import org.apache.mina.io.IoSession;
 import org.apache.mina.protocol.ProtocolAcceptor;
@@ -57,12 +56,6 @@
         acceptor.bind( address, adapter.adapt( provider ) );
     }
     
-    public void bind( SocketAddress address, ProtocolProvider provider,
-                      SessionInitializer initializer ) throws IOException
-    {
-        acceptor.bind( address, adapter.adapt( provider ), initializer );
-    }
-
     public void unbind( SocketAddress address )
     {
         acceptor.unbind( address );
@@ -73,16 +66,6 @@
         return adapter.getFilterChain();
     }
     
-    public SessionInitializer getDefaultSessionInitializer()
-    {
-        return acceptor.getDefaultSessionInitializer();
-    }
-    
-    public void setDefaultSessionInitializer( SessionInitializer defaultInitializer )
-    {
-        acceptor.setDefaultSessionInitializer( defaultInitializer );
-    }
-
     public ExceptionMonitor getExceptionMonitor()
     {
         return acceptor.getExceptionMonitor();

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/io/IoProtocolConnector.java Sun May  1 23:27:27 2005
@@ -7,7 +7,6 @@
 import java.net.SocketAddress;
 
 import org.apache.mina.common.ExceptionMonitor;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.io.IoConnector;
 import org.apache.mina.io.IoSession;
 import org.apache.mina.protocol.ProtocolConnector;
@@ -82,52 +81,9 @@
         return adapter.toProtocolSession( session );
     }
 
-    public ProtocolSession connect( SocketAddress address,
-                                    ProtocolProvider provider,
-                                    SessionInitializer initializer ) throws IOException
-    {
-        IoSession session = connector.connect(
-                address, adapter.adapt( provider ), initializer );
-        return adapter.toProtocolSession( session );
-    }
-
-    public ProtocolSession connect( SocketAddress address, SocketAddress localAddress,
-                                    ProtocolProvider provider, SessionInitializer initializer ) throws IOException
-    {
-        IoSession session = connector.connect(
-                address, localAddress, adapter.adapt( provider ), initializer );
-        return adapter.toProtocolSession( session );
-    }
-
-    public ProtocolSession connect( SocketAddress address, int timeout,
-                                    ProtocolProvider provider, SessionInitializer initializer ) throws IOException
-    {
-        IoSession session = connector.connect(
-                address, timeout, adapter.adapt( provider ), initializer );
-        return adapter.toProtocolSession( session );
-    }
-
-    public ProtocolSession connect( SocketAddress address, SocketAddress localAddress,
-                                    int timeout, ProtocolProvider provider, SessionInitializer initializer ) throws IOException
-    {
-        IoSession session = connector.connect(
-                address, localAddress, timeout, adapter.adapt( provider ), initializer );
-        return adapter.toProtocolSession( session );
-    }
-
     public ProtocolFilterChain getFilterChain()
     {
         return adapter.getFilterChain();
-    }
-
-    public SessionInitializer getDefaultSessionInitializer()
-    {
-        return connector.getDefaultSessionInitializer();
-    }
-    
-    public void setDefaultSessionInitializer( SessionInitializer defaultInitializer )
-    {
-        connector.setDefaultSessionInitializer( defaultInitializer );
     }
 
     public ExceptionMonitor getExceptionMonitor()

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeAcceptor.java Sun May  1 23:27:27 2005
@@ -9,10 +9,9 @@
 import java.util.Map;
 
 import org.apache.mina.common.BaseSessionManager;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.protocol.ProtocolAcceptor;
-import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolFilterChain;
+import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolProvider;
 
 /**
@@ -39,12 +38,6 @@
     
     public void bind( SocketAddress address, ProtocolProvider protocolProvider ) throws IOException
     {
-        bind( address, protocolProvider, null );
-    }
-
-    public void bind( SocketAddress address, ProtocolProvider protocolProvider,
-                      SessionInitializer initializer ) throws IOException
-    {
         if( address == null )
             throw new NullPointerException( "address" );
         if( protocolProvider == null )
@@ -52,10 +45,6 @@
         if( !( address instanceof VmPipeAddress ) )
             throw new IllegalArgumentException(
                     "address must be VmPipeAddress." );
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
 
         synchronized( boundHandlers )
         {
@@ -68,8 +57,7 @@
                                new Entry( this,
                                           ( VmPipeAddress ) address,
                                           filterChain,
-                                          protocolProvider.getHandler(),
-                                          initializer ) );
+                                          protocolProvider.getHandler() ) );
         }
     }
 
@@ -99,19 +87,15 @@
 
         final ProtocolHandler handler;
         
-        final SessionInitializer initializer;
-
         private Entry( VmPipeAcceptor acceptor,
                        VmPipeAddress address,
                        VmPipeSessionManagerFilterChain managerFilterChain,
-                       ProtocolHandler handler,
-                       SessionInitializer initializer )
+                       ProtocolHandler handler )
         {
             this.acceptor = acceptor;
             this.address = address;
             this.managerFilterChain = managerFilterChain;
             this.handler = handler;
-            this.initializer = initializer;
         }
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeConnector.java Sun May  1 23:27:27 2005
@@ -7,7 +7,6 @@
 import java.net.SocketAddress;
 
 import org.apache.mina.common.BaseSessionManager;
-import org.apache.mina.common.SessionInitializer;
 import org.apache.mina.protocol.ProtocolConnector;
 import org.apache.mina.protocol.ProtocolFilterChain;
 import org.apache.mina.protocol.ProtocolProvider;
@@ -41,36 +40,21 @@
 
     public ProtocolSession connect( SocketAddress address, ProtocolProvider protocolProvider ) throws IOException 
     {
-        return connect( address, null, Integer.MAX_VALUE, protocolProvider, null );
+        return connect( address, null, Integer.MAX_VALUE, protocolProvider );
     }
 
     public ProtocolSession connect( SocketAddress address, SocketAddress localAddress, ProtocolProvider protocolProvider ) throws IOException
     {
-        return connect( address, localAddress, Integer.MAX_VALUE, protocolProvider, null );
+        return connect( address, localAddress, Integer.MAX_VALUE, protocolProvider );
     }
 
     public ProtocolSession connect( SocketAddress address, int timeout, ProtocolProvider protocolProvider ) throws IOException
     {
-        return connect( address, null, timeout, protocolProvider, null );
+        return connect( address, null, timeout, protocolProvider );
     }
 
     public ProtocolSession connect( SocketAddress address, SocketAddress localAddress, int timeout, ProtocolProvider protocolProvider ) throws IOException
     {
-        return connect( address, localAddress, timeout, protocolProvider, null );
-    }
-
-    public ProtocolSession connect( SocketAddress address, SocketAddress localAddress, ProtocolProvider protocolProvider, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, localAddress, Integer.MAX_VALUE, protocolProvider, initializer );
-    }
-
-    public ProtocolSession connect( SocketAddress address, int timeout, ProtocolProvider protocolProvider, SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, timeout, protocolProvider, initializer );
-    }
-
-    public ProtocolSession connect( SocketAddress address, SocketAddress localAddress, int timeout, ProtocolProvider protocolProvider, SessionInitializer initializer ) throws IOException
-    {
         if( address == null )
             throw new NullPointerException( "address" );
         if( protocolProvider == null )
@@ -79,11 +63,6 @@
             throw new IllegalArgumentException(
                                                 "address must be VmPipeAddress." );
 
-        if( initializer == null )
-        {
-            initializer = defaultInitializer;
-        }
-
         Entry entry = ( Entry ) VmPipeAcceptor.boundHandlers.get( address );
         if( entry == null )
             throw new IOException( "Endpoint unavailable: " + address );
@@ -92,17 +71,9 @@
                                                    AnonymousVmPipeAddress.INSTANCE,
                                                    filterChain,
                                                    protocolProvider.getHandler(),
-                                                   initializer,
                                                    entry );
 
         VmPipeIdleStatusChecker.INSTANCE.addSession( session );
         return session;
-    }
-
-    public ProtocolSession connect( SocketAddress address,
-                                    ProtocolProvider protocolProvider,
-                                    SessionInitializer initializer ) throws IOException
-    {
-        return connect( address, null, Integer.MAX_VALUE, protocolProvider, initializer);
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeFilter.java?rev=165586&r1=165585&r2=165586&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeFilter.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/vmpipe/VmPipeFilter.java Sun May  1 23:27:27 2005
@@ -4,7 +4,6 @@
 package org.apache.mina.protocol.vmpipe;
 
 import org.apache.mina.common.IdleStatus;
-import org.apache.mina.protocol.ProtocolHandler;
 import org.apache.mina.protocol.ProtocolFilterAdapter;
 import org.apache.mina.protocol.ProtocolSession;
 
@@ -32,7 +31,7 @@
         nextFilter.messageReceived( session, message );
     }
 
-    public void messageSent( ProtocolHandler nextHandler,
+    public void messageSent( NextFilter nextFilter,
                             ProtocolSession session, Object message )
     {
         VmPipeSession vps = ( VmPipeSession ) session;
@@ -40,6 +39,6 @@
         vps.setIdle( IdleStatus.WRITER_IDLE, false );
         vps.increaseWrittenBytes( 1 );
 
-        nextHandler.messageSent( session, message );
+        nextFilter.messageSent( session, message );
     }
 }



Mime
View raw message