You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by jv...@apache.org on 2012/11/06 15:33:02 UTC

svn commit: r1406147 - in /mina/mina/trunk: core/src/main/java/org/apache/mina/api/ core/src/main/java/org/apache/mina/filter/codec/ core/src/main/java/org/apache/mina/filter/logging/ core/src/main/java/org/apache/mina/session/ core/src/main/java/org/a...

Author: jvermillard
Date: Tue Nov  6 14:33:01 2012
New Revision: 1406147

URL: http://svn.apache.org/viewvc?rev=1406147&view=rev
Log:
removed sessionCreated event, because it's useless, just use sessionOpened

Modified:
    mina/mina/trunk/core/src/main/java/org/apache/mina/api/AbstractIoFilter.java
    mina/mina/trunk/core/src/main/java/org/apache/mina/api/IoFilter.java
    mina/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
    mina/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LoggingFilter.java
    mina/mina/trunk/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
    mina/mina/trunk/core/src/main/java/org/apache/mina/transport/nio/NioTcpServer.java
    mina/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java
    mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/echoserver/NioEchoServer.java
    mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/udpecho/NioUdpEchoServer.java

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/api/AbstractIoFilter.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/api/AbstractIoFilter.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/api/AbstractIoFilter.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/api/AbstractIoFilter.java Tue Nov  6 14:33:01 2012
@@ -28,31 +28,42 @@ import org.apache.mina.filterchain.Write
  */
 public abstract class AbstractIoFilter implements IoFilter {
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void sessionCreated(IoSession session) {
-
+    public void sessionOpened(final IoSession session) {
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void sessionOpened(IoSession session) {
+    public void sessionClosed(final IoSession session) {
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void sessionClosed(IoSession session) {
+    public void sessionIdle(final IoSession session, final IdleStatus status) {
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void sessionIdle(IoSession session, IdleStatus status) {
-    }
-
-    @Override
-    public void messageReceived(IoSession session, Object message, ReadFilterChainController controller) {
+    public void messageReceived(final IoSession session, final Object message,
+            final ReadFilterChainController controller) {
         controller.callReadNextFilter(message);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
-    public void messageWriting(IoSession session, Object message, WriteFilterChainController controller) {
+    public void messageWriting(final IoSession session, final Object message,
+            final WriteFilterChainController controller) {
         controller.callWriteNextFilter(message);
     }
-
-}
+}
\ No newline at end of file

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/api/IoFilter.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/api/IoFilter.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/api/IoFilter.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/api/IoFilter.java Tue Nov  6 14:33:01 2012
@@ -25,46 +25,35 @@ import org.apache.mina.filterchain.Write
 
 /**
  * Filter are interceptors/processors for incoming data received/sent.
- *
+ * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public interface IoFilter {
 
     /**
-     * Invoked from an I/O processor thread when a new connection has been created. Because this method is supposed to
-     * be called from the same thread that handles I/O of multiple sessions, please implement this method to perform
-     * tasks that consumes minimal amount of time such as socket parameter and user-defined session attribute
-     * initialization.
-     *
-     * @param session {@link IoSession} associated with the invocation
-     *
-     */
-    void sessionCreated(IoSession session);
-
-    /**
      * Invoked when a connection has been opened.
-     *
+     * 
      * @param session {@link IoSession} associated with the invocation
      */
     void sessionOpened(IoSession session);
 
     /**
      * Invoked when a connection is closed.
-     *
+     * 
      * @param session {@link IoSession} associated with the invocation
      */
     void sessionClosed(IoSession session);
 
     /**
      * Invoked with the related {@link IdleStatus} when a connection becomes idle.
-     *
+     * 
      * @param session {@link IoSession} associated with the invocation
      */
     void sessionIdle(IoSession session, IdleStatus status);
 
     /**
      * Invoked when a message is received.
-     *
+     * 
      * @param session {@link IoSession} associated with the invocation
      * @param message the incoming message to process
      */
@@ -72,7 +61,7 @@ public interface IoFilter {
 
     /**
      * Invoked when a message is under writing. The filter is supposed to apply the needed transformation.
-     *
+     * 
      * @param session {@link IoSession} associated with the invocation
      * @param message the message to process before writing
      */

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java Tue Nov  6 14:33:01 2012
@@ -31,10 +31,9 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * An {@link IoFilter} which translates binary or protocol specific data into
- * message objects and vice versa using {@link ProtocolCodecFactory},
- * {@link ProtocolEncoder}, or {@link ProtocolDecoder}.
- *
+ * An {@link IoFilter} which translates binary or protocol specific data into message objects and vice versa using
+ * {@link ProtocolCodecFactory}, {@link ProtocolEncoder}, or {@link ProtocolDecoder}.
+ * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
 public class ProtocolCodecFilter extends AbstractIoFilter {
@@ -56,12 +55,11 @@ public class ProtocolCodecFilter extends
 
     /**
      * 
-     * Creates a new instance of ProtocolCodecFilter, associating a factory
-     * for the creation of the encoder and decoder.
-     *
+     * Creates a new instance of ProtocolCodecFilter, associating a factory for the creation of the encoder and decoder.
+     * 
      * @param factory The associated factory
      */
-    public ProtocolCodecFilter(ProtocolCodecFactory factory) {
+    public ProtocolCodecFilter(final ProtocolCodecFactory factory) {
         if (factory == null) {
             throw new IllegalArgumentException("factory");
         }
@@ -70,9 +68,8 @@ public class ProtocolCodecFilter extends
     }
 
     /**
-     * Creates a new instance of ProtocolCodecFilter, without any factory.
-     * The encoder/decoder factory will be created as an inner class, using
-     * the two parameters (encoder and decoder).
+     * Creates a new instance of ProtocolCodecFilter, without any factory. The encoder/decoder factory will be created
+     * as an inner class, using the two parameters (encoder and decoder).
      * 
      * @param encoder The class responsible for encoding the message
      * @param decoder The class responsible for decoding the message
@@ -88,21 +85,22 @@ public class ProtocolCodecFilter extends
 
         // Create the inner Factory based on the two parameters
         this.factory = new ProtocolCodecFactory() {
-            public ProtocolEncoder getEncoder(IoSession session) {
+            @Override
+            public ProtocolEncoder getEncoder(final IoSession session) {
                 return encoder;
             }
 
-            public ProtocolDecoder getDecoder(IoSession session) {
+            @Override
+            public ProtocolDecoder getDecoder(final IoSession session) {
                 return decoder;
             }
         };
     }
 
     /**
-     * Creates a new instance of ProtocolCodecFilter, without any factory.
-     * The encoder/decoder factory will be created as an anonymous class, using
-     * the two parameters (encoder and decoder), which are class names. Instances
-     * for those classes will be created in this constructor.
+     * Creates a new instance of ProtocolCodecFilter, without any factory. The encoder/decoder factory will be created
+     * as an anonymous class, using the two parameters (encoder and decoder), which are class names. Instances for those
+     * classes will be created in this constructor.
      * 
      * @param encoder The class responsible for encoding the message
      * @param decoder The class responsible for decoding the message
@@ -127,13 +125,13 @@ public class ProtocolCodecFilter extends
 
         try {
             encoderClass.getConstructor(EMPTY_PARAMS);
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             throw new IllegalArgumentException("encoderClass doesn't have a public default constructor.");
         }
 
         try {
             decoderClass.getConstructor(EMPTY_PARAMS);
-        } catch (NoSuchMethodException e) {
+        } catch (final NoSuchMethodException e) {
             throw new IllegalArgumentException("decoderClass doesn't have a public default constructor.");
         }
 
@@ -141,7 +139,7 @@ public class ProtocolCodecFilter extends
 
         try {
             encoder = encoderClass.newInstance();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new IllegalArgumentException("encoderClass cannot be initialized");
         }
 
@@ -149,17 +147,19 @@ public class ProtocolCodecFilter extends
 
         try {
             decoder = decoderClass.newInstance();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new IllegalArgumentException("decoderClass cannot be initialized");
         }
 
         // Create the inner factory based on the two parameters.
         this.factory = new ProtocolCodecFactory() {
-            public ProtocolEncoder getEncoder(IoSession session) {
+            @Override
+            public ProtocolEncoder getEncoder(final IoSession session) {
                 return encoder;
             }
 
-            public ProtocolDecoder getDecoder(IoSession session) {
+            @Override
+            public ProtocolDecoder getDecoder(final IoSession session) {
                 return decoder;
             }
         };
@@ -167,29 +167,27 @@ public class ProtocolCodecFilter extends
 
     /**
      * Get the encoder instance from a given session.
-     *
+     * 
      * @param session The associated session we will get the encoder from
      * @return The encoder instance, if any
      */
-    public ProtocolEncoder getEncoder(IoSession session) {
+    public ProtocolEncoder getEncoder(final IoSession session) {
         return factory.getEncoder(session);
     }
 
     /**
      * Get the decoder instance from a given session.
-     *
+     * 
      * @param session The associated session we will get the decoder from
      * @return The decoder instance, if any
      */
-    public ProtocolDecoder getDecoder(IoSession session) {
+    public ProtocolDecoder getDecoder(final IoSession session) {
         return factory.getDecoder(session);
     }
 
     /**
-     * Process the incoming message, calling the session decoder. As the incoming
-     * buffer might contains more than one messages, we have to loop until the decoder
-     * throws an exception.
-     * <code>
+     * Process the incoming message, calling the session decoder. As the incoming buffer might contains more than one
+     * messages, we have to loop until the decoder throws an exception. <code>
      *  while ( buffer not empty )
      *    try
      *      decode ( buffer )
@@ -198,7 +196,8 @@ public class ProtocolCodecFilter extends
      * </code>
      */
     @Override
-    public void messageReceived(IoSession session, Object message, ReadFilterChainController controller) {
+    public void messageReceived(final IoSession session, final Object message,
+            final ReadFilterChainController controller) {
         LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session);
 
         if (!(message instanceof ByteBuffer)) {
@@ -206,8 +205,8 @@ public class ProtocolCodecFilter extends
             return;
         }
 
-        ByteBuffer in = (ByteBuffer) message;
-        ProtocolDecoder decoder = getDecoder(session);
+        final ByteBuffer in = (ByteBuffer) message;
+        final ProtocolDecoder decoder = getDecoder(session);
 
         // Loop until we don't have anymore byte in the buffer,
         // or until the decoder throws an unrecoverable exception or
@@ -223,10 +222,11 @@ public class ProtocolCodecFilter extends
      * {@inheritDoc}
      */
     @Override
-    public void messageWriting(IoSession session, Object message, WriteFilterChainController controller) {
+    public void messageWriting(final IoSession session, final Object message,
+            final WriteFilterChainController controller) {
         LOGGER.debug("Processing a MESSAGE_WRITTING for session {}", session);
 
-        ProtocolEncoder encoder = session.getAttribute(ENCODER, null);
+        final ProtocolEncoder encoder = session.getAttribute(ENCODER, null);
 
         encoder.encode(session, message, controller);
     }
@@ -235,12 +235,12 @@ public class ProtocolCodecFilter extends
      * {@inheritDoc}
      */
     @Override
-    public void sessionCreated(IoSession session) {
+    public void sessionOpened(final IoSession session) {
         // Initialize the encoder and decoder if we use a factory
         if (factory != null) {
-            ProtocolEncoder encoder = factory.getEncoder(session);
+            final ProtocolEncoder encoder = factory.getEncoder(session);
             session.setAttribute(ENCODER, encoder);
-            ProtocolDecoder decoder = factory.getDecoder(session);
+            final ProtocolDecoder decoder = factory.getDecoder(session);
             session.setAttribute(DECODER, decoder);
         }
     }
@@ -249,16 +249,15 @@ public class ProtocolCodecFilter extends
      * {@inheritDoc}
      */
     @Override
-    public void sessionClosed(IoSession session) {
+    public void sessionClosed(final IoSession session) {
         disposeCodec(session);
     }
 
-    //----------- Helper methods ---------------------------------------------
+    // ----------- Helper methods ---------------------------------------------
     /**
-     * Dispose the encoder, decoder, and the callback for the decoded
-     * messages.
+     * Dispose the encoder, decoder, and the callback for the decoded messages.
      */
-    private void disposeCodec(IoSession session) {
+    private void disposeCodec(final IoSession session) {
         // We just remove the two instances of encoder/decoder to release resources
         // from the session
         disposeEncoder(session);
@@ -266,12 +265,11 @@ public class ProtocolCodecFilter extends
     }
 
     /**
-     * Dispose the encoder, removing its instance from the
-     * session's attributes, and calling the associated
-     * dispose method.
+     * Dispose the encoder, removing its instance from the session's attributes, and calling the associated dispose
+     * method.
      */
-    private void disposeEncoder(IoSession session) {
-        ProtocolEncoder encoder = (ProtocolEncoder) session.removeAttribute(ENCODER);
+    private void disposeEncoder(final IoSession session) {
+        final ProtocolEncoder encoder = session.removeAttribute(ENCODER);
 
         if (encoder == null) {
             return;
@@ -279,25 +277,24 @@ public class ProtocolCodecFilter extends
 
         try {
             encoder.dispose(session);
-        } catch (Throwable t) {
+        } catch (final Throwable t) {
             LOGGER.warn("Failed to dispose: " + encoder.getClass().getName() + " (" + encoder + ')');
         }
     }
 
     /**
-     * Dispose the decoder, removing its instance from the
-     * session's attributes, and calling the associated
-     * dispose method.
+     * Dispose the decoder, removing its instance from the session's attributes, and calling the associated dispose
+     * method.
      */
-    private void disposeDecoder(IoSession session) {
-        ProtocolDecoder decoder = (ProtocolDecoder) session.removeAttribute(DECODER);
+    private void disposeDecoder(final IoSession session) {
+        final ProtocolDecoder decoder = session.removeAttribute(DECODER);
         if (decoder == null) {
             return;
         }
 
         try {
             decoder.dispose(session);
-        } catch (Throwable t) {
+        } catch (final Throwable t) {
             LOGGER.warn("Failed to dispose: " + decoder.getClass().getName() + " (" + decoder + ')');
         }
     }

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LoggingFilter.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LoggingFilter.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LoggingFilter.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/filter/logging/LoggingFilter.java Tue Nov  6 14:33:01 2012
@@ -32,8 +32,9 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A simple filter logging incoming events.
+ * 
  * @author jvermillar
- *
+ * 
  */
 public class LoggingFilter implements IoFilter {
 
@@ -49,9 +50,6 @@ public class LoggingFilter implements Io
     /** The log level for the messageReceived event. Default to INFO. */
     private LogLevel messageReceivedLevel = LogLevel.INFO;
 
-    /** The log level for the sessionCreated event. Default to INFO. */
-    private LogLevel sessionCreatedLevel = LogLevel.INFO;
-
     /** The log level for the sessionOpened event. Default to INFO. */
     private LogLevel sessionOpenedLevel = LogLevel.INFO;
 
@@ -73,7 +71,7 @@ public class LoggingFilter implements Io
      * 
      * @param clazz the class which name will be used to create the logger
      */
-    public LoggingFilter(Class<?> clazz) {
+    public LoggingFilter(final Class<?> clazz) {
         this(clazz.getName());
     }
 
@@ -82,7 +80,7 @@ public class LoggingFilter implements Io
      * 
      * @param name the name used to create the logger. If null, will default to "LoggingFilter"
      */
-    public LoggingFilter(String name) {
+    public LoggingFilter(final String name) {
         if (name == null) {
             this.name = LoggingFilter.class.getName();
         } else {
@@ -93,14 +91,13 @@ public class LoggingFilter implements Io
     }
 
     /**
-     * Log if the logger and the current event log level are compatible. We log
-     * a formated message and its parameters.
+     * Log if the logger and the current event log level are compatible. We log a formated message and its parameters.
      * 
      * @param eventLevel the event log level as requested by the user
      * @param message the formated message to log
      * @param param the parameter injected into the message
      */
-    private void log(LogLevel eventLevel, String message, Object param) {
+    private void log(final LogLevel eventLevel, final String message, final Object param) {
         switch (eventLevel) {
         case TRACE:
             logger.trace(message, param);
@@ -123,13 +120,12 @@ public class LoggingFilter implements Io
     }
 
     /**
-     * Log if the logger and the current event log level are compatible. We log
-     * a simple message.
+     * Log if the logger and the current event log level are compatible. We log a simple message.
      * 
      * @param eventLevel the event log level as requested by the user
      * @param message the message to log
      */
-    private void log(LogLevel eventLevel, String message) {
+    private void log(final LogLevel eventLevel, final String message) {
         switch (eventLevel) {
         case TRACE:
             logger.trace(message);
@@ -155,15 +151,7 @@ public class LoggingFilter implements Io
      * {@inheritDoc}
      */
     @Override
-    public void sessionCreated(IoSession session) {
-        log(sessionCreatedLevel, "CREATED");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void sessionOpened(IoSession session) {
+    public void sessionOpened(final IoSession session) {
         log(sessionOpenedLevel, "OPENED");
 
     }
@@ -172,7 +160,7 @@ public class LoggingFilter implements Io
      * {@inheritDoc}
      */
     @Override
-    public void sessionClosed(IoSession session) {
+    public void sessionClosed(final IoSession session) {
         log(sessionClosedLevel, "CLOSED");
     }
 
@@ -180,7 +168,7 @@ public class LoggingFilter implements Io
      * {@inheritDoc}
      */
     @Override
-    public void sessionIdle(IoSession session, IdleStatus status) {
+    public void sessionIdle(final IoSession session, final IdleStatus status) {
         log(sessionIdleLevel, "IDLE");
     }
 
@@ -188,7 +176,8 @@ public class LoggingFilter implements Io
      * {@inheritDoc}
      */
     @Override
-    public void messageReceived(IoSession session, Object message, ReadFilterChainController controller) {
+    public void messageReceived(final IoSession session, final Object message,
+            final ReadFilterChainController controller) {
         if (message instanceof ByteBuffer) {
             log(messageReceivedLevel, "RECEIVED: {}", ByteBufferDumper.dump((ByteBuffer) message));
         } else {
@@ -202,7 +191,8 @@ public class LoggingFilter implements Io
      * {@inheritDoc}
      */
     @Override
-    public void messageWriting(IoSession session, Object message, WriteFilterChainController controller) {
+    public void messageWriting(final IoSession session, final Object message,
+            final WriteFilterChainController controller) {
         if (message instanceof ByteBuffer) {
             log(messageReceivedLevel, "WRITTING: {}", ByteBufferDumper.dump((ByteBuffer) message));
         } else {
@@ -211,16 +201,16 @@ public class LoggingFilter implements Io
         controller.callWriteNextFilter(message);
     }
 
-    //=========================
+    // =========================
     // SETTERS & GETTERS
-    //=========================
+    // =========================
 
     /**
      * Set the LogLevel for the MessageReceived event.
      * 
      * @param level The LogLevel to set
      */
-    public void setMessageReceivedLogLevel(LogLevel level) {
+    public void setMessageReceivedLogLevel(final LogLevel level) {
         messageReceivedLevel = level;
     }
 
@@ -238,7 +228,7 @@ public class LoggingFilter implements Io
      * 
      * @param level The LogLevel to set
      */
-    public void setMessageWritingLogLevel(LogLevel level) {
+    public void setMessageWritingLogLevel(final LogLevel level) {
         messageWritingLevel = level;
     }
 
@@ -252,29 +242,11 @@ public class LoggingFilter implements Io
     }
 
     /**
-     * Set the LogLevel for the SessionCreated event.
-     * 
-     * @param level The LogLevel to set
-     */
-    public void setSessionCreatedLogLevel(LogLevel level) {
-        sessionCreatedLevel = level;
-    }
-
-    /**
-     * Get the LogLevel for the SessionCreated event.
-     * 
-     * @return The LogLevel for the SessionCreated eventType
-     */
-    public LogLevel getSessionCreatedLogLevel() {
-        return sessionCreatedLevel;
-    }
-
-    /**
      * Set the LogLevel for the SessionOpened event.
      * 
      * @param level The LogLevel to set
      */
-    public void setSessionOpenedLogLevel(LogLevel level) {
+    public void setSessionOpenedLogLevel(final LogLevel level) {
         sessionOpenedLevel = level;
     }
 
@@ -292,7 +264,7 @@ public class LoggingFilter implements Io
      * 
      * @param level The LogLevel to set
      */
-    public void setSessionIdleLogLevel(LogLevel level) {
+    public void setSessionIdleLogLevel(final LogLevel level) {
         sessionIdleLevel = level;
     }
 
@@ -310,7 +282,7 @@ public class LoggingFilter implements Io
      * 
      * @param level The LogLevel to set
      */
-    public void setSessionClosedLogLevel(LogLevel level) {
+    public void setSessionClosedLogLevel(final LogLevel level) {
         sessionClosedLevel = level;
     }
 

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/session/AbstractIoSession.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/session/AbstractIoSession.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/session/AbstractIoSession.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/session/AbstractIoSession.java Tue Nov  6 14:33:01 2012
@@ -73,9 +73,9 @@ public abstract class AbstractIoSession 
     /** the {@link IdleChecker} in charge of detecting idle event for this session */
     protected final IdleChecker idleChecker;
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Basic statistics
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /** The number of bytes read since this session has been created */
     private volatile long readBytes;
@@ -89,9 +89,9 @@ public abstract class AbstractIoSession 
     /** Last time something was written for this session */
     private volatile long lastWriteTime;
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Session state
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /** The session's state : one of CREATED, CONNECTED, CLOSING, CLOSED, SECURING, CONNECTED_SECURED */
     protected volatile SessionState state;
@@ -111,9 +111,9 @@ public abstract class AbstractIoSession 
     /** is this session registered for being polled for write ready events */
     private final AtomicBoolean registeredForWrite = new AtomicBoolean();
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Write queue
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /** the queue of pending writes for the session, to be dequeued by the {@link SelectorProcessor} */
     private final Queue<WriteRequest> writeQueue = new DefaultWriteQueue();
@@ -127,9 +127,9 @@ public abstract class AbstractIoSession 
     /** A Write lock on the reentrant writeQueue lock */
     private final Lock writeQueueWriteLock = writeQueueLock.writeLock();
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Filter chain
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /** The list of {@link IoFilter} implementing this chain. */
     private final IoFilter[] chain;
@@ -150,7 +150,7 @@ public abstract class AbstractIoSession 
      * @param service the service this session is associated with
      * @param selectorLoop the selector loop in charge of processing this session read/write events
      */
-    public AbstractIoSession(IoService service, IdleChecker idleChecker) {
+    public AbstractIoSession(final IoService service, final IdleChecker idleChecker) {
         // generated a unique id
         id = NEXT_ID.getAndIncrement();
         creationTime = System.currentTimeMillis();
@@ -163,9 +163,9 @@ public abstract class AbstractIoSession 
         this.state = SessionState.CREATED;
     }
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Session State management
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     /**
      * {@inheritDoc}
      */
@@ -254,7 +254,7 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public void changeState(SessionState to) throws IllegalStateException {
+    public void changeState(final SessionState to) throws IllegalStateException {
         try {
             stateWriteLock.lock();
 
@@ -329,9 +329,9 @@ public abstract class AbstractIoSession 
         }
     }
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // SSL/TLS session state management
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     /**
      * {@inheritDoc}
      */
@@ -343,7 +343,7 @@ public abstract class AbstractIoSession 
     /**
      * {@inheritDoc}
      */
-    public void setSecured(boolean secured) {
+    public void setSecured(final boolean secured) {
         this.secured = secured;
     }
 
@@ -351,8 +351,8 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public void initSecure(SSLContext sslContext) throws SSLException {
-        SslHelper sslHelper = new SslHelper(this, sslContext);
+    public void initSecure(final SSLContext sslContext) throws SSLException {
+        final SslHelper sslHelper = new SslHelper(this, sslContext);
         sslHelper.init();
 
         attributes.setAttribute(SSL_HELPER, sslHelper);
@@ -385,9 +385,10 @@ public abstract class AbstractIoSession 
 
     /**
      * To be called by the internal plumber when some bytes are written on the socket
+     * 
      * @param bytesCount number of extra bytes written
      */
-    public void incrementWrittenBytes(int bytesCount) {
+    public void incrementWrittenBytes(final int bytesCount) {
         writtenBytes += bytesCount;
     }
 
@@ -438,7 +439,7 @@ public abstract class AbstractIoSession 
      * @see #setAttribute(AttributeKey, Object)
      */
     @Override
-    public final <T> T getAttribute(AttributeKey<T> key, T defaultValue) {
+    public final <T> T getAttribute(final AttributeKey<T> key, final T defaultValue) {
         return attributes.getAttribute(key, defaultValue);
     }
 
@@ -449,29 +450,25 @@ public abstract class AbstractIoSession 
      * @see #setAttribute(AttributeKey, Object)
      */
     @Override
-    public final <T> T getAttribute(AttributeKey<T> key) {
+    public final <T> T getAttribute(final AttributeKey<T> key) {
         return attributes.getAttribute(key);
     }
 
     /**
      * {@inheritDoc}
      * 
-     * @exception IllegalArgumentException
-     * <ul>
-     *   <li>
-     *     if <code>key==null</code>
-     *   </li>
-     *   <li>
-     *     if <code>value</code> is not <code>null</code> and not
-     *     an instance of type that is specified in by the given
-     *     <code>key</code> (see {@link AttributeKey#getType()})
-     *   </li>
-     *  </ul>
+     * @exception IllegalArgumentException <ul>
+     *            <li>
+     *            if <code>key==null</code></li>
+     *            <li>
+     *            if <code>value</code> is not <code>null</code> and not an instance of type that is specified in by the
+     *            given <code>key</code> (see {@link AttributeKey#getType()})</li>
+     *            </ul>
      * 
      * @see #getAttribute(AttributeKey)
      */
     @Override
-    public final <T> T setAttribute(AttributeKey<? extends T> key, T value) {
+    public final <T> T setAttribute(final AttributeKey<? extends T> key, final T value) {
         return attributes.setAttribute(key, value);
     };
 
@@ -488,23 +485,22 @@ public abstract class AbstractIoSession 
     /**
      * {@inheritDoc}
      * 
-     * @exception IllegalArgumentException
-     *                if <code>key==null</code>
+     * @exception IllegalArgumentException if <code>key==null</code>
      */
     @Override
-    public <T> T removeAttribute(AttributeKey<T> key) {
+    public <T> T removeAttribute(final AttributeKey<T> key) {
         return attributes.removeAttribute(key);
     }
 
-    //----------------------------------------------------
+    // ----------------------------------------------------
     // Write management
-    //----------------------------------------------------
+    // ----------------------------------------------------
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public void write(Object message) {
+    public void write(final Object message) {
         doWriteWithFuture(message, null);
     }
 
@@ -512,13 +508,13 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public IoFuture<Void> writeWithFuture(Object message) {
-        IoFuture<Void> future = new DefaultWriteFuture();
+    public IoFuture<Void> writeWithFuture(final Object message) {
+        final IoFuture<Void> future = new DefaultWriteFuture();
         doWriteWithFuture(message, future);
         return future;
     }
 
-    private void doWriteWithFuture(Object message, IoFuture<Void> future) {
+    private void doWriteWithFuture(final Object message, final IoFuture<Void> future) {
         LOG.debug("writing message {} to session {}", message, this);
 
         if ((state == SessionState.CLOSED) || (state == SessionState.CLOSING)) {
@@ -534,7 +530,7 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public WriteRequest enqueueWriteRequest(Object message) {
+    public WriteRequest enqueueWriteRequest(final Object message) {
         WriteRequest request = null;
 
         try {
@@ -543,7 +539,7 @@ public abstract class AbstractIoSession 
 
             if (isConnectedSecured()) {
                 // SSL/TLS : we have to encrypt the message
-                SslHelper sslHelper = getAttribute(SSL_HELPER, null);
+                final SslHelper sslHelper = getAttribute(SSL_HELPER, null);
 
                 if (sslHelper == null) {
                     throw new IllegalStateException();
@@ -592,9 +588,9 @@ public abstract class AbstractIoSession 
         writeQueueWriteLock.unlock();
     }
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Close session management
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
 
     /** we pre-allocate a close future for lock-less {@link #close(boolean)} */
     private final IoFuture<Void> closeFuture = new AbstractIoFuture<Void>() {
@@ -603,7 +599,7 @@ public abstract class AbstractIoSession 
          * {@inheritDoc}
          */
         @Override
-        protected boolean cancelOwner(boolean mayInterruptIfRunning) {
+        protected boolean cancelOwner(final boolean mayInterruptIfRunning) {
             // we don't cancel close
             return false;
         }
@@ -613,7 +609,7 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public IoFuture<Void> close(boolean immediately) {
+    public IoFuture<Void> close(final boolean immediately) {
         switch (state) {
         case CREATED:
             LOG.error("Session {} not opened", this);
@@ -646,20 +642,9 @@ public abstract class AbstractIoSession 
      */
     protected abstract void channelClose();
 
-    //------------------------------------------------------------------------
+    // ------------------------------------------------------------------------
     // Event processing using the filter chain
-    //------------------------------------------------------------------------
-
-    /**
-     * process session create event using the filter chain. To be called by the session {@link SelectorProcessor} .
-     */
-    public void processSessionCreated() {
-        LOG.debug("processing session created event for session {}", this);
-
-        for (IoFilter filter : chain) {
-            filter.sessionCreated(this);
-        }
-    }
+    // ------------------------------------------------------------------------
 
     /**
      * process session opened event using the filter chain. To be called by the session {@link SelectorProcessor} .
@@ -667,7 +652,7 @@ public abstract class AbstractIoSession 
     public void processSessionOpened() {
         LOG.debug("processing session open event");
 
-        for (IoFilter filter : chain) {
+        for (final IoFilter filter : chain) {
             filter.sessionOpened(this);
         }
     }
@@ -678,7 +663,7 @@ public abstract class AbstractIoSession 
     public void processSessionClosed() {
         LOG.debug("processing session closed event");
 
-        for (IoFilter filter : chain) {
+        for (final IoFilter filter : chain) {
             filter.sessionClosed(this);
         }
     }
@@ -686,22 +671,24 @@ public abstract class AbstractIoSession 
     /**
      * process session idle event using the filter chain. To be called by the session {@link SelectorProcessor} .
      */
-    public void processSessionIdle(IdleStatus status) {
+    public void processSessionIdle(final IdleStatus status) {
         LOG.debug("processing session idle {} event for session {}", status, this);
 
-        for (IoFilter filter : chain) {
+        for (final IoFilter filter : chain) {
             filter.sessionIdle(this, status);
         }
     }
 
     /**
-     * process session message received event using the filter chain. To be called by the session {@link SelectorProcessor} .
-     * @param message the received message 
+     * process session message received event using the filter chain. To be called by the session
+     * {@link SelectorProcessor} .
+     * 
+     * @param message the received message
      */
-    public void processMessageReceived(ByteBuffer message) {
+    public void processMessageReceived(final ByteBuffer message) {
         LOG.debug("processing message '{}' received event for session {}", message, this);
 
-        // save basic statistics 
+        // save basic statistics
         readBytes += message.remaining();
         lastReadTime = System.currentTimeMillis();
 
@@ -715,10 +702,12 @@ public abstract class AbstractIoSession 
     }
 
     /**
-     * process session message writing event using the filter chain. To be called by the session {@link SelectorProcessor} .
-     * @param message the wrote message, should be transformed into ByteBuffer at the end of the filter chain 
+     * process session message writing event using the filter chain. To be called by the session
+     * {@link SelectorProcessor} .
+     * 
+     * @param message the wrote message, should be transformed into ByteBuffer at the end of the filter chain
      */
-    public void processMessageWriting(Object message, IoFuture<Void> future) {
+    public void processMessageWriting(final Object message, final IoFuture<Void> future) {
         LOG.debug("processing message '{}' writing event for session {}", message, this);
 
         lastWriteRequest = null;
@@ -728,14 +717,14 @@ public abstract class AbstractIoSession 
         } else {
             writeChainPosition = chain.length - 1;
             // we call the first filter, it's supposed to call the next ones using the filter chain controller
-            int position = writeChainPosition;
-            IoFilter nextFilter = chain[position];
+            final int position = writeChainPosition;
+            final IoFilter nextFilter = chain[position];
             nextFilter.messageWriting(this, message, this);
         }
 
         // put the future in the last write request
         if (future != null) {
-            WriteRequest request = lastWriteRequest;
+            final WriteRequest request = lastWriteRequest;
 
             if (request != null) {
                 ((DefaultWriteRequest) request).setFuture(future);
@@ -744,11 +733,13 @@ public abstract class AbstractIoSession 
     }
 
     /**
-     * process session message received event using the filter chain. To be called by the session {@link SelectorProcessor} .
-     * @param message the received message 
+     * process session message received event using the filter chain. To be called by the session
+     * {@link SelectorProcessor} .
+     * 
+     * @param message the received message
      */
     @Override
-    public void callWriteNextFilter(Object message) {
+    public void callWriteNextFilter(final Object message) {
         LOG.debug("calling next filter for writing for message '{}' position : {}", message, writeChainPosition);
 
         writeChainPosition--;
@@ -767,7 +758,7 @@ public abstract class AbstractIoSession 
     /**
      * At the end of write chain processing, enqueue final encoded {@link ByteBuffer} message in the session
      */
-    private void enqueueFinalWriteMessage(Object message) {
+    private void enqueueFinalWriteMessage(final Object message) {
         LOG.debug("end of write chan we enqueue the message in the session : {}", message);
         lastWriteRequest = enqueueWriteRequest(message);
     }
@@ -776,7 +767,7 @@ public abstract class AbstractIoSession 
      * {@inheritDoc}
      */
     @Override
-    public void callReadNextFilter(Object message) {
+    public void callReadNextFilter(final Object message) {
         readChainPosition++;
 
         if (readChainPosition >= chain.length) {

Modified: mina/mina/trunk/core/src/main/java/org/apache/mina/transport/nio/NioTcpServer.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/main/java/org/apache/mina/transport/nio/NioTcpServer.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/main/java/org/apache/mina/transport/nio/NioTcpServer.java (original)
+++ mina/mina/trunk/core/src/main/java/org/apache/mina/transport/nio/NioTcpServer.java Tue Nov  6 14:33:01 2012
@@ -61,15 +61,16 @@ public class NioTcpServer extends Abstra
      * Create a TCP server with new selector pool of default size.
      */
     public NioTcpServer() {
-        this(new NioSelectorLoop(), new FixedSelectorLoopPool(Runtime.getRuntime().availableProcessors()+1));
+        this(new NioSelectorLoop(), new FixedSelectorLoopPool(Runtime.getRuntime().availableProcessors() + 1));
     }
-    
+
     /**
      * Create a TCP server with provided selector loops pool
+     * 
      * @param acceptSelectorLoop the selector loop for handling accept events (connection of new session)
      * @param readWriteSelectorLoop the pool of selector loop for handling read/write events of connected sessions
      */
-    public NioTcpServer(final SelectorLoop acceptSelectorLoop, SelectorLoopPool readWriteSelectorLoop) {
+    public NioTcpServer(final SelectorLoop acceptSelectorLoop, final SelectorLoopPool readWriteSelectorLoop) {
         super();
         this.acceptSelectorLoop = acceptSelectorLoop;
         this.readWriteSelectorPool = readWriteSelectorLoop;
@@ -77,13 +78,14 @@ public class NioTcpServer extends Abstra
 
     /**
      * Get the inner Server socket for accepting new client connections
+     * 
      * @return
      */
     public ServerSocketChannel getServerSocketChannel() {
         return this.serverChannel;
     }
 
-    public void setServerSocketChannel(ServerSocketChannel serverChannel) {
+    public void setServerSocketChannel(final ServerSocketChannel serverChannel) {
         this.serverChannel = serverChannel;
     }
 
@@ -157,7 +159,7 @@ public class NioTcpServer extends Abstra
     /**
      * @param acceptKey the acceptKey to set
      */
-    public void setAcceptKey(SelectionKey acceptKey) {
+    public void setAcceptKey(final SelectionKey acceptKey) {
         this.acceptKey = acceptKey;
     }
 
@@ -165,7 +167,7 @@ public class NioTcpServer extends Abstra
      * {@inheritDoc}
      */
     @Override
-    public void ready(boolean accept, boolean read, ByteBuffer readBuffer, boolean write) {
+    public void ready(final boolean accept, final boolean read, final ByteBuffer readBuffer, final boolean write) {
         if (accept) {
             LOG.debug("acceptable new client");
 
@@ -174,7 +176,7 @@ public class NioTcpServer extends Abstra
                 LOG.debug("new client accepted");
                 createSession(getServerSocketChannel().accept());
 
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 LOG.error("error while accepting new client", e);
             }
         }
@@ -198,49 +200,49 @@ public class NioTcpServer extends Abstra
                 config.getIdleTimeInMillis(IdleStatus.WRITE_IDLE));
 
         // apply the default service socket configuration
-        Boolean keepAlive = config.isKeepAlive();
+        final Boolean keepAlive = config.isKeepAlive();
 
         if (keepAlive != null) {
             session.getConfig().setKeepAlive(keepAlive);
         }
 
-        Boolean oobInline = config.isOobInline();
+        final Boolean oobInline = config.isOobInline();
 
         if (oobInline != null) {
             session.getConfig().setOobInline(oobInline);
         }
 
-        Boolean reuseAddress = config.isReuseAddress();
+        final Boolean reuseAddress = config.isReuseAddress();
 
         if (reuseAddress != null) {
             session.getConfig().setReuseAddress(reuseAddress);
         }
 
-        Boolean tcpNoDelay = config.isTcpNoDelay();
+        final Boolean tcpNoDelay = config.isTcpNoDelay();
 
         if (tcpNoDelay != null) {
             session.getConfig().setTcpNoDelay(tcpNoDelay);
         }
 
-        Integer receiveBufferSize = config.getReceiveBufferSize();
+        final Integer receiveBufferSize = config.getReceiveBufferSize();
 
         if (receiveBufferSize != null) {
             session.getConfig().setReceiveBufferSize(receiveBufferSize);
         }
 
-        Integer sendBufferSize = config.getSendBufferSize();
+        final Integer sendBufferSize = config.getSendBufferSize();
 
         if (sendBufferSize != null) {
             session.getConfig().setSendBufferSize(sendBufferSize);
         }
 
-        Integer trafficClass = config.getTrafficClass();
+        final Integer trafficClass = config.getTrafficClass();
 
         if (trafficClass != null) {
             session.getConfig().setTrafficClass(trafficClass);
         }
 
-        Integer soLinger = config.getSoLinger();
+        final Integer soLinger = config.getSoLinger();
 
         if (soLinger != null) {
             session.getConfig().setSoLinger(soLinger);
@@ -251,9 +253,6 @@ public class NioTcpServer extends Abstra
             session.initSecure(config.getSslContext());
         }
 
-        // event session created
-        session.processSessionCreated();
-
         // add the session to the queue for being added to the selector
         readWriteSelectorLoop.register(false, true, false, session, socketChannel);
         readWriteSelectorLoop.incrementServiceCount();

Modified: mina/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java (original)
+++ mina/mina/trunk/core/src/test/java/org/apache/mina/session/AbstractIoSessionTest.java Tue Nov  6 14:33:01 2012
@@ -18,9 +18,16 @@
  */
 package org.apache.mina.session;
 
-import static junit.framework.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
@@ -45,12 +52,12 @@ import org.junit.Test;
 public class AbstractIoSessionTest {
 
     private class DummySession extends AbstractIoSession {
-        private DummySession(IoService service) {
+        private DummySession(final IoService service) {
             super(service, null);
         }
 
         @Override
-        public IoFuture<Void> close(boolean immediately) {
+        public IoFuture<Void> close(final boolean immediately) {
             return null;
         }
 
@@ -155,18 +162,18 @@ public class AbstractIoSessionTest {
 
     @Test
     public void testCreationTime() {
-        long before = System.currentTimeMillis();
-        long creation = (new DummySession(service)).getCreationTime();
-        long after = System.currentTimeMillis();
+        final long before = System.currentTimeMillis();
+        final long creation = (new DummySession(service)).getCreationTime();
+        final long after = System.currentTimeMillis();
         Assert.assertTrue(creation <= after);
         Assert.assertTrue(creation >= before);
     }
 
     @Test
     public void testAttachment() {
-        AbstractIoSession aio = new DummySession(service);
-        String value = "value";
-        AttributeKey<String> key = new AttributeKey<String>(String.class, "test");
+        final AbstractIoSession aio = new DummySession(service);
+        final String value = "value";
+        final AttributeKey<String> key = new AttributeKey<String>(String.class, "test");
         assertNull(aio.getAttribute(key, null));
         assertEquals(null, aio.setAttribute(key, value));
 
@@ -183,23 +190,23 @@ public class AbstractIoSessionTest {
 
     @Test
     public void chain_reads() {
-        DummySession session = new DummySession(service);
-        ByteBuffer buffer = ByteBuffer.allocate(1024);
+        final DummySession session = new DummySession(service);
+        final ByteBuffer buffer = ByteBuffer.allocate(1024);
 
-        long before = System.currentTimeMillis();
+        final long before = System.currentTimeMillis();
         session.processMessageReceived(buffer);
         verify(filter1).messageReceived(eq(session), eq(buffer), any(ReadFilterChainController.class));
         verify(filter2).messageReceived(eq(session), eq(buffer), any(ReadFilterChainController.class));
         verify(filter3).messageReceived(eq(session), eq(buffer), any(ReadFilterChainController.class));
         assertEquals(1024L, session.getReadBytes());
-        long lastRead = session.getLastReadTime();
+        final long lastRead = session.getLastReadTime();
         assertTrue(lastRead - before < 100);
     }
 
     @Test
     public void chain_writes() {
-        DummySession session = new DummySession(service);
-        ByteBuffer buffer = mock(ByteBuffer.class);
+        final DummySession session = new DummySession(service);
+        final ByteBuffer buffer = mock(ByteBuffer.class);
         session.processMessageWriting(buffer, null);
         verify(filter1).messageWriting(eq(session), eq(buffer), any(WriteFilterChainController.class));
         verify(filter2).messageWriting(eq(session), eq(buffer), any(WriteFilterChainController.class));
@@ -207,17 +214,8 @@ public class AbstractIoSessionTest {
     }
 
     @Test
-    public void chain_created() {
-        DummySession session = new DummySession(service);
-        session.processSessionCreated();
-        verify(filter1).sessionCreated(eq(session));
-        verify(filter2).sessionCreated(eq(session));
-        verify(filter3).sessionCreated(eq(session));
-    }
-
-    @Test
     public void chain_open() {
-        DummySession session = new DummySession(service);
+        final DummySession session = new DummySession(service);
         session.processSessionOpened();
         verify(filter1).sessionOpened(eq(session));
         verify(filter2).sessionOpened(eq(session));
@@ -226,7 +224,7 @@ public class AbstractIoSessionTest {
 
     @Test
     public void chain_close() {
-        DummySession session = new DummySession(service);
+        final DummySession session = new DummySession(service);
         session.processSessionClosed();
         verify(filter1).sessionClosed(eq(session));
         verify(filter2).sessionClosed(eq(session));
@@ -235,7 +233,7 @@ public class AbstractIoSessionTest {
 
     @Test
     public void increment_written_bytes() {
-        DummySession session = new DummySession(service);
+        final DummySession session = new DummySession(service);
         assertEquals(0, session.getWrittenBytes());
         session.incrementWrittenBytes(1024);
         assertEquals(1024, session.getWrittenBytes());

Modified: mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/echoserver/NioEchoServer.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/echoserver/NioEchoServer.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/echoserver/NioEchoServer.java (original)
+++ mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/echoserver/NioEchoServer.java Tue Nov  6 14:33:01 2012
@@ -33,7 +33,6 @@ import org.apache.mina.api.IoSession;
 import org.apache.mina.filter.logging.LoggingFilter;
 import org.apache.mina.filterchain.ReadFilterChainController;
 import org.apache.mina.filterchain.WriteFilterChainController;
-import org.apache.mina.transport.nio.NioSelectorLoop;
 import org.apache.mina.transport.nio.NioTcpServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,42 +47,39 @@ public class NioEchoServer {
 
     static final private Logger LOG = LoggerFactory.getLogger(NioEchoServer.class);
 
-    public static void main(String[] args) {
+    public static void main(final String[] args) {
         LOG.info("starting echo server");
 
-        NioTcpServer acceptor = new NioTcpServer();
+        final NioTcpServer acceptor = new NioTcpServer();
 
         // create the fitler chain for this service
         acceptor.setFilters(new LoggingFilter("LoggingFilter1"), new IoFilter() {
 
             @Override
-            public void sessionOpened(IoSession session) {
+            public void sessionOpened(final IoSession session) {
                 LOG.info("session {} open", session);
             }
 
             @Override
-            public void sessionIdle(IoSession session, IdleStatus status) {
+            public void sessionIdle(final IoSession session, final IdleStatus status) {
                 LOG.info("session {} idle", session);
             }
 
             @Override
-            public void sessionCreated(IoSession session) {
-                LOG.info("session {} created", session);
-            }
-
-            @Override
-            public void sessionClosed(IoSession session) {
+            public void sessionClosed(final IoSession session) {
                 LOG.info("session {} open", session);
             }
 
             @Override
-            public void messageWriting(IoSession session, Object message, WriteFilterChainController controller) {
+            public void messageWriting(final IoSession session, final Object message,
+                    final WriteFilterChainController controller) {
                 // we just push the message in the chain
                 controller.callWriteNextFilter(message);
             }
 
             @Override
-            public void messageReceived(IoSession session, Object message, ReadFilterChainController controller) {
+            public void messageReceived(final IoSession session, final Object message,
+                    final ReadFilterChainController controller) {
 
                 if (message instanceof ByteBuffer) {
                     LOG.info("echoing");
@@ -95,43 +91,43 @@ public class NioEchoServer {
         acceptor.addListeners(new IoServiceListener() {
 
             @Override
-            public void sessionDestroyed(IoSession session) {
+            public void sessionDestroyed(final IoSession session) {
                 LOG.info("session destroyed {}", session);
 
             }
 
             @Override
-            public void sessionCreated(IoSession session) {
+            public void sessionCreated(final IoSession session) {
                 LOG.info("session created {}", session);
 
-                String welcomeStr = "welcome\n";
-                ByteBuffer bf = ByteBuffer.allocate(welcomeStr.length());
+                final String welcomeStr = "welcome\n";
+                final ByteBuffer bf = ByteBuffer.allocate(welcomeStr.length());
                 bf.put(welcomeStr.getBytes());
                 bf.flip();
                 session.write(bf);
             }
 
             @Override
-            public void serviceInactivated(IoService service) {
+            public void serviceInactivated(final IoService service) {
                 LOG.info("service deactivated {}", service);
             }
 
             @Override
-            public void serviceActivated(IoService service) {
+            public void serviceActivated(final IoService service) {
                 LOG.info("service activated {}", service);
             }
         });
 
         try {
-            SocketAddress address = new InetSocketAddress(9999);
+            final SocketAddress address = new InetSocketAddress(9999);
             acceptor.bind(address);
             LOG.debug("Running the server for 25 sec");
             Thread.sleep(25000);
             LOG.debug("Unbinding the TCP port");
             acceptor.unbind();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             LOG.error("I/O exception", e);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
             LOG.error("Interrupted exception", e);
         }
     }

Modified: mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/udpecho/NioUdpEchoServer.java
URL: http://svn.apache.org/viewvc/mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/udpecho/NioUdpEchoServer.java?rev=1406147&r1=1406146&r2=1406147&view=diff
==============================================================================
--- mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/udpecho/NioUdpEchoServer.java (original)
+++ mina/mina/trunk/examples/src/main/java/org/apache/mina/examples/udpecho/NioUdpEchoServer.java Tue Nov  6 14:33:01 2012
@@ -45,42 +45,39 @@ import org.slf4j.LoggerFactory;
 public class NioUdpEchoServer {
     static final Logger LOG = LoggerFactory.getLogger(NioUdpEchoServer.class);
 
-    public static void main(String[] args) {
+    public static void main(final String[] args) {
         LOG.info("starting echo server");
 
-        NioUdpServer server = new NioUdpServer(new NioSelectorLoop());
+        final NioUdpServer server = new NioUdpServer(new NioSelectorLoop());
 
         // create the fitler chain for this service
         server.setFilters(new LoggingFilter("LoggingFilter1"), new IoFilter() {
 
             @Override
-            public void sessionOpened(IoSession session) {
+            public void sessionOpened(final IoSession session) {
                 LOG.info("session {} open", session);
             }
 
             @Override
-            public void sessionIdle(IoSession session, IdleStatus status) {
+            public void sessionIdle(final IoSession session, final IdleStatus status) {
                 LOG.info("session {} idle", session);
             }
 
             @Override
-            public void sessionCreated(IoSession session) {
-                LOG.info("session {} created", session);
-            }
-
-            @Override
-            public void sessionClosed(IoSession session) {
+            public void sessionClosed(final IoSession session) {
                 LOG.info("session {} open", session);
             }
 
             @Override
-            public void messageWriting(IoSession session, Object message, WriteFilterChainController controller) {
+            public void messageWriting(final IoSession session, final Object message,
+                    final WriteFilterChainController controller) {
                 // we just push the message in the chain
                 controller.callWriteNextFilter(message);
             }
 
             @Override
-            public void messageReceived(IoSession session, Object message, ReadFilterChainController controller) {
+            public void messageReceived(final IoSession session, final Object message,
+                    final ReadFilterChainController controller) {
 
                 if (message instanceof ByteBuffer) {
                     LOG.info("echoing");
@@ -92,43 +89,43 @@ public class NioUdpEchoServer {
         server.addListeners(new IoServiceListener() {
 
             @Override
-            public void sessionDestroyed(IoSession session) {
+            public void sessionDestroyed(final IoSession session) {
                 LOG.info("session destroyed {}", session);
 
             }
 
             @Override
-            public void sessionCreated(IoSession session) {
+            public void sessionCreated(final IoSession session) {
                 LOG.info("session created {}", session);
 
-                String welcomeStr = "welcome\n";
-                ByteBuffer bf = ByteBuffer.allocate(welcomeStr.length());
+                final String welcomeStr = "welcome\n";
+                final ByteBuffer bf = ByteBuffer.allocate(welcomeStr.length());
                 bf.put(welcomeStr.getBytes());
                 bf.flip();
                 session.write(bf);
             }
 
             @Override
-            public void serviceInactivated(IoService service) {
+            public void serviceInactivated(final IoService service) {
                 LOG.info("service deactivated {}", service);
             }
 
             @Override
-            public void serviceActivated(IoService service) {
+            public void serviceActivated(final IoService service) {
                 LOG.info("service activated {}", service);
             }
         });
 
         try {
-            SocketAddress address = new InetSocketAddress(9999);
+            final SocketAddress address = new InetSocketAddress(9999);
             server.bind(address);
             LOG.debug("Running the server for 25 sec");
             Thread.sleep(25000);
             LOG.debug("Unbinding the UDP port");
             server.unbind();
-        } catch (IOException e) {
+        } catch (final IOException e) {
             LOG.error("I/O exception", e);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
             LOG.error("Interrupted exception", e);
         }
     }