directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r372453 - in /directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina: common/ common/support/ transport/socket/nio/support/ transport/vmpipe/ transport/vmpipe/support/
Date Thu, 26 Jan 2006 05:38:23 GMT
Author: trustin
Date: Wed Jan 25 21:38:13 2006
New Revision: 372453

URL: http://svn.apache.org/viewcvs?rev=372453&view=rev
Log:
Modified IoAcceptor and IoConnector to accept IoServiceConfig as a configuration parameter
for more flexibility

Modified:
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
    directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoAcceptor.java
Wed Jan 25 21:38:13 2006
@@ -57,7 +57,7 @@
      * @param config the configuration
      * @throws IOException if failed to bind
      */
-    void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config ) throws
IOException;
+    void bind( SocketAddress address, IoHandler handler, IoServiceConfig config ) throws
IOException;
 
     /**
      * Unbinds from the specified <code>address</code> and disconnects all clients

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/IoConnector.java
Wed Jan 25 21:38:13 2006
@@ -59,7 +59,7 @@
      * @return {@link ConnectFuture} that will tell the result of the connection attempt
      */
     ConnectFuture connect( SocketAddress address, IoHandler handler,
-                           IoConnectorConfig config );
+                           IoServiceConfig config );
 
     /**
      * Connects to the specified <code>address</code>.  If communication starts
@@ -81,5 +81,5 @@
      * @return {@link ConnectFuture} that will tell the result of the connection attempt
      */
     ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                           IoHandler handler, IoConnectorConfig config );
+                           IoHandler handler, IoServiceConfig config );
 }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoAcceptor.java
Wed Jan 25 21:38:13 2006
@@ -22,7 +22,6 @@
 import java.net.SocketAddress;
 
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
 
