directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r332577 - in /directory/network/trunk/src/java/org/apache/mina/transport/socket/nio: SocketAcceptor.java SocketConnector.java SocketSessionManager.java support/SocketAcceptorDelegate.java support/SocketConnectorDelegate.java
Date Fri, 11 Nov 2005 15:05:05 GMT
Author: trustin
Date: Fri Nov 11 07:04:59 2005
New Revision: 332577

URL: http://svn.apache.org/viewcvs?rev=332577&view=rev
Log:
Related issue: DIRMINA-119 Multiple selector loops
* Added a new interface 'SocketSessionManager' to provide some socket-specific property.

Added:
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java
  (with props)
Modified:
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
    directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java?rev=332577&r1=332576&r2=332577&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketAcceptor.java
Fri Nov 11 07:04:59 2005
@@ -28,7 +28,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class SocketAcceptor extends DelegatedIoAcceptor
+public class SocketAcceptor extends DelegatedIoAcceptor implements SocketSessionManager
 {
     /**
      * Creates a new instance.
@@ -69,5 +69,15 @@
     public void setBacklog( int backlog )
     {
         ( ( SocketAcceptorDelegate ) delegate ).setBacklog( backlog );
+    }
+
+    public int getProcessors()
+    {
+        return ( ( SocketAcceptorDelegate ) delegate ).getProcessors();
+    }
+
+    public void setProcessors( int nProcessor )
+    {
+        ( ( SocketAcceptorDelegate ) delegate ).setProcessors( nProcessor );
     }
 }

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java?rev=332577&r1=332576&r2=332577&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketConnector.java
Fri Nov 11 07:04:59 2005
@@ -20,6 +20,7 @@
 
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.support.DelegatedIoConnector;
+import org.apache.mina.transport.socket.nio.support.SocketAcceptorDelegate;
 import org.apache.mina.transport.socket.nio.support.SocketConnectorDelegate;
 
 /**
@@ -28,7 +29,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class SocketConnector extends DelegatedIoConnector
+public class SocketConnector extends DelegatedIoConnector implements SocketSessionManager
 {
     /**
      * Creates a new instance.
@@ -36,5 +37,16 @@
     public SocketConnector()
     {
         super( new SocketConnectorDelegate() );
+    }
+
+
+    public int getProcessors()
+    {
+        return ( ( SocketConnectorDelegate ) delegate ).getProcessors();
+    }
+
+    public void setProcessors( int nProcessor )
+    {
+        ( ( SocketConnectorDelegate ) delegate ).setProcessors( nProcessor );
     }
 }

Added: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java?rev=332577&view=auto
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java
(added)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java
Fri Nov 11 07:04:59 2005
@@ -0,0 +1,44 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.transport.socket.nio;
+
+import org.apache.mina.common.IoSessionManager;
+
+/**
+ * An {@link IoSessionManager} which provides some properties related with
+ * NIO sockets.
+ *
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ *
+ */
+public interface SocketSessionManager
+{
+    /**
+     * Returns the number of worker threads assigned to perform socket I/O.
+     */
+    int getProcessors();
+    
+    /**
+     * Sets the number of worker threads assigned to perform socket I/O.
+     * Decreasing this number won't stop threads immediately.  It will
+     * not stop until all sessions assigned to it are closed.
+     */
+    void setProcessors( int nProcessor );
+}

Propchange: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/SocketSessionManager.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java?rev=332577&r1=332576&r2=332577&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketAcceptorDelegate.java
Fri Nov 11 07:04:59 2005
@@ -35,9 +35,7 @@
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.support.BaseIoAcceptor;
 import org.apache.mina.common.support.IoSessionManagerFilterChain;
-import org.apache.mina.transport.socket.nio.support.SocketIoProcessor;
-import org.apache.mina.transport.socket.nio.support.SocketSessionImpl;
-import org.apache.mina.transport.socket.nio.support.SocketSessionManagerFilterChain;
+import org.apache.mina.transport.socket.nio.SocketSessionManager;
 import org.apache.mina.util.Queue;
 
 /**
@@ -46,7 +44,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class SocketAcceptorDelegate extends BaseIoAcceptor
+public class SocketAcceptorDelegate extends BaseIoAcceptor implements SocketSessionManager
 {
     private static volatile int nextId = 0;
 
@@ -203,6 +201,16 @@
         }
     }
     
+    public int getProcessors()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setProcessors( int nProcessor )
+    {
+        throw new UnsupportedOperationException();
+    }
+
     private class Worker extends Thread
     {
         public Worker()

Modified: directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java?rev=332577&r1=332576&r2=332577&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
(original)
+++ directory/network/trunk/src/java/org/apache/mina/transport/socket/nio/support/SocketConnectorDelegate.java
Fri Nov 11 07:04:59 2005
@@ -34,9 +34,7 @@
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.support.BaseIoConnector;
 import org.apache.mina.common.support.IoSessionManagerFilterChain;
-import org.apache.mina.transport.socket.nio.support.SocketIoProcessor;
-import org.apache.mina.transport.socket.nio.support.SocketSessionImpl;
-import org.apache.mina.transport.socket.nio.support.SocketSessionManagerFilterChain;
+import org.apache.mina.transport.socket.nio.SocketSessionManager;
 import org.apache.mina.util.ExceptionUtil;
 import org.apache.mina.util.Queue;
 
@@ -46,7 +44,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
-public class SocketConnectorDelegate extends BaseIoConnector
+public class SocketConnectorDelegate extends BaseIoConnector implements SocketSessionManager
 {
     private static volatile int nextId = 0;
 
@@ -255,6 +253,16 @@
         }
         session.getIoProcessor().addNew( session );
         return session;
+    }
+
+    public int getProcessors()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setProcessors( int nProcessor )
+    {
+        throw new UnsupportedOperationException();
     }
 
     private class Worker extends Thread



Mime
View raw message