Repository: mina
Updated Branches:
  refs/heads/2.0 850bc14dd -> 3ff1bf1aa


o Fixed some missing Javadoc
o Fixed some sonarlint warnings

Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/9f00651f
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/9f00651f
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/9f00651f

Branch: refs/heads/2.0
Commit: 9f00651f9389b769d44cee2b4f9572cdde684a99
Parents: 05a5c2f
Author: Emmanuel Lécharny <elecha...@symas.com>
Authored: Thu Dec 8 20:27:47 2016 +0100
Committer: Emmanuel Lécharny <elecha...@symas.com>
Committed: Fri Dec 9 06:05:41 2016 +0100

----------------------------------------------------------------------
 .../filter/ssl/BogusTrustManagerFactory.java    |  38 ++++--
 .../apache/mina/filter/ssl/KeyStoreFactory.java |   9 +-
 .../mina/filter/ssl/SslContextFactory.java      |  22 +++-
 .../org/apache/mina/filter/ssl/SslFilter.java   |   3 +-
 .../org/apache/mina/filter/ssl/SslHandler.java  |  34 +++--
 .../mina/handler/chain/ChainedIoHandler.java    |   1 +
 .../mina/handler/chain/IoHandlerChain.java      | 127 ++++++++++++++++++-
 .../mina/handler/demux/DemuxingIoHandler.java   |  14 +-
 .../mina/handler/demux/ExceptionHandler.java    |  10 ++
 .../mina/handler/demux/MessageHandler.java      |   9 +-
 .../multiton/SingleSessionIoHandler.java        |   2 +
 .../multiton/SingleSessionIoHandlerAdapter.java |  35 +++++
 .../SingleSessionIoHandlerDelegate.java         |  12 +-
 .../multiton/SingleSessionIoHandlerFactory.java |   2 +
 14 files changed, 273 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/filter/ssl/BogusTrustManagerFactory.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/filter/ssl/BogusTrustManagerFactory.java
 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/BogusTrustManagerFactory.java