@@ -40,7 +39,7 @@
     
     public void bind( SocketAddress address, IoHandler handler ) throws IOException
     {
-        this.bind( address, handler, ( IoAcceptorConfig ) getDefaultConfig() );
+        this.bind( address, handler, getDefaultConfig() );
     }
     
     public IoSession newSession( SocketAddress remoteAddress, SocketAddress localAddress
)

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/BaseIoConnector.java
Wed Jan 25 21:38:13 2006
@@ -22,7 +22,6 @@
 
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
 
 /**
@@ -39,11 +38,11 @@
     
     public ConnectFuture connect( SocketAddress address, IoHandler handler )
     {
-        return connect( address, handler, ( IoConnectorConfig ) getDefaultConfig() );
+        return connect( address, handler, getDefaultConfig() );
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress, IoHandler
handler )
     {
-        return connect( address, localAddress, handler, ( IoConnectorConfig ) getDefaultConfig()
);
+        return connect( address, localAddress, handler, getDefaultConfig() );
     }
 }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoAcceptor.java
Wed Jan 25 21:38:13 2006
@@ -23,7 +23,6 @@
 import java.util.Set;
 
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
@@ -59,7 +58,7 @@
         delegate.bind( address, handler );
     }
 
-    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
throws IOException
+    public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config )
throws IOException
     {
         delegate.bind( address, handler, config );
     }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/common/support/DelegatedIoConnector.java
Wed Jan 25 21:38:13 2006
@@ -23,7 +23,6 @@
 
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 
@@ -58,7 +57,7 @@
         return delegate.connect( address, handler );
     }
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoConnectorConfig
config )
+    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoServiceConfig
config )
     {
         return delegate.connect( address, handler, config );
     }
@@ -70,7 +69,7 @@
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                                  IoHandler handler, IoConnectorConfig config )
+                                  IoHandler handler, IoServiceConfig config )
     {
         return delegate.connect( address, localAddress, handler, config );
     }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramAcceptorDelegate.java
Wed Jan 25 21:38:13 2006
@@ -32,7 +32,6 @@
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSession;
@@ -70,7 +69,7 @@
         this.wrapper = wrapper;
     }
 
-    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
+    public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config )
             throws IOException
     {
         if( address == null )
@@ -79,7 +78,7 @@
             throw new NullPointerException( "handler" );
         if( config == null )
         {
-            config = ( IoAcceptorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
 
         if( !( address instanceof InetSocketAddress ) )
@@ -195,7 +194,7 @@
         RegistrationRequest req = ( RegistrationRequest ) key.attachment();
         DatagramSessionImpl s = new DatagramSessionImpl(
                 wrapper, this,
-                ( DatagramSessionConfig ) req.config, ch, req.handler );
+                req.config.getSessionConfig(), ch, req.handler );
         s.setRemoteAddress( remoteAddress );
         s.setSelectionKey( key );
         
@@ -329,7 +328,7 @@
             RegistrationRequest req = ( RegistrationRequest ) key.attachment();
             DatagramSessionImpl session = new DatagramSessionImpl(
                     wrapper, this,
-                    ( DatagramSessionConfig ) req.config.getSessionConfig(),
+                    req.config.getSessionConfig(),
                     ch, req.handler );
             session.setSelectionKey( key );
             
@@ -615,12 +614,12 @@
     {
         private final SocketAddress address;
         private final IoHandler handler;
-        private final IoAcceptorConfig config;
+        private final IoServiceConfig config;
 
         private Throwable exception; 
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, IoHandler handler, IoAcceptorConfig
config )
+        private RegistrationRequest( SocketAddress address, IoHandler handler, IoServiceConfig
config )
         {
             this.address = address;
             this.handler = handler;

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramConnectorDelegate.java
Wed Jan 25 21:38:13 2006
@@ -31,7 +31,6 @@
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoConnector;
-import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoFilter.WriteRequest;
@@ -68,13 +67,13 @@
         this.wrapper = wrapper;
     }
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoConnectorConfig
config )
+    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoServiceConfig
config )
     {
         return connect( address, null, handler, config );
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                                  IoHandler handler, IoConnectorConfig config )
+                                  IoHandler handler, IoServiceConfig config )
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -93,7 +92,7 @@
         
         if( config == null )
         {
-            config = ( IoConnectorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
         
         DatagramChannel ch = null;
@@ -540,7 +539,7 @@
 
             DatagramSessionImpl session = new DatagramSessionImpl(
                     wrapper, this,
-                    ( DatagramSessionConfig ) req.config.getSessionConfig(),
+                    req.config.getSessionConfig(),
                     req.channel, req.handler );
 
             boolean success = false;
@@ -618,11 +617,11 @@
     {
         private final DatagramChannel channel;
         private final IoHandler handler;
-        private final IoConnectorConfig config;
+        private final IoServiceConfig config;
 
         private RegistrationRequest( DatagramChannel channel,
                                      IoHandler handler,
-                                     IoConnectorConfig config )
+                                     IoServiceConfig config )
         {
             this.channel = channel;
             this.handler = handler;

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/DatagramSessionImpl.java
Wed Jan 25 21:38:13 2006
@@ -61,7 +61,7 @@
      */
     DatagramSessionImpl( IoService wrapperManager,
                          DatagramService managerDelegate,
-                         DatagramSessionConfig config,
+                         IoSessionConfig config,
                          DatagramChannel ch, IoHandler defaultHandler )
     {
         this.wrapperManager = wrapperManager;
@@ -74,12 +74,16 @@
         this.localAddress = ch.socket().getLocalSocketAddress();
         
         // Apply the initial session settings
-        this.config.setBroadcast( config.isBroadcast() );
-        this.config.setReceiveBufferSize( config.getReceiveBufferSize() );
-        this.readBufferSize = config.getReceiveBufferSize();
-        this.config.setReuseAddress( config.isReuseAddress() );
-        this.config.setSendBufferSize( config.getSendBufferSize() );
-        this.config.setTrafficClass( config.getTrafficClass() );
+        if( config instanceof DatagramSessionConfig )
+        {
+            DatagramSessionConfig cfg = ( DatagramSessionConfig ) config;
+            this.config.setBroadcast( cfg.isBroadcast() );
+            this.config.setReceiveBufferSize( cfg.getReceiveBufferSize() );
+            this.readBufferSize = cfg.getReceiveBufferSize();
+            this.config.setReuseAddress( cfg.isReuseAddress() );
+            this.config.setSendBufferSize( cfg.getSendBufferSize() );
+            this.config.setTrafficClass( cfg.getTrafficClass() );
+        }
     }
     
     public IoService getService()

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
Wed Jan 25 21:38:13 2006
@@ -85,7 +85,7 @@
      *
      * @throws IOException if failed to bind
      */
