Author: jvermillard
Date: Sun Mar 22 12:33:54 2009
New Revision: 757177

URL: http://svn.apache.org/viewvc?rev=757177&view=rev
Log:
Added some APR transport javadoc

Modified:
    
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
    
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketAcceptor.java
    
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketConnector.java

Modified: 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java?rev=757177&r1=757176&r2=757177&view=diff
==============================================================================
--- 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 (original)
+++ 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprIoProcessor.java
 Sun Mar 22 12:33:54 2009
@@ -60,6 +60,12 @@
     private final List<AprSession> polledSessions =
         new CircularQueue<AprSession>(POLLSET_SIZE);
 
+    /**
+     * Create a new instance of {...@link AprIoProcessor} with a given Exector 
for 
+     * handling I/Os events.
+     * 
+     * @param executor the {...@link Executor} for handling I/O events
+     */
     public AprIoProcessor(Executor executor) {
         super(executor);
 
@@ -116,6 +122,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void dispose0() {
         Poll.destroy(pollset);
@@ -124,11 +133,17 @@
         Pool.destroy(pool);
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected int select() throws Exception {
        return select(Integer.MAX_VALUE);
     }
 
+    /**
+     * {...@inheritdoc}
+     */
        @Override
     protected int select(long timeout) throws Exception {
         int rv = Poll.poll(pollset, 1000 * timeout, polledSockets, false);
@@ -186,11 +201,17 @@
         }
     }
 
+       /**
+     * {...@inheritdoc}
+     */
     @Override
     protected boolean isSelectorEmpty() {
         return allSessions.isEmpty();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void wakeup() {
         if (toBeWakenUp) {
@@ -204,11 +225,17 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected Iterator<AprSession> allSessions() {
         return allSessions.values().iterator();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected Iterator<AprSession> selectedSessions() {
         return polledSessions.iterator();
@@ -229,6 +256,9 @@
         allSessions.put(s, session);
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void destroy(AprSession session) throws Exception {
         if (allSessions.remove(session.getDescriptor()) == null) {
@@ -255,6 +285,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected SessionState state(AprSession session) {
         long socket = session.getDescriptor();
@@ -267,26 +300,41 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected boolean isReadable(AprSession session) {
         return session.isReadable();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected boolean isWritable(AprSession session) {
         return session.isWritable();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected boolean isInterestedInRead(AprSession session) {
         return session.isInterestedInRead();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected boolean isInterestedInWrite(AprSession session) {
         return session.isInterestedInWrite();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void setInterestedInRead(AprSession session, boolean value) 
throws Exception {
         if (session.isInterestedInRead() == value) {
@@ -309,6 +357,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void setInterestedInWrite(AprSession session, boolean value) 
throws Exception {
         if (session.isInterestedInWrite() == value) {
@@ -331,6 +382,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected int read(AprSession session, IoBuffer buffer) throws Exception {
         int bytes;
@@ -359,6 +413,9 @@
         return bytes;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected int write(AprSession session, IoBuffer buf, int length) throws 
Exception {
         int writtenBytes;
@@ -385,6 +442,9 @@
         return writtenBytes;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected int transferFile(AprSession session, FileRegion region, int 
length)
             throws Exception {

Modified: 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketAcceptor.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketAcceptor.java?rev=757177&r1=757176&r2=757177&view=diff
==============================================================================
--- 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketAcceptor.java
 (original)
+++ 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketAcceptor.java
 Sun Mar 22 12:33:54 2009
@@ -28,11 +28,15 @@
 
 import org.apache.mina.core.RuntimeIoException;
 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.IoService;
+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;
 import org.apache.mina.transport.socket.SocketSessionConfig;
+import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
 import org.apache.mina.util.CircularQueue;
 import org.apache.tomcat.jni.Address;
 import org.apache.tomcat.jni.Poll;
@@ -41,7 +45,7 @@
 import org.apache.tomcat.jni.Status;
 
 /**
- * TODO Add documentation
+ * {...@link IoAcceptor} for APR based socket transport (TCP/IP).
  *
  * @author The Apache MINA Project ([email protected])
  * @version $Rev$, $Date$
@@ -68,27 +72,53 @@
     private final List<Long> polledHandles =
         new CircularQueue<Long>(POLLSET_SIZE);
 
+    /**
+     * Constructor for {...@link AprSocketAcceptor} using default parameters 
(multiple thread model).
+     */
     public AprSocketAcceptor() {
         super(new DefaultSocketSessionConfig(), AprIoProcessor.class);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     * Constructor for {...@link AprSocketAcceptor} using default parameters, 
and 
+     * given number of {...@link AprIoProcessor} for multithreading I/O 
operations.
+     * 
+     * @param processorCount the number of processor to create and place in a
+     * {...@link SimpleIoProcessorPool} 
+     */
     public AprSocketAcceptor(int processorCount) {
         super(new DefaultSocketSessionConfig(), AprIoProcessor.class, 
processorCount);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     *  Constructor for {...@link AprSocketAcceptor} with default 
configuration but a
+      *  specific {...@link AprIoProcessor}, 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 AprSocketAcceptor(IoProcessor<AprSession> processor) {
         super(new DefaultSocketSessionConfig(), processor);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     *  Constructor for {...@link AprSocketAcceptor} with a given {...@link 
Executor} for handling 
+     *  connection events and a given {...@link AprIoProcessor} 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 AprSocketAcceptor(Executor executor,
             IoProcessor<AprSession> processor) {
         super(new DefaultSocketSessionConfig(), executor, processor);
         ((DefaultSocketSessionConfig) getSessionConfig()).init(this);
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected AprSession accept(IoProcessor<AprSession> processor, Long 
handle) throws Exception {
         long s = Socket.accept(handle);
@@ -104,6 +134,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected Long open(SocketAddress localAddress) throws Exception {
         InetSocketAddress la = (InetSocketAddress) localAddress;
@@ -165,6 +198,9 @@
         return handle;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void init() throws Exception {
         // initialize a memory pool for APR functions
@@ -195,6 +231,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void destroy() throws Exception {
         if (wakeupSocket > 0) {
@@ -208,12 +247,18 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected SocketAddress localAddress(Long handle) throws Exception {
         long la = Address.get(Socket.APR_LOCAL, handle);
         return new InetSocketAddress(Address.getip(la), 
Address.getInfo(la).port);
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected int select() throws Exception {
         int rv = Poll.poll(pollset, Integer.MAX_VALUE, polledSockets, false);
@@ -260,11 +305,17 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected Iterator<Long> selectedHandles() {
         return polledHandles.iterator();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void close(Long handle) throws Exception {
         Poll.remove(pollset, handle);
@@ -274,6 +325,9 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     protected void wakeup() {
         if (toBeWakenUp) {
@@ -287,14 +341,23 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     public int getBacklog() {
         return backlog;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     public boolean isReuseAddress() {
         return reuseAddress;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     public void setBacklog(int backlog) {
         synchronized (bindLock) {
             if (isActive()) {
@@ -306,16 +369,25 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     public InetSocketAddress getLocalAddress() {
         return (InetSocketAddress) super.getLocalAddress();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     public InetSocketAddress getDefaultLocalAddress() {
         return (InetSocketAddress) super.getDefaultLocalAddress();
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     public void setDefaultLocalAddress(InetSocketAddress localAddress) {
         super.setDefaultLocalAddress(localAddress);
     }
@@ -331,15 +403,26 @@
         }
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     public TransportMetadata getTransportMetadata() {
         return AprSocketSession.METADATA;
     }
 
+    /**
+     * {...@inheritdoc}
+     */
     @Override
     public SocketSessionConfig getSessionConfig() {
         return (SocketSessionConfig) super.getSessionConfig();
     }
 
+    /**
+     * Convert an APR code into an Exception with the corresponding message
+     * @param code error number
+     * @throws IOException the generated exception
+     */
     private void throwException(int code) throws IOException {
         throw new IOException(
                 org.apache.tomcat.jni.Error.strerror(-code) +

Modified: 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketConnector.java
URL: 
http://svn.apache.org/viewvc/mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketConnector.java?rev=757177&r1=757176&r2=757177&view=diff
==============================================================================
--- 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketConnector.java
 (original)
+++ 
mina/trunk/transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketConnector.java
 Sun Mar 22 12:33:54 2009
@@ -33,7 +33,10 @@
 
 import org.apache.mina.core.RuntimeIoException;
 import org.apache.mina.core.polling.AbstractPollingIoConnector;
+import org.apache.mina.core.service.IoConnector;
 import org.apache.mina.core.service.IoProcessor;
+import org.apache.mina.core.service.IoService;
+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.SocketConnector;
@@ -46,7 +49,7 @@
 import org.apache.tomcat.jni.Status;
 
 /**
- * {...@link IoConnector} for ABR based socket transport (TCP/IP).
+ * {...@link IoConnector} for APR based socket transport (TCP/IP).
  * 
  * @author The Apache MINA Project ([email protected])
  * @version $Rev$, $Date$
@@ -76,7 +79,7 @@
     private volatile ByteBuffer dummyBuffer;
 
     /**
-     * TODO : document superclass
+     * Create an {...@link AprSocketConnector} with default configuration 
(multiple thread model).
      */
     public AprSocketConnector() {
         super(new DefaultSocketSessionConfig(), AprIoProcessor.class);
@@ -84,7 +87,10 @@
     }
 
     /**
-     * TODO : document superclass
+     * Constructor for {...@link AprSocketConnector} with default 
configuration, and 
+     * given number of {...@link AprIoProcessor} for multithreading I/O 
operations
+     * @param processorCount the number of processor to create and place in a
+     * {...@link SimpleIoProcessorPool} 
      */
     public AprSocketConnector(int processorCount) {
         super(new DefaultSocketSessionConfig(), AprIoProcessor.class, 
processorCount);
@@ -92,7 +98,10 @@
     }
 
     /**
-     * TODO : document superclass
+     *  Constructor for {...@link AprSocketConnector} 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 AprSocketConnector(IoProcessor<AprSession> processor) {
         super(new DefaultSocketSessionConfig(), processor);
@@ -100,7 +109,11 @@
     }
 
     /**
-     * TODO : document superclass
+     *  Constructor for {...@link AprSocketConnector} 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 AprSocketConnector(Executor executor, IoProcessor<AprSession> 
processor) {
         super(new DefaultSocketSessionConfig(), executor, processor);


Reply via email to