index bfaa2fd..5984e69 100644
--- 
a/mina-core/src/main/java/org/apache/mina/filter/ssl/BogusTrustManagerFactory.java
+++ 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/BogusTrustManagerFactory.java
@@ -39,22 +39,27 @@ import javax.net.ssl.X509TrustManager;
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public class BogusTrustManagerFactory extends TrustManagerFactory {
-
-    public BogusTrustManagerFactory() {
-        super(new BogusTrustManagerFactorySpi(), new Provider("MinaBogus", 
1.0, "") {
-            private static final long serialVersionUID = -4024169055312053827L;
-        }, "MinaBogus");
-    }
-
     private static final X509TrustManager X509 = new X509TrustManager() {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public void checkClientTrusted(X509Certificate[] x509Certificates, 
String s) throws CertificateException {
             // Do nothing
         }
 
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public void checkServerTrusted(X509Certificate[] x509Certificates, 
String s) throws CertificateException {
             // Do nothing
         }
 
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public X509Certificate[] getAcceptedIssuers() {
             return new X509Certificate[0];
         }
@@ -62,18 +67,35 @@ public class BogusTrustManagerFactory extends 
TrustManagerFactory {
 
     private static final TrustManager[] X509_MANAGERS = new TrustManager[] { 
X509 };
 
-    private static class BogusTrustManagerFactorySpi extends 
TrustManagerFactorySpi {
+    /**
+     * Creates a new BogusTrustManagerFactory instance
+     */
+    public BogusTrustManagerFactory() {
+        super(new BogusTrustManagerFactorySpi(), new Provider("MinaBogus", 
1.0, "") {
+            private static final long serialVersionUID = -4024169055312053827L;
+        }, "MinaBogus");
+    }
 
+    private static class BogusTrustManagerFactorySpi extends 
TrustManagerFactorySpi {
+        /**
+         * {@inheritDoc}
+         */
         @Override
         protected TrustManager[] engineGetTrustManagers() {
             return X509_MANAGERS;
         }
 
+        /**
+         * {@inheritDoc}
+         */
         @Override
         protected void engineInit(KeyStore keystore) throws KeyStoreException {
             // noop
         }
 
+        /**
+         * {@inheritDoc}
+         */
         @Override
         protected void engineInit(ManagerFactoryParameters 
managerFactoryParameters)
                 throws InvalidAlgorithmParameterException {

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java
index 1859ceb..b0903fa 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/KeyStoreFactory.java
@@ -148,12 +148,15 @@ public class KeyStoreFactory {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         try {
             for (;;) {
-                int data = dataStream.read();
-                if (data < 0) {
+                int readByte = dataStream.read();
+                
+                if (readByte < 0) {
                     break;
                 }
-                out.write(data);
+                
+                out.write(readByte);
             }
+            
             setData(out.toByteArray());
         } finally {
             try {

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java
index b66610b..04e3d4c 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslContextFactory.java
@@ -88,15 +88,24 @@ public class SslContextFactory {
 
     private int serverSessionTimeout = -1;
 
+    /**
+     * Create a new SSLContext instance,using the {@link KeyManagerFactory} 
and the
+     * {@link TrustManagerFactory}.
+     *  
+     * @return The created instance
+     * @throws Exception If we weren't able to create the SSLContext insyance
+     */
     public SSLContext newInstance() throws Exception {
         KeyManagerFactory kmf = this.keyManagerFactory;
         TrustManagerFactory tmf = this.trustManagerFactory;
 
         if (kmf == null) {
             String algorithm = keyManagerFactoryAlgorithm;
+            
             if (algorithm == null && keyManagerFactoryAlgorithmUseDefault) {
                 algorithm = KeyManagerFactory.getDefaultAlgorithm();
             }
+            
             if (algorithm != null) {
                 if (keyManagerFactoryProvider == null) {
                     kmf = KeyManagerFactory.getInstance(algorithm);
@@ -108,9 +117,11 @@ public class SslContextFactory {
 
         if (tmf == null) {
             String algorithm = trustManagerFactoryAlgorithm;
+            
             if (algorithm == null && trustManagerFactoryAlgorithmUseDefault) {
                 algorithm = TrustManagerFactory.getDefaultAlgorithm();
             }
+            
             if (algorithm != null) {
                 if (trustManagerFactoryProvider == null) {
                     tmf = TrustManagerFactory.getInstance(algorithm);
@@ -121,21 +132,26 @@ public class SslContextFactory {
         }
 
         KeyManager[] keyManagers = null;
+        
         if (kmf != null) {
             kmf.init(keyManagerFactoryKeyStore, 
keyManagerFactoryKeyStorePassword);
             keyManagers = kmf.getKeyManagers();
         }
+        
         TrustManager[] trustManagers = null;
+        
         if (tmf != null) {
             if (trustManagerFactoryParameters != null) {
                 tmf.init(trustManagerFactoryParameters);
             } else {
                 tmf.init(trustManagerFactoryKeyStore);
             }
+            
             trustManagers = tmf.getTrustManagers();
         }
 
-        SSLContext context = null;
+        SSLContext context;
+        
         if (provider == null) {
             context = SSLContext.getInstance(protocol);
         } else {
@@ -183,6 +199,7 @@ public class SslContextFactory {
         if (protocol == null) {
             throw new IllegalArgumentException("protocol");
         }
+        
         this.protocol = protocol;
     }
 
@@ -194,8 +211,7 @@ public class SslContextFactory {
      * return by {@link KeyManagerFactory#getDefaultAlgorithm()} will be used.
      * The default value of this property is <tt>true</tt>.
      *
-     * @param useDefault
-     *            <tt>true</tt> or <tt>false</tt>.
+     * @param useDefault <tt>true</tt> or <tt>false</tt>.
      */
     public void setKeyManagerFactoryAlgorithmUseDefault(boolean useDefault) {
         this.keyManagerFactoryAlgorithmUseDefault = useDefault;

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java
index 7acb123..c2b92c2 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslFilter.java
@@ -568,7 +568,7 @@ public class SslFilter extends IoFilterAdapter {
                     return;
                 }
 
-                List<WriteRequest> newFailedRequests = new 
ArrayList<WriteRequest>(failedRequests.size() - 1);
+                List<WriteRequest> newFailedRequests = new 
ArrayList<>(failedRequests.size() - 1);
 
                 for (WriteRequest r : failedRequests) {
                     if (!isCloseNotify(r.getMessage())) {
@@ -676,6 +676,7 @@ public class SslFilter extends IoFilterAdapter {
                 if (isSslStarted(session)) {
                     future = initiateClosure(nextFilter, session);
                     future.addListener(new IoFutureListener<IoFuture>() {
+                        @Override
                         public void operationComplete(IoFuture future) {
                             nextFilter.filterClose(session);
                         }

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java 
b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
index 8cd1c80..509e678 100644
--- a/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
+++ b/mina-core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java
@@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory;
 /** No qualifier*/
 class SslHandler {
     /** A logger for this class */
-    private final static Logger LOGGER = 
LoggerFactory.getLogger(SslHandler.class);
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(SslHandler.class);
 
     /** The SSL Filter which has created this handler */
     private final SslFilter sslFilter;
@@ -70,12 +70,12 @@ class SslHandler {
     /** The current session */
     private final IoSession session;
 
-    private final Queue<IoFilterEvent> preHandshakeEventQueue = new 
ConcurrentLinkedQueue<IoFilterEvent>();
+    private final Queue<IoFilterEvent> preHandshakeEventQueue = new 
ConcurrentLinkedQueue<>();
 
-    private final Queue<IoFilterEvent> filterWriteEventQueue = new 
ConcurrentLinkedQueue<IoFilterEvent>();
+    private final Queue<IoFilterEvent> filterWriteEventQueue = new 
ConcurrentLinkedQueue<>();
 
     /** A queue used to stack all the incoming data until the SSL session is 
established */
-    private final Queue<IoFilterEvent> messageReceivedEventQueue = new 
ConcurrentLinkedQueue<IoFilterEvent>();
+    private final Queue<IoFilterEvent> messageReceivedEventQueue = new 
ConcurrentLinkedQueue<>();
 
     private SSLEngine sslEngine;
 
@@ -400,13 +400,13 @@ class SslHandler {
      * @return buffer with data
      */
     /* no qualifier */IoBuffer fetchAppBuffer() {
-        if (this.appBuffer == null) {
+        if (appBuffer == null) {
             return IoBuffer.allocate(0);
         } else {
-            IoBuffer appBuffer = this.appBuffer.flip();
-            this.appBuffer = null;
+            IoBuffer newAppBuffer = appBuffer.flip();
+            appBuffer = null;
 
-            return appBuffer.shrink();
+            return newAppBuffer.shrink();
         }
     }
 
@@ -417,11 +417,13 @@ class SslHandler {
      */
     /* no qualifier */IoBuffer fetchOutNetBuffer() {
         IoBuffer answer = outNetBuffer;
+        
         if (answer == null) {
             return emptyBuffer;
         }
 
         outNetBuffer = null;
+        
         return answer.shrink();
     }
 
@@ -599,6 +601,7 @@ class SslHandler {
 
                 for (;;) {
                     result = sslEngine.wrap(emptyBuffer.buf(), 
outNetBuffer.buf());
+                    
                     if (result.getStatus() == 
SSLEngineResult.Status.BUFFER_OVERFLOW) {
                         outNetBuffer.capacity(outNetBuffer.capacity() << 1);
                         outNetBuffer.limit(outNetBuffer.capacity());
@@ -662,10 +665,11 @@ class SslHandler {
                     throw newSsle;
                 }
 
-                IoBuffer outNetBuffer = fetchOutNetBuffer();
-                if (outNetBuffer != null && outNetBuffer.hasRemaining()) {
+                IoBuffer currentOutNetBuffer = fetchOutNetBuffer();
+                
+                if (currentOutNetBuffer != null && 
currentOutNetBuffer.hasRemaining()) {
                     writeFuture = new DefaultWriteFuture(session);
-                    sslFilter.filterWrite(nextFilter, session, new 
DefaultWriteRequest(outNetBuffer, writeFuture));
+                    sslFilter.filterWrite(nextFilter, session, new 
DefaultWriteRequest(currentOutNetBuffer, writeFuture));
                 }
             }
         } finally {
@@ -746,8 +750,8 @@ class SslHandler {
 
         SSLEngineResult res;
 
-        Status status = null;
-        HandshakeStatus handshakeStatus = null;
+        Status status;
+        HandshakeStatus handshakeStatus;
 
         do {
             // Decode the incoming data
@@ -810,6 +814,10 @@ class SslHandler {
         return copy;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
 

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java 
b/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java
index dd1e16c..19ce3dc 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/chain/ChainedIoHandler.java
@@ -49,6 +49,7 @@ public class ChainedIoHandler extends IoHandlerAdapter {
         if (chain == null) {
             throw new IllegalArgumentException("chain");
         }
+        
         this.chain = chain;
     }
 

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java 
b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java
index a12b05e..8b60d7d 100644
--- a/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java
+++ b/mina-core/src/main/java/org/apache/mina/handler/chain/IoHandlerChain.java
@@ -39,10 +39,12 @@ public class IoHandlerChain implements IoHandlerCommand {
 
     private final String NEXT_COMMAND = IoHandlerChain.class.getName() + '.' + 
id + ".nextCommand";
 
-    private final Map<String, Entry> name2entry = new 
ConcurrentHashMap<String, Entry>();
+    private final Map<String, Entry> name2entry = new ConcurrentHashMap<>();
 
+    /** The head of the IoHandlerCommand chain */
     private final Entry head;
 
+    /** THe tail of the IoHandlerCommand chain */
     private final Entry tail;
 
     /**
@@ -56,6 +58,10 @@ public class IoHandlerChain implements IoHandlerCommand {
 
     private IoHandlerCommand createHeadCommand() {
         return new IoHandlerCommand() {
+            /**
+             * {@inheritDoc}
+             */
+            @Override
             public void execute(NextCommand next, IoSession session, Object 
message) throws Exception {
                 next.execute(session, message);
             }
@@ -64,8 +70,13 @@ public class IoHandlerChain implements IoHandlerCommand {
 
     private IoHandlerCommand createTailCommand() {
         return new IoHandlerCommand() {
+            /**
+             * {@inheritDoc}
+             */
+            @Override
             public void execute(NextCommand next, IoSession session, Object 
message) throws Exception {
                 next = (NextCommand) session.getAttribute(NEXT_COMMAND);
+                
                 if (next != null) {
                     next.execute(session, message);
                 }
@@ -73,16 +84,30 @@ public class IoHandlerChain implements IoHandlerCommand {
         };
     }
 
+    /**
+     * Retrieve a name-command pair by its name
+     * @param name The name of the {@link IoHandlerCommand} we are looking for
+     * @return The associated name-command pair, if any, null otherwise
+     */
     public Entry getEntry(String name) {
         Entry e = name2entry.get(name);
+        
         if (e == null) {
             return null;
         }
+        
         return e;
     }
 
+    /**
+     * Retrieve a {@link IoHandlerCommand} by its name
+     * 
+     * @param name The name of the {@link IoHandlerCommand} we are looking for
+     * @return The associated {@link IoHandlerCommand}, if any, null otherwise
+     */
     public IoHandlerCommand get(String name) {
         Entry e = getEntry(name);
+        
         if (e == null) {
             return null;
         }
@@ -90,8 +115,16 @@ public class IoHandlerChain implements IoHandlerCommand {
         return e.getCommand();
     }
 
+    /**
+     * Retrieve the {@link IoHandlerCommand} following the {@link 
IoHandlerCommand} we
+     * fetched by its name
+     * 
+     * @param name The name of the {@link IoHandlerCommand}
+     * @return The {@link IoHandlerCommand} which is next to teh ngiven name, 
if any, null otherwise
+     */
     public NextCommand getNextCommand(String name) {
         Entry e = getEntry(name);
+        
         if (e == null) {
             return null;
         }
@@ -99,38 +132,76 @@ public class IoHandlerChain implements IoHandlerCommand {
         return e.getNextCommand();
     }
 
+    /**
+     * Adds a name-command pair into the chain
+     * 
+     * @param name The name
+     * @param command The command
+     */
     public synchronized void addFirst(String name, IoHandlerCommand command) {
         checkAddable(name);
         register(head, name, command);
     }
 
+    /**
+     * Adds a name-command at the end of the chain
+     * 
+     * @param name The name
+     * @param command The command
+     */
     public synchronized void addLast(String name, IoHandlerCommand command) {
         checkAddable(name);
         register(tail.prevEntry, name, command);
     }
 
+    /**
+     * Adds a name-command before a given name-command in the chain
+     * 
+     * @param baseName The {@linkplain IoHandlerCommand} name before which we 
will inject a new name-command
+     * @param name The name The name
+     * @param command The command The command
+     */
     public synchronized void addBefore(String baseName, String name, 
IoHandlerCommand command) {
         Entry baseEntry = checkOldName(baseName);
         checkAddable(name);
         register(baseEntry.prevEntry, name, command);
     }
 
+    /**
+     * Adds a name-command after a given name-command in the chain
+     * 
+     * @param baseName The {@link IoHandlerCommand} name after which we will 
inject a new name-command
+     * @param name The name The name
+     * @param command The command The command
+     */
     public synchronized void addAfter(String baseName, String name, 
IoHandlerCommand command) {
         Entry baseEntry = checkOldName(baseName);
         checkAddable(name);
         register(baseEntry, name, command);
     }
 
+    /**
+     * Removes a {@link IoHandlerCommand} by its name
+     * 
+     * @param name The name
+     * @return The removed {@link IoHandlerCommand}
+     */
     public synchronized IoHandlerCommand remove(String name) {
         Entry entry = checkOldName(name);
         deregister(entry);
+        
         return entry.getCommand();
     }
 
+    /**
+     * Remove all the {@link IoHandlerCommand} from the chain
+     * @throws Exception If we faced some exception during the cleanup 
+     */
     public synchronized void clear() throws Exception {
         Iterator<String> it = new 
ArrayList<String>(name2entry.keySet()).iterator();
+       
         while (it.hasNext()) {
-            this.remove(it.next());
+            remove(it.next());
         }
     }
 
@@ -158,9 +229,11 @@ public class IoHandlerChain implements IoHandlerCommand {
      */
     private Entry checkOldName(String baseName) {
         Entry e = name2entry.get(baseName);
+        
         if (e == null) {
             throw new IllegalArgumentException("Unknown filter name:" + 
baseName);
         }
+        
         return e;
     }
 
@@ -173,6 +246,10 @@ public class IoHandlerChain implements IoHandlerCommand {
         }
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void execute(NextCommand next, IoSession session, Object message) 
throws Exception {
         if (next != null) {
             session.setAttribute(NEXT_COMMAND, next);
@@ -189,9 +266,13 @@ public class IoHandlerChain implements IoHandlerCommand {
         entry.getCommand().execute(entry.getNextCommand(), session, message);
     }
 
+    /**
+     * @return The list of name-commands registered into the chain
+     */
     public List<Entry> getAll() {
-        List<Entry> list = new ArrayList<Entry>();
+        List<Entry> list = new ArrayList<>();
         Entry e = head.nextEntry;
+        
         while (e != tail) {
             list.add(e);
             e = e.nextEntry;
@@ -200,20 +281,37 @@ public class IoHandlerChain implements IoHandlerCommand {
         return list;
     }
 
+    /**
+     * @return A reverted list of the registered name-commands
+     */
     public List<Entry> getAllReversed() {
-        List<Entry> list = new ArrayList<Entry>();
+        List<Entry> list = new ArrayList<>();
         Entry e = tail.prevEntry;
+        
         while (e != head) {
             list.add(e);
             e = e.prevEntry;
         }
+        
         return list;
     }
 
+    /**
+     * Checks if the chain of {@IoHandlerCommand} contains a 
{@IoHandlerCommand} by its name
+     * 
+     * @param name The {@IoHandlerCommand} name
+     * @return <tt>TRUE</tt> if the {@IoHandlerCommand} is found in the chain
+     */
     public boolean contains(String name) {
         return getEntry(name) != null;
     }
 
+    /**
+     * Checks if the chain of {@IoHandlerCommand} contains a specific 
{@IoHandlerCommand}
+     * 
+     * @param command The {@IoHandlerCommand} we are looking for
+     * @return <tt>TRUE</tt> if the {@IoHandlerCommand} is found in the chain
+     */
     public boolean contains(IoHandlerCommand command) {
         Entry e = head.nextEntry;
         while (e != tail) {
@@ -225,17 +323,29 @@ public class IoHandlerChain implements IoHandlerCommand {
         return false;
     }
 
+    /**
+     * Checks if the chain of {@IoHandlerCommand} contains a specific 
{@IoHandlerCommand}
+     * 
+     * @param commandType The type of {@IoHandlerCommand} we are looking for
+     * @return <tt>TRUE</tt> if the {@IoHandlerCommand} is found in the chain
+     */
     public boolean contains(Class<? extends IoHandlerCommand> commandType) {
         Entry e = head.nextEntry;
+        
         while (e != tail) {
             if (commandType.isAssignableFrom(e.getCommand().getClass())) {
                 return true;
             }
+            
             e = e.nextEntry;
         }
+        
         return false;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public String toString() {
         StringBuilder buf = new StringBuilder();
@@ -244,6 +354,7 @@ public class IoHandlerChain implements IoHandlerCommand {
         boolean empty = true;
 
         Entry e = head.nextEntry;
+        
         while (e != tail) {
             if (!empty) {
                 buf.append(", ");
@@ -289,6 +400,7 @@ public class IoHandlerChain implements IoHandlerCommand {
             if (command == null) {
                 throw new IllegalArgumentException("command");
             }
+            
             if (name == null) {
                 throw new IllegalArgumentException("name");
             }
@@ -298,9 +410,12 @@ public class IoHandlerChain implements IoHandlerCommand {
             this.name = name;
             this.command = command;
             this.nextCommand = new NextCommand() {
+                /**
+                 * {@inheritDoc}
+                 */
+                @Override
                 public void execute(IoSession session, Object message) throws 
Exception {
-                    Entry nextEntry = Entry.this.nextEntry;
-                    callNextCommand(nextEntry, session, message);
+                    callNextCommand(Entry.this.nextEntry, session, message);
                 }
             };
         }

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java 
b/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
index 3cad95f..2ff2a58 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
@@ -74,17 +74,17 @@ import org.apache.mina.util.IdentityHashSet;
  */
 public class DemuxingIoHandler extends IoHandlerAdapter {
 
-    private final Map<Class<?>, MessageHandler<?>> receivedMessageHandlerCache 
= new ConcurrentHashMap<Class<?>, MessageHandler<?>>();
+    private final Map<Class<?>, MessageHandler<?>> receivedMessageHandlerCache 
= new ConcurrentHashMap<>();
 
-    private final Map<Class<?>, MessageHandler<?>> receivedMessageHandlers = 
new ConcurrentHashMap<Class<?>, MessageHandler<?>>();
+    private final Map<Class<?>, MessageHandler<?>> receivedMessageHandlers = 
new ConcurrentHashMap<>();
 
-    private final Map<Class<?>, MessageHandler<?>> sentMessageHandlerCache = 
new ConcurrentHashMap<Class<?>, MessageHandler<?>>();
+    private final Map<Class<?>, MessageHandler<?>> sentMessageHandlerCache = 
new ConcurrentHashMap<>();
 
-    private final Map<Class<?>, MessageHandler<?>> sentMessageHandlers = new 
ConcurrentHashMap<Class<?>, MessageHandler<?>>();
+    private final Map<Class<?>, MessageHandler<?>> sentMessageHandlers = new 
ConcurrentHashMap<>();
 
-    private final Map<Class<?>, ExceptionHandler<?>> exceptionHandlerCache = 
new ConcurrentHashMap<Class<?>, ExceptionHandler<?>>();
+    private final Map<Class<?>, ExceptionHandler<?>> exceptionHandlerCache = 
new ConcurrentHashMap<>();
 
-    private final Map<Class<?>, ExceptionHandler<?>> exceptionHandlers = new 
ConcurrentHashMap<Class<?>, ExceptionHandler<?>>();
+    private final Map<Class<?>, ExceptionHandler<?>> exceptionHandlers = new 
ConcurrentHashMap<>();
 
     /**
      * Creates a new instance with no registered {@link MessageHandler}s.
@@ -345,7 +345,7 @@ public class DemuxingIoHandler extends IoHandlerAdapter {
              */
 
             if (triedClasses == null) {
-                triedClasses = new IdentityHashSet<Class<?>>();
+                triedClasses = new IdentityHashSet<>();
             }
             
             triedClasses.add(type);

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java 
b/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java
index 059b3f7..fc59115 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/demux/ExceptionHandler.java
@@ -26,6 +26,8 @@ import org.apache.mina.core.session.IoSession;
  * <code>exceptionCaught</code> events to.  You have to register your
  * handler with the type of exception you want to get notified using
  * {@link DemuxingIoHandler#addExceptionHandler(Class, ExceptionHandler)}.
+ * 
+ * @param <E> The exception type
  *
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
@@ -35,6 +37,10 @@ public interface ExceptionHandler<E extends Throwable> {
      * you want to ignore an exception of a specific type silently.
      */
     ExceptionHandler<Throwable> NOOP = new ExceptionHandler<Throwable>() {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public void exceptionCaught(IoSession session, Throwable cause) {
             // Do nothing
         }
@@ -46,6 +52,10 @@ public interface ExceptionHandler<E extends Throwable> {
      * a specific type is raised.
      */
     ExceptionHandler<Throwable> CLOSE = new ExceptionHandler<Throwable>() {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public void exceptionCaught(IoSession session, Throwable cause) {
             session.closeNow();
         }

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/demux/MessageHandler.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/demux/MessageHandler.java 
b/mina-core/src/main/java/org/apache/mina/handler/demux/MessageHandler.java
index d1a249f..dec14fc 100644
--- a/mina-core/src/main/java/org/apache/mina/handler/demux/MessageHandler.java
+++ b/mina-core/src/main/java/org/apache/mina/handler/demux/MessageHandler.java
@@ -28,14 +28,19 @@ import org.apache.mina.core.session.IoSession;
  * using {@link DemuxingIoHandler#addReceivedMessageHandler(Class, 
MessageHandler)}
  * or {@link DemuxingIoHandler#addSentMessageHandler(Class, MessageHandler)}.
  *
+ * @param <M> The message type
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
-public interface MessageHandler<E> {
+public interface MessageHandler<M> {
     /**
      * A {@link MessageHandler} that does nothing.  This is useful when
      * you want to ignore a message of a specific type silently.
      */
     MessageHandler<Object> NOOP = new MessageHandler<Object>() {
+        /**
+         * {@inheritDoc}
+         */
+        @Override
         public void handleMessage(IoSession session, Object message) {
             // Do nothing
         }
@@ -49,5 +54,5 @@ public interface MessageHandler<E> {
      * @param message the message to decode. Its type is set by the 
implementation
      * @throws Exception if there is an error during the message processing
      */
-    void handleMessage(IoSession session, E message) throws Exception;
+    void handleMessage(IoSession session, M message) throws Exception;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java
 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java
index b11c86e..f2d911e 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandler.java
@@ -41,6 +41,8 @@ import org.apache.mina.core.session.IoSession;
  * WARNING: This class is badly named as the actual {@link IoHandler} 
implementor
  * is in fact the {@link SingleSessionIoHandlerDelegate}.
  * 
+ * @deprecated This class is not to be used anymore
+ * 
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerAdapter.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerAdapter.java
 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerAdapter.java
index d54ebc7..12bafed 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerAdapter.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerAdapter.java
@@ -26,6 +26,8 @@ import org.apache.mina.core.session.IoSession;
  * Adapter class for implementors of the {@link SingleSessionIoHandler}
  * interface. The session to which the handler is assigned is accessible
  * through the getSession() method.
+ * 
+ * @deprecated This class is deprecated
  *
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
@@ -46,6 +48,7 @@ public class SingleSessionIoHandlerAdapter implements 
SingleSessionIoHandler {
         if (session == null) {
             throw new IllegalArgumentException("session");
         }
+        
         this.session = session;
     }
 
@@ -58,34 +61,66 @@ public class SingleSessionIoHandlerAdapter implements 
SingleSessionIoHandler {
         return session;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void exceptionCaught(Throwable th) throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void inputClosed(IoSession session) {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void messageReceived(Object message) throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void messageSent(Object message) throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void sessionClosed() throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void sessionCreated() throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void sessionIdle(IdleStatus status) throws Exception {
         // Do nothing
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public void sessionOpened() throws Exception {
         // Do nothing
     }

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
index ac5a383..5b6cacd 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerDelegate.java
@@ -35,6 +35,8 @@ import org.apache.mina.core.session.IoSession;
  * will lower scalability if building an high performance server. This should 
only
  * be used with very specific needs in mind.
  * 
+ * @deprecated This class is deprecated
+ * 
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 @Deprecated
@@ -79,9 +81,8 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * attribute named {@link #HANDLER}.
      * 
      * @see 
org.apache.mina.core.service.IoHandler#sessionCreated(org.apache.mina.core.session.IoSession)
-     * 
-     * {@inheritDoc}
      */
+    @Override
     public void sessionCreated(IoSession session) throws Exception {
         SingleSessionIoHandler handler = factory.getHandler(session);
         session.setAttribute(HANDLER, handler);
@@ -95,6 +96,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void sessionOpened(IoSession session) throws Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.sessionOpened();
@@ -107,6 +109,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void sessionClosed(IoSession session) throws Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.sessionClosed();
@@ -119,6 +122,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void sessionIdle(IoSession session, IdleStatus status) throws 
Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.sessionIdle(status);
@@ -131,6 +135,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void exceptionCaught(IoSession session, Throwable cause) throws 
Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.exceptionCaught(cause);
@@ -143,6 +148,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void messageReceived(IoSession session, Object message) throws 
Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.messageReceived(message);
@@ -155,6 +161,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
      * 
      * {@inheritDoc}
      */
+    @Override
     public void messageSent(IoSession session, Object message) throws 
Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.messageSent(message);
@@ -163,6 +170,7 @@ public class SingleSessionIoHandlerDelegate implements 
IoHandler {
     /**
      * {@inheritDoc}
      */
+    @Override
     public void inputClosed(IoSession session) throws Exception {
         SingleSessionIoHandler handler = (SingleSessionIoHandler) 
session.getAttribute(HANDLER);
         handler.inputClosed(session);

http://git-wip-us.apache.org/repos/asf/mina/blob/9f00651f/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java
----------------------------------------------------------------------
diff --git 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java
 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java
index ff77bc7..01280fa 100644
--- 
a/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java
+++ 
b/mina-core/src/main/java/org/apache/mina/handler/multiton/SingleSessionIoHandlerFactory.java
@@ -26,6 +26,8 @@ import org.apache.mina.core.session.IoSession;
  * particular session.
  *
  * @see SingleSessionIoHandler
+ * 
+ * @deprecated this class is deprecated
  *
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */

Reply via email to