svn commit: r672586 - in /mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio: NioSocketAcceptor.java NioSocketConnector.java

View: New views
1 Messages — Rating Filter:   Alert me  

svn commit: r672586 - in /mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio: NioSocketAcceptor.java NioSocketConnector.java

by jvermillard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Author: jvermillard
Date: Sat Jun 28 14:52:57 2008
New Revision: 672586

URL: http://svn.apache.org/viewvc?rev=672586&view=rev
Log:
more javadoc on  NioSocketConnector and NioSocketAcceptor

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
    mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java?rev=672586&r1=672585&r2=672586&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketAcceptor.java Sat Jun 28 14:52:57 2008
@@ -32,6 +32,7 @@
 import org.apache.mina.core.polling.AbstractPollingIoAcceptor;
 import org.apache.mina.core.service.IoAcceptor;
 import org.apache.mina.core.service.IoProcessor;
+import org.apache.mina.core.service.SimpleIoProcessorPool;
 import org.apache.mina.core.service.TransportMetadata;
 import org.apache.mina.transport.socket.DefaultSocketSessionConfig;
 import org.apache.mina.transport.socket.SocketAcceptor;
@@ -54,33 +55,59 @@
     private volatile Selector selector;
 
     /**
-     * Create an acceptor with a single processing thread using a NewThreadExecutor
+     * Constructor for {@link NioSocketAcceptor} using default parameters (multiple thread model).
      */
     public NioSocketAcceptor() {
         super(new DefaultSocketSessionConfig(), NioProcessor.class);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     * Constructor for {@link NioSocketAcceptor} using default parameters, and
+     * given number of {@link NioProcessor} for multithreading I/O operations.
+     *
+     * @param processorCount the number of processor to create and place in a
+     * {@link SimpleIoProcessorPool}
+     */
     public NioSocketAcceptor(int processorCount) {
         super(new DefaultSocketSessionConfig(), NioProcessor.class, processorCount);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+    *  Constructor for {@link NioSocketAcceptor} with default configuration but a
+     *  specific {@link IoProcessor}, useful for sharing the same processor over multiple
+     *  {@link IoService} of the same type.
+     * @param processor the processor to use for managing I/O events
+     */
     public NioSocketAcceptor(IoProcessor<NioSession> processor) {
         super(new DefaultSocketSessionConfig(), processor);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     *  Constructor for {@link NioSocketAcceptor} with a given {@link Executor} for handling
+     *  connection events and a given {@link IoProcessor} for handling I/O events, useful for
+     *  sharing the same processor and executor over multiple {@link IoService} of the same type.
+     * @param executor the executor for connection
+     * @param processor the processor for I/O operations
+     */
     public NioSocketAcceptor(Executor executor, IoProcessor<NioSession> processor) {
         super(new DefaultSocketSessionConfig(), executor, processor);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void init() throws Exception {
         selector = Selector.open();
     }
-
+    
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void destroy() throws Exception {
         if (selector != null) {
@@ -88,33 +115,54 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public TransportMetadata getTransportMetadata() {
         return NioSocketSession.METADATA;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public SocketSessionConfig getSessionConfig() {
         return (SocketSessionConfig) super.getSessionConfig();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public InetSocketAddress getLocalAddress() {
         return (InetSocketAddress) super.getLocalAddress();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public InetSocketAddress getDefaultLocalAddress() {
         return (InetSocketAddress) super.getDefaultLocalAddress();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setDefaultLocalAddress(InetSocketAddress localAddress) {
         setDefaultLocalAddress((SocketAddress) localAddress);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isReuseAddress() {
         return reuseAddress;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setReuseAddress(boolean reuseAddress) {
         synchronized (bindLock) {
             if (isActive()) {
@@ -126,10 +174,16 @@
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public int getBacklog() {
         return backlog;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public void setBacklog(int backlog) {
         synchronized (bindLock) {
             if (isActive()) {
@@ -141,7 +195,9 @@
         }
     }
 
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected NioSession accept(IoProcessor<NioSession> processor,
             ServerSocketChannel handle) throws Exception {
@@ -160,6 +216,9 @@
         return new NioSocketSession(this, processor, ch);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected ServerSocketChannel open(SocketAddress localAddress)
             throws Exception {
@@ -184,6 +243,9 @@
         return c;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected SocketAddress localAddress(ServerSocketChannel handle)
             throws Exception {
@@ -208,11 +270,17 @@
         return selector.select() > 0;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected Iterator<ServerSocketChannel> selectedHandles() {
         return new ServerSocketChannelIterator(selector.selectedKeys());
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void close(ServerSocketChannel handle) throws Exception {
         SelectionKey key = handle.keyFor(selector);
@@ -222,6 +290,9 @@
         handle.close();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     protected void wakeup() {
         selector.wakeup();
@@ -235,15 +306,24 @@
             i = selectedKeys.iterator();
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean hasNext() {
             return i.hasNext();
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public ServerSocketChannel next() {
             SelectionKey key = i.next();
             return (ServerSocketChannel) key.channel();
         }
 
+        /**
+         * {@inheritDoc}
+         */
         public void remove() {
             i.remove();
         }

Modified: mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java?rev=672586&r1=672585&r2=672586&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketConnector.java Sat Jun 28 14:52:57 2008
@@ -50,7 +50,7 @@
     private volatile Selector selector;
 
     /**
-     * Constructor for {@link NioSocketConnector} with default configuration.
+     * Constructor for {@link NioSocketConnector} with default configuration (multiple thread model).
      */
     public NioSocketConnector() {
         super(new DefaultSocketSessionConfig(), NioProcessor.class);
@@ -59,7 +59,7 @@
 
     /**
      * Constructor for {@link NioSocketConnector} with default configuration, and
-     * given number of {@link NioProcessor}
+     * given number of {@link NioProcessor} for multithreading I/O operations
      * @param processorCount the number of processor to create and place in a
      * {@link SimpleIoProcessorPool}
      */
@@ -70,7 +70,8 @@
 
     /**
      *  Constructor for {@link NioSocketConnector} with default configuration but a
-     *  specific {@link IoProcessor}
+     *  specific {@link IoProcessor}, useful for sharing the same processor over multiple
+     *  {@link IoService} of the same type.
      * @param processor the processor to use for managing I/O events
      */
     public NioSocketConnector(IoProcessor<NioSession> processor) {
@@ -80,7 +81,8 @@
 
     /**
      *  Constructor for {@link NioSocketConnector} with a given {@link Executor} for handling
-     *  connection events and a given {@link IoProcessor} for handling I/O events.
+     *  connection events and a given {@link IoProcessor} for handling I/O events, useful for sharing
+     *  the same processor and executor over multiple {@link IoService} of the same type.
      * @param executor the executor for connection
      * @param processor the processor for I/O operations
      */


LightInTheBox - Buy quality products at wholesale price