-    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
throws IOException
+    public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config )
throws IOException
     {
         if( address == null )
         {
@@ -109,7 +109,7 @@
         
         if( config == null )
         {
-            config = ( IoAcceptorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
         
         RegistrationRequest request = new RegistrationRequest( address, handler, config );
@@ -230,8 +230,18 @@
         
         
         // Disconnect all clients
-        if( request.registrationRequest.config.isDisconnectOnUnbind() &&
-            managedSessions != null )
+        IoServiceConfig cfg = request.registrationRequest.config;
+        boolean disconnectOnUnbind;
+        if( cfg instanceof IoAcceptorConfig )
+        {
+            disconnectOnUnbind = ( ( IoAcceptorConfig ) cfg ).isDisconnectOnUnbind();
+        }
+        else
+        {
+            disconnectOnUnbind = ( ( IoAcceptorConfig ) getDefaultConfig() ).isDisconnectOnUnbind();
+        }
+
+        if( disconnectOnUnbind && managedSessions != null )
         {
             IoSession[] tempSessions = ( IoSession[] ) 
                                   managedSessions.toArray( new IoSession[ 0 ] );
@@ -543,11 +553,11 @@
     {
         private final SocketAddress address;
         private final IoHandler handler;
-        private final IoAcceptorConfig config;
+        private final IoServiceConfig config;
         private IOException exception;
         private boolean done;
         
-        private RegistrationRequest( SocketAddress address, IoHandler handler, IoAcceptorConfig
config )
+        private RegistrationRequest( SocketAddress address, IoHandler handler, IoServiceConfig
config )
         {
             this.address = address;
             this.handler = handler;

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
Wed Jan 25 21:38:13 2006
@@ -38,7 +38,6 @@
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.transport.socket.nio.SocketConnectorConfig;
-import org.apache.mina.transport.socket.nio.SocketSessionConfig;
 import org.apache.mina.util.Queue;
 
 /**
@@ -68,13 +67,13 @@
         this.wrapper = wrapper;
     }
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoConnectorConfig
config )
+    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoServiceConfig
config )
     {
         return connect( address, null, handler, config );
     }
 
     public ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
-                                  IoHandler handler, IoConnectorConfig config )
+                                  IoHandler handler, IoServiceConfig config )
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -91,7 +90,7 @@
 
         if( config == null )
         {
-            config = ( IoConnectorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
         
         SocketChannel ch = null;
@@ -278,11 +277,11 @@
         }
     }
 
-    private SocketSessionImpl newSession( SocketChannel ch, IoHandler handler, IoConnectorConfig
config ) throws IOException
+    private SocketSessionImpl newSession( SocketChannel ch, IoHandler handler, IoServiceConfig
config ) throws IOException
     {
         SocketSessionImpl session = new SocketSessionImpl(
                 wrapper, managedSessions,
-                ( SocketSessionConfig ) config.getSessionConfig(),
+                config.getSessionConfig(),
                 ch, handler );
         try
         {
@@ -363,17 +362,26 @@
         }
     }
 
-    private static class ConnectionRequest extends ConnectFuture
+    private class ConnectionRequest extends ConnectFuture
     {
         private final SocketChannel channel;
         private final long deadline;
         private final IoHandler handler;
-        private final IoConnectorConfig config;
+        private final IoServiceConfig config;
 
-        private ConnectionRequest( SocketChannel channel, IoHandler handler, IoConnectorConfig
config )
+        private ConnectionRequest( SocketChannel channel, IoHandler handler, IoServiceConfig
config )
         {
             this.channel = channel;
-            this.deadline = System.currentTimeMillis() + config.getConnectTimeoutMillis();
+            long timeout;
+            if( config instanceof IoConnectorConfig )
+            {
+                timeout = ( ( IoConnectorConfig ) config ).getConnectTimeoutMillis();
+            }
+            else
+            {
+                timeout = ( ( IoConnectorConfig ) getDefaultConfig() ).getConnectTimeoutMillis();
+            }
+            this.deadline = System.currentTimeMillis() + timeout;
             this.handler = handler;
             this.config = config;
         }

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/socket/nio/support/SocketSessionImpl.java
Wed Jan 25 21:38:13 2006
@@ -63,7 +63,7 @@
      */
     public SocketSessionImpl(
             IoService manager, Set managedSessions,
-            SocketSessionConfig config,
+            IoSessionConfig config,
             SocketChannel ch, IoHandler defaultHandler )
     {
         this.manager = manager;
@@ -77,15 +77,19 @@
         this.localAddress = ch.socket().getLocalSocketAddress();
         
         // Apply the initial session settings
-        this.config.setKeepAlive( config.isKeepAlive() );
-        this.config.setOobInline( config.isOobInline() );
-        this.config.setReceiveBufferSize( config.getReceiveBufferSize() );
-        this.readBufferSize = config.getReceiveBufferSize();
-        this.config.setReuseAddress( config.isReuseAddress() );
-        this.config.setSendBufferSize( config.getSendBufferSize() );
-        this.config.setSoLinger( config.getSoLinger() );
-        this.config.setTcpNoDelay( config.isTcpNoDelay() );
-        this.config.setTrafficClass( config.getTrafficClass() );
+        if( config instanceof SocketSessionConfig )
+        {
+            SocketSessionConfig cfg = ( SocketSessionConfig ) config;
+            this.config.setKeepAlive( cfg.isKeepAlive() );
+            this.config.setOobInline( cfg.isOobInline() );
+            this.config.setReceiveBufferSize( cfg.getReceiveBufferSize() );
+            this.readBufferSize = cfg.getReceiveBufferSize();
+            this.config.setReuseAddress( cfg.isReuseAddress() );
+            this.config.setSendBufferSize( cfg.getSendBufferSize() );
+            this.config.setSoLinger( cfg.getSoLinger() );
+            this.config.setTcpNoDelay( cfg.isTcpNoDelay() );
+            this.config.setTrafficClass( cfg.getTrafficClass() );
+        }
     }
     
     public IoService getService()

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeAcceptor.java
Wed Jan 25 21:38:13 2006
@@ -42,7 +42,7 @@
         }
     };
 
-    public void bind( SocketAddress address, IoHandler handler, IoAcceptorConfig config )
throws IOException
+    public void bind( SocketAddress address, IoHandler handler, IoServiceConfig config )
throws IOException
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -54,7 +54,7 @@
 
         if( config == null )
         {
-            config = ( IoAcceptorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
 
         synchronized( boundHandlers )
@@ -109,7 +109,17 @@
         
         Set managedSessions = pipe.getManagedServerSessions();
         
-        if( pipe.getConfig().isDisconnectOnUnbind() && managedSessions != null )
+        IoServiceConfig cfg = pipe.getConfig();
+        boolean disconnectOnUnbind;
+        if( cfg instanceof IoAcceptorConfig )
+        {
+            disconnectOnUnbind = ( ( IoAcceptorConfig ) cfg ).isDisconnectOnUnbind();
+        }
+        else
+        {
+            disconnectOnUnbind = ( ( IoAcceptorConfig ) getDefaultConfig() ).isDisconnectOnUnbind();
+        }
+        if( disconnectOnUnbind && managedSessions != null )
         {
             IoSession[] tempSessions = ( IoSession[] ) 
                                   managedSessions.toArray( new IoSession[ 0 ] );

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeConnector.java
Wed Jan 25 21:38:13 2006
@@ -7,7 +7,6 @@
 import java.net.SocketAddress;
 
 import org.apache.mina.common.ConnectFuture;
-import org.apache.mina.common.IoConnectorConfig;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.common.IoSessionConfig;
@@ -35,12 +34,12 @@
         }
     };
 
-    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoConnectorConfig
config ) 
+    public ConnectFuture connect( SocketAddress address, IoHandler handler, IoServiceConfig
config ) 
     {
         return connect( address, null, handler, config );
     }
 
-    public ConnectFuture connect( SocketAddress address, SocketAddress localAddress, IoHandler
handler, IoConnectorConfig config )
+    public ConnectFuture connect( SocketAddress address, SocketAddress localAddress, IoHandler
handler, IoServiceConfig config )
     {
         if( address == null )
             throw new NullPointerException( "address" );
@@ -52,7 +51,7 @@
 
         if( config == null )
         {
-            config = ( IoConnectorConfig ) getDefaultConfig();
+            config = getDefaultConfig();
         }
 
         VmPipe entry = ( VmPipe ) VmPipeAcceptor.boundHandlers.get( address );

Modified: directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java?rev=372453&r1=372452&r2=372453&view=diff
==============================================================================
--- directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java
(original)
+++ directory/sandbox/trustin/dirmina-158/core/src/main/java/org/apache/mina/transport/vmpipe/support/VmPipe.java
Wed Jan 25 21:38:13 2006
@@ -7,8 +7,8 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.mina.common.IoAcceptorConfig;
 import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoServiceConfig;
 import org.apache.mina.transport.vmpipe.VmPipeAcceptor;
 import org.apache.mina.transport.vmpipe.VmPipeAddress;
 
@@ -17,14 +17,14 @@
     private final VmPipeAcceptor acceptor;
     private final VmPipeAddress address;
     private final IoHandler handler;
-    private final IoAcceptorConfig config;
+    private final IoServiceConfig config;
     private final Set managedClientSessions = Collections.synchronizedSet( new HashSet()
);
     private final Set managedServerSessions = Collections.synchronizedSet( new HashSet()
);
     
     public VmPipe( VmPipeAcceptor acceptor,
                    VmPipeAddress address,
                    IoHandler handler,
-                   IoAcceptorConfig config )
+                   IoServiceConfig config )
     {
         this.acceptor = acceptor;
         this.address = address;
@@ -47,7 +47,7 @@
         return handler;
     }
     
-    public IoAcceptorConfig getConfig()
+    public IoServiceConfig getConfig()
     {
         return config;
     }



Mime
View raw message