Author: elecharny
Date: Wed Oct  6 09:28:48 2010
New Revision: 1004937

URL: http://svn.apache.org/viewvc?rev=1004937&view=rev
Log:
o Fixed some Javadoc
o Moved some common fields to the top level class when they were shared among 
many child classes

Modified:
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/service/IoHandlerAdapter.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/DummySession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/IoSession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramSession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java
    
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java
    
mina/branches/2.0.1/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java
    
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java
    
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
    
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java
    
mina/branches/2.0.1/mina-transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/service/IoHandlerAdapter.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/service/IoHandlerAdapter.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/service/IoHandlerAdapter.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/service/IoHandlerAdapter.java
 Wed Oct  6 09:28:48 2010
@@ -26,13 +26,14 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * An abstract adapter class for {...@link IoHandler}.  You can extend this
+ * An adapter class for {...@link IoHandler}.  You can extend this
  * class and selectively override required event handler methods only.  All
  * methods do nothing by default.
  *
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
-public class IoHandlerAdapter implements IoHandler {
+public class IoHandlerAdapter implements IoHandler
+{
     private static final Logger LOGGER = 
LoggerFactory.getLogger(IoHandlerAdapter.class);
 
     public void sessionCreated(IoSession session) throws Exception {

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/AbstractIoSession.java
 Wed Oct  6 09:28:48 2010
@@ -45,6 +45,7 @@ import org.apache.mina.core.future.ReadF
 import org.apache.mina.core.future.WriteFuture;
 import org.apache.mina.core.service.AbstractIoService;
 import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoProcessor;
 import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.service.TransportMetadata;
@@ -63,6 +64,14 @@ import org.apache.mina.util.ExceptionMon
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 public abstract class AbstractIoSession implements IoSession {
+    /** The associated handler */
+    private final IoHandler handler;
+
+    /** The session config */
+    protected IoSessionConfig config;
+
+    /** The service which will manage this session */
+    private final IoService service;
 
     private static final AttributeKey READY_READ_FUTURES_KEY =
         new AttributeKey(AbstractIoSession.class, "readyReadFutures");
@@ -96,7 +105,7 @@ public abstract class AbstractIoSession 
     private WriteRequestQueue writeRequestQueue;
     private WriteRequest currentWriteRequest;
     
-    // The Session creation's time */
+    /** The Session creation's time */
     private final long creationTime;
 
     /** An id generator guaranteed to generate unique IDs for the session */
@@ -151,7 +160,11 @@ public abstract class AbstractIoSession 
     /**
      * TODO Add method documentation
      */
-    protected AbstractIoSession() {
+    protected AbstractIoSession( IoService service )
+    {
+        this.service = service;
+        this.handler = service.getHandler();
+
         // Initialize all the Session counters to the current time 
         long currentTime = System.currentTimeMillis();
         creationTime = currentTime;
@@ -282,6 +295,24 @@ public abstract class AbstractIoSession 
     /**
      * {...@inheritdoc}
      */
+    public IoHandler getHandler()
+    {
+        return handler;
+    }
+
+
+    /**
+     * {...@inheritdoc}
+     */
+    public IoSessionConfig getConfig()
+    {
+        return config;
+    }
+
+
+    /**
+     * {...@inheritdoc}
+     */
     public final ReadFuture read() {
         if (!getConfig().isUseReadOperation()) {
             throw new IllegalStateException("useReadOperation is not 
enabled.");
@@ -1203,6 +1234,16 @@ public abstract class AbstractIoSession 
         return tm.getProviderName() + ' ' + tm.getName();
     }
 
+
+    /**
+     * {...@inheritdoc}
+     */
+    public IoService getService()
+    {
+        return service;
+    }
+
+
     /**
      * Fires a {...@link IoEventType#SESSION_IDLE} event to any applicable
      * sessions in the specified collection.

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/DummySession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/DummySession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/DummySession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/DummySession.java
 Wed Oct  6 09:28:48 2010
@@ -31,7 +31,6 @@ import org.apache.mina.core.filterchain.
 import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.service.AbstractIoAcceptor;
 import org.apache.mina.core.service.DefaultTransportMetadata;
-import org.apache.mina.core.service.IoAcceptor;
 import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoHandlerAdapter;
 import org.apache.mina.core.service.IoProcessor;
@@ -88,8 +87,10 @@ public class DummySession extends Abstra
      * Creates a new instance.
      */
     public DummySession() {
+        super(
+
         // Initialize dummy service.
-        IoAcceptor acceptor = new AbstractIoAcceptor(
+            new AbstractIoAcceptor(
                 new AbstractIoSessionConfig() {
                     @Override
                     protected void doSetAll(IoSessionConfig config) {
@@ -123,12 +124,7 @@ public class DummySession extends Abstra
             @Override
             protected void dispose0() throws Exception {
             }
-        };
-
-        // Set meaningless default values.
-        acceptor.setHandler(new IoHandlerAdapter());
-
-        service = acceptor;
+            } );
 
         processor = new IoProcessor<AbstractIoSession>() {
             public void add(AbstractIoSession session) {

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/IoSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/IoSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/IoSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/core/session/IoSession.java
 Wed Oct  6 09:28:48 2010
@@ -75,17 +75,17 @@ public interface IoSession {
      * respected. It uses the HashCode() method which don't guarantee the key
      * unicity.
      */
-    long getId();
+    long getId(); // DONE
 
     /**
      * @return the {...@link IoService} which provides I/O service to this 
session.
      */
-    IoService getService();
+    IoService getService(); // DONE
 
     /**
      * @return the {...@link IoHandler} which handles this session.
      */
-    IoHandler getHandler();
+    IoHandler getHandler(); // DONE
 
     /**
      * @return the configuration of this session.
@@ -170,7 +170,7 @@ public interface IoSession {
      *                    {...@code false} to close this session after all 
queued
      *                    write requests are flushed (i.e. {...@link 
#closeOnFlush()}).
      */
-    CloseFuture close(boolean immediately);
+    CloseFuture close( boolean immediately ); // DONE
     
     /**
      * Closes this session after all queued write requests
@@ -324,13 +324,13 @@ public interface IoSession {
     /**
      * Returns <code>true</code> if this session is connected with remote peer.
      */
-    boolean isConnected();
+    boolean isConnected(); // DONE
 
     /**
      * Returns <code>true</tt> if and only if this session is being closed
      * (but not disconnected yet) or is closed.
      */
-    boolean isClosing();
+    boolean isClosing(); // DONE
 
     /**
      * Returns the {...@link CloseFuture} of this session.  This method returns
@@ -341,13 +341,13 @@ public interface IoSession {
     /**
      * Returns the socket address of remote peer.
      */
-    SocketAddress getRemoteAddress();
+    SocketAddress getRemoteAddress(); // DONE
 
     /**
      * Returns the socket address of local machine which is associated with 
this
      * session.
      */
-    SocketAddress getLocalAddress();
+    SocketAddress getLocalAddress(); // DONE
 
     /**
      * Returns the socket address of the {...@link IoService} listens to to 
manage

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioDatagramSession.java
 Wed Oct  6 09:28:48 2010
@@ -22,13 +22,9 @@ package org.apache.mina.transport.socket
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.nio.channels.DatagramChannel;
-import java.nio.channels.SelectionKey;
 
 import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.mina.core.filterchain.DefaultIoFilterChain;
-import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.service.DefaultTransportMetadata;
-import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoProcessor;
 import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.service.TransportMetadata;
@@ -41,75 +37,50 @@ import org.apache.mina.transport.socket.
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 class NioDatagramSession extends NioSession {
-
     static final TransportMetadata METADATA =
             new DefaultTransportMetadata(
                     "nio", "datagram", true, false,
                     InetSocketAddress.class,
                     DatagramSessionConfig.class, IoBuffer.class);
 
-    private final IoService service;
-    private final DatagramSessionConfig config;
-    private final IoFilterChain filterChain = new DefaultIoFilterChain(this);
-    private final DatagramChannel ch;
-    private final IoHandler handler;
+    //private final IoFilterChain filterChain = new DefaultIoFilterChain(this);
     private final InetSocketAddress localAddress;
     private final InetSocketAddress remoteAddress;
 
-    private SelectionKey key;
-
     /**
      * Creates a new acceptor-side session instance.
      */
     NioDatagramSession(IoService service,
-                        DatagramChannel ch, IoProcessor<NioSession> processor,
+                        DatagramChannel channel, IoProcessor<NioSession> 
processor,
                         SocketAddress remoteAddress) {
-        super(processor);
-        this.service = service;
-        this.ch = ch;
-        this.config = new NioDatagramSessionConfig(ch);
-        this.config.setAll(service.getSessionConfig());
-        this.handler = service.getHandler();
+        super( processor, service, channel );
+        config = new NioDatagramSessionConfig( channel );
+        config.setAll( service.getSessionConfig() );
         this.remoteAddress = (InetSocketAddress) remoteAddress;
-        this.localAddress = (InetSocketAddress) 
ch.socket().getLocalSocketAddress();
+        this.localAddress = ( InetSocketAddress ) 
channel.socket().getLocalSocketAddress();
     }
 
     /**
      * Creates a new connector-side session instance.
      */
-    NioDatagramSession(IoService service, DatagramChannel ch, 
IoProcessor<NioSession> processor) {
-        this(service, ch, processor, ch.socket().getRemoteSocketAddress());
+    NioDatagramSession( IoService service, DatagramChannel channel, 
IoProcessor<NioSession> processor )
+    {
+        this( service, channel, processor, 
channel.socket().getRemoteSocketAddress() );
     }
 
-    public IoService getService() {
-        return service;
-    }
 
-    public DatagramSessionConfig getConfig() {
-        return config;
+    /**
+     * {...@inheritdoc}
+     */
+    public DatagramSessionConfig getConfig()
+    {
+        return ( DatagramSessionConfig ) config;
     }
 
-    public IoFilterChain getFilterChain() {
-        return filterChain;
-    }
 
     @Override
     DatagramChannel getChannel() {
-        return ch;
-    }
-
-    @Override
-    SelectionKey getSelectionKey() {
-        return key;
-    }
-
-    @Override
-    void setSelectionKey(SelectionKey key) {
-        this.key = key;
-    }
-
-    public IoHandler getHandler() {
-        return handler;
+        return ( DatagramChannel ) channel;
     }
 
     public TransportMetadata getTransportMetadata() {

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSession.java
 Wed Oct  6 09:28:48 2010
@@ -20,9 +20,13 @@
 package org.apache.mina.transport.socket.nio;
 
 import java.nio.channels.ByteChannel;
+import java.nio.channels.Channel;
 import java.nio.channels.SelectionKey;
 
+import org.apache.mina.core.filterchain.DefaultIoFilterChain;
+import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.service.IoProcessor;
+import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.session.AbstractIoSession;
 import org.apache.mina.core.session.IoSession;
 
@@ -34,8 +38,16 @@ import org.apache.mina.core.session.IoSe
 public abstract class NioSession extends AbstractIoSession {
     /** The NioSession processor */
     protected final IoProcessor<NioSession> processor;
-    
-    
+
+    /** The communication channel */
+    protected final Channel channel;
+
+    /** The SelectionKey used for this session */
+    protected SelectionKey key;
+
+    /** The FilterChain created for this session */
+    private final IoFilterChain filterChain;
+
     /**
      * 
      * Creates a new instance of NioSession, with its associated IoProcessor.
@@ -44,8 +56,12 @@ public abstract class NioSession extends
      *
      * @param processor The associated IoProcessor
      */
-    protected  NioSession(IoProcessor<NioSession> processor) {
+    protected NioSession( IoProcessor<NioSession> processor, IoService 
service, Channel channel )
+    {
+        super( service );
+        this.channel = channel;
         this.processor = processor;
+        filterChain = new DefaultIoFilterChain( this );
     }
 
     /**
@@ -53,17 +69,32 @@ public abstract class NioSession extends
      */
     abstract ByteChannel getChannel();
     
+
+    public IoFilterChain getFilterChain()
+    {
+        return filterChain;
+    }
+
+
     /**
      * @return The {...@link SelectionKey} associated with this {...@link 
IoSession}
      */
-    abstract SelectionKey getSelectionKey();
+    /* No qualifier*/SelectionKey getSelectionKey()
+    {
+        return key;
+    }
+
     
     /**
      * Sets the {...@link SelectionKey} for this {...@link IoSession}
      *
      * @param key The new {...@link SelectionKey}
      */
-    abstract void setSelectionKey(SelectionKey key);
+    /* No qualifier*/void setSelectionKey( SelectionKey key )
+    {
+        this.key = key;
+    }
+
 
     /**
      * {...@inheritdoc}

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/socket/nio/NioSocketSession.java
 Wed Oct  6 09:28:48 2010
@@ -22,16 +22,12 @@ package org.apache.mina.transport.socket
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketException;
-import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 
 import org.apache.mina.core.RuntimeIoException;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.file.FileRegion;
-import org.apache.mina.core.filterchain.DefaultIoFilterChain;
-import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.service.DefaultTransportMetadata;
-import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoProcessor;
 import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.service.TransportMetadata;
@@ -45,7 +41,6 @@ import org.apache.mina.transport.socket.
  * @author <a href="http://mina.apache.org";>Apache MINA Project</a>
  */
 class NioSocketSession extends NioSession {
-
     static final TransportMetadata METADATA =
             new DefaultTransportMetadata(
                     "nio", "socket", false, true,
@@ -53,18 +48,10 @@ class NioSocketSession extends NioSessio
                     SocketSessionConfig.class,
                     IoBuffer.class, FileRegion.class);
 
-    private final IoService service;
-
-    private final SocketSessionConfig config = new SessionConfigImpl();
-
-    private final IoFilterChain filterChain = new DefaultIoFilterChain(this);
-
-    private final SocketChannel ch;
-
-    private final IoHandler handler;
-
-    private SelectionKey key;
-
+    private Socket getSocket()
+    {
+        return ( ( SocketChannel ) channel ).socket();
+    }
     
     /**
      * 
@@ -74,58 +61,42 @@ class NioSocketSession extends NioSessio
      * @param processor the associated IoProcessor
      * @param ch the used channel
      */
-    public NioSocketSession(IoService service, IoProcessor<NioSession> 
processor, SocketChannel ch) {
-        super(processor);
-        this.service = service;
-        this.ch = ch;
-        this.handler = service.getHandler();
+    public NioSocketSession( IoService service, IoProcessor<NioSession> 
processor, SocketChannel channel )
+    {
+        super( processor, service, channel );
+        config = new SessionConfigImpl();
         this.config.setAll(service.getSessionConfig());
     }
 
-    public IoService getService() {
-        return service;
-    }
-
-    public SocketSessionConfig getConfig() {
-        return config;
-    }
-
-    public IoFilterChain getFilterChain() {
-        return filterChain;
-    }
-
     public TransportMetadata getTransportMetadata() {
         return METADATA;
     }
 
-    @Override
-    SocketChannel getChannel() {
-        return ch;
-    }
 
-    @Override
-    SelectionKey getSelectionKey() {
-        return key;
+    /**
+     * {...@inheritdoc}
+     */
+    public SocketSessionConfig getConfig()
+    {
+        return ( SocketSessionConfig ) config;
     }
 
-    @Override
-    void setSelectionKey(SelectionKey key) {
-        this.key = key;
-    }
 
-    public IoHandler getHandler() {
-        return handler;
+    @Override
+    SocketChannel getChannel() {
+        return ( SocketChannel ) channel;
     }
 
     /**
      * {...@inheritdoc}
      */
     public InetSocketAddress getRemoteAddress() {
-        if ( ch == null ) {
+        if ( channel == null )
+        {
             return null;
         }
         
-        Socket socket = ch.socket();
+        Socket socket = getSocket();
         
         if ( socket == null ) {
             return null;
@@ -138,11 +109,12 @@ class NioSocketSession extends NioSessio
      * {...@inheritdoc}
      */
     public InetSocketAddress getLocalAddress() {
-        if ( ch == null ) {
+        if ( channel == null )
+        {
             return null;
         }
         
-        Socket socket = ch.socket();
+        Socket socket = getSocket();
         
         if ( socket == null ) {
             return null;
@@ -159,7 +131,7 @@ class NioSocketSession extends NioSessio
     private class SessionConfigImpl extends AbstractSocketSessionConfig {
         public boolean isKeepAlive() {
             try {
-                return ch.socket().getKeepAlive();
+                return getSocket().getKeepAlive();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -167,7 +139,7 @@ class NioSocketSession extends NioSessio
 
         public void setKeepAlive(boolean on) {
             try {
-                ch.socket().setKeepAlive(on);
+                getSocket().setKeepAlive( on );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -175,7 +147,7 @@ class NioSocketSession extends NioSessio
 
         public boolean isOobInline() {
             try {
-                return ch.socket().getOOBInline();
+                return getSocket().getOOBInline();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -183,7 +155,7 @@ class NioSocketSession extends NioSessio
 
         public void setOobInline(boolean on) {
             try {
-                ch.socket().setOOBInline(on);
+                getSocket().setOOBInline( on );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -191,7 +163,7 @@ class NioSocketSession extends NioSessio
 
         public boolean isReuseAddress() {
             try {
-                return ch.socket().getReuseAddress();
+                return getSocket().getReuseAddress();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -199,7 +171,7 @@ class NioSocketSession extends NioSessio
 
         public void setReuseAddress(boolean on) {
             try {
-                ch.socket().setReuseAddress(on);
+                getSocket().setReuseAddress( on );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -207,7 +179,7 @@ class NioSocketSession extends NioSessio
 
         public int getSoLinger() {
             try {
-                return ch.socket().getSoLinger();
+                return getSocket().getSoLinger();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -216,9 +188,9 @@ class NioSocketSession extends NioSessio
         public void setSoLinger(int linger) {
             try {
                 if (linger < 0) {
-                    ch.socket().setSoLinger(false, 0);
+                    getSocket().setSoLinger( false, 0 );
                 } else {
-                    ch.socket().setSoLinger(true, linger);
+                    getSocket().setSoLinger( true, linger );
                 }
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
@@ -231,7 +203,7 @@ class NioSocketSession extends NioSessio
             }
 
             try {
-                return ch.socket().getTcpNoDelay();
+                return getSocket().getTcpNoDelay();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -239,7 +211,7 @@ class NioSocketSession extends NioSessio
 
         public void setTcpNoDelay(boolean on) {
             try {
-                ch.socket().setTcpNoDelay(on);
+                getSocket().setTcpNoDelay( on );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -250,7 +222,7 @@ class NioSocketSession extends NioSessio
          */
         public int getTrafficClass() {
             try {
-                return ch.socket().getTrafficClass();
+                return getSocket().getTrafficClass();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -261,7 +233,7 @@ class NioSocketSession extends NioSessio
          */
         public void setTrafficClass(int tc) {
             try {
-                ch.socket().setTrafficClass(tc);
+                getSocket().setTrafficClass( tc );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -269,7 +241,7 @@ class NioSocketSession extends NioSessio
 
         public int getSendBufferSize() {
             try {
-                return ch.socket().getSendBufferSize();
+                return getSocket().getSendBufferSize();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -277,7 +249,7 @@ class NioSocketSession extends NioSessio
 
         public void setSendBufferSize(int size) {
             try {
-                ch.socket().setSendBufferSize(size);
+                getSocket().setSendBufferSize( size );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -285,7 +257,7 @@ class NioSocketSession extends NioSessio
 
         public int getReceiveBufferSize() {
             try {
-                return ch.socket().getReceiveBufferSize();
+                return getSocket().getReceiveBufferSize();
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }
@@ -293,7 +265,7 @@ class NioSocketSession extends NioSessio
 
         public void setReceiveBufferSize(int size) {
             try {
-                ch.socket().setReceiveBufferSize(size);
+                getSocket().setReceiveBufferSize( size );
             } catch (SocketException e) {
                 throw new RuntimeIoException(e);
             }

Modified: 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-core/src/main/java/org/apache/mina/transport/vmpipe/VmPipeSession.java
 Wed Oct  6 09:28:48 2010
@@ -49,10 +49,6 @@ class VmPipeSession extends AbstractIoSe
                     VmPipeSessionConfig.class,
                     Object.class);
 
-    private static final VmPipeSessionConfig CONFIG = new 
DefaultVmPipeSessionConfig();
-
-    private final IoService service;
-
     private final IoServiceListenerSupport serviceListeners;
 
     private final VmPipeAddress localAddress;
@@ -61,8 +57,6 @@ class VmPipeSession extends AbstractIoSe
 
     private final VmPipeAddress serviceAddress;
 
-    private final IoHandler handler;
-
     private final VmPipeFilterChain filterChain;
 
     private final VmPipeSession remoteSession;
@@ -77,12 +71,12 @@ class VmPipeSession extends AbstractIoSe
     VmPipeSession(IoService service,
                       IoServiceListenerSupport serviceListeners,
                       VmPipeAddress localAddress, IoHandler handler, VmPipe 
remoteEntry) {
-        this.service = service;
+        super( service );
+        config = new DefaultVmPipeSessionConfig();
         this.serviceListeners = serviceListeners;
         lock = new ReentrantLock();
         this.localAddress = localAddress;
         remoteAddress = serviceAddress = remoteEntry.getAddress();
-        this.handler = handler;
         filterChain = new VmPipeFilterChain(this);
         receivedMessageQueue = new LinkedBlockingQueue<Object>();
 
@@ -93,21 +87,17 @@ class VmPipeSession extends AbstractIoSe
      * Constructor for server-side session.
      */
     private VmPipeSession(VmPipeSession remoteSession, VmPipe entry) {
-        service = entry.getAcceptor();
+        super( entry.getAcceptor() );
+        config = new DefaultVmPipeSessionConfig();
         serviceListeners = entry.getListeners();
         lock = remoteSession.lock;
         localAddress = serviceAddress = remoteSession.remoteAddress;
         remoteAddress = remoteSession.localAddress;
-        handler = entry.getHandler();
         filterChain = new VmPipeFilterChain(this);
         this.remoteSession = remoteSession;
         receivedMessageQueue = new LinkedBlockingQueue<Object>();
     }
 
-    public IoService getService() {
-        return service;
-    }
-
     @Override
     public IoProcessor<VmPipeSession> getProcessor() {
         return filterChain.getProcessor();
@@ -118,7 +108,7 @@ class VmPipeSession extends AbstractIoSe
     }
 
     public VmPipeSessionConfig getConfig() {
-        return CONFIG;
+        return ( VmPipeSessionConfig ) config;
     }
 
     public IoFilterChain getFilterChain() {
@@ -129,10 +119,6 @@ class VmPipeSession extends AbstractIoSe
         return remoteSession;
     }
 
-    public IoHandler getHandler() {
-        return handler;
-    }
-
     public TransportMetadata getTransportMetadata() {
         return METADATA;
     }

Modified: 
mina/branches/2.0.1/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java
 (original)
+++ 
mina/branches/2.0.1/mina-integration-jmx/src/main/java/org/apache/mina/integration/jmx/ObjectMBean.java
 Wed Oct  6 09:28:48 2010
@@ -742,7 +742,7 @@ public class ObjectMBean<T> implements M
                 if (time <= 0) {
                     return null;
                 }
-                System.out.println("Converted to date");
+
                 return new Date((Long) v);
             }
         }

Modified: 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprDatagramSession.java
 Wed Oct  6 09:28:48 2010
@@ -46,8 +46,6 @@ class AprDatagramSession extends AprSess
                 InetSocketAddress.class,
                 DatagramSessionConfig.class, IoBuffer.class);
 
-    private final DatagramSessionConfig config = new SessionConfigImpl();
-
     /**
      * Create an instance of {...@link AprDatagramSession}. 
      * 
@@ -57,6 +55,7 @@ class AprDatagramSession extends AprSess
             IoService service, IoProcessor<AprSession> processor,
             long descriptor, InetSocketAddress remoteAddress) throws Exception 
{
         super(service, processor, descriptor, remoteAddress);
+        config = new SessionConfigImpl();
         this.config.setAll(service.getSessionConfig());
     }
 
@@ -64,7 +63,7 @@ class AprDatagramSession extends AprSess
      * {...@inheritdoc}
      */
     public DatagramSessionConfig getConfig() {
-        return config;
+        return ( DatagramSessionConfig ) config;
     }
 
     /**

Modified: 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSession.java
 Wed Oct  6 09:28:48 2010
@@ -23,7 +23,6 @@ import java.net.InetSocketAddress;
 
 import org.apache.mina.core.filterchain.DefaultIoFilterChain;
 import org.apache.mina.core.filterchain.IoFilterChain;
-import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.service.IoProcessor;
 import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.session.AbstractIoSession;
@@ -41,18 +40,12 @@ public abstract class AprSession extends
     // good old socket descriptor
     private long descriptor;
 
-    // the service handling this session
-    private final IoService service;
-    
     // the processor processing this session
     private final IoProcessor<AprSession> processor;
 
     // the mandatory filter chain of this session
     private final IoFilterChain filterChain = new DefaultIoFilterChain(this);
     
-    // handler listeneing this session event
-    private final IoHandler handler;
-
     // the two endpoint addresses
     private final InetSocketAddress remoteAddress;
     private final InetSocketAddress localAddress;
@@ -71,11 +64,10 @@ public abstract class AprSession extends
      * @param descriptor the low level APR socket descriptor for this socket. 
{...@see Socket#create(int, int, int, long)}
      * @throws Exception exception produced during the setting of all the 
socket parameters. 
      */
-    AprSession(
-            IoService service, IoProcessor<AprSession> processor, long 
descriptor) throws Exception {
-        this.service = service;
+    AprSession( IoService service, IoProcessor<AprSession> processor, long 
descriptor ) throws Exception
+    {
+        super( service );
         this.processor = processor;
-        this.handler = service.getHandler();
         this.descriptor = descriptor;
 
         long ra = Address.get(Socket.APR_REMOTE, descriptor);
@@ -98,9 +90,8 @@ public abstract class AprSession extends
     AprSession(
             IoService service, IoProcessor<AprSession> processor,
             long descriptor, InetSocketAddress remoteAddress) throws Exception 
{
-        this.service = service;
+        super( service );
         this.processor = processor;
-        this.handler = service.getHandler();
         this.descriptor = descriptor;
 
         long la = Address.get(Socket.APR_LOCAL, descriptor);
@@ -109,6 +100,7 @@ public abstract class AprSession extends
         this.localAddress = new InetSocketAddress(Address.getip(la), 
Address.getInfo(la).port);
     }
 
+
     /**
      * Get the socket descriptor {...@see Socket#create(int, int, int, long)}.
      * @return the low level APR socket descriptor
@@ -157,20 +149,6 @@ public abstract class AprSession extends
     /**
      * {...@inheritdoc}
      */
-    public IoHandler getHandler() {
-        return handler;
-    }
-
-    /**
-     * {...@inheritdoc}
-     */
-    public IoService getService() {
-        return service;
-    }
-
-    /**
-     * {...@inheritdoc}
-     */
     @Override
     public InetSocketAddress getServiceAddress() {
         return (InetSocketAddress) super.getServiceAddress();

Modified: 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java
 (original)
+++ 
mina/branches/2.0.1/mina-transport-apr/src/main/java/org/apache/mina/transport/socket/apr/AprSocketSession.java
 Wed Oct  6 09:28:48 2010
@@ -46,8 +46,6 @@ class AprSocketSession extends AprSessio
                 InetSocketAddress.class,
                 SocketSessionConfig.class,
                 IoBuffer.class);
-
-    private final SocketSessionConfig config = new SessionConfigImpl();
     
     /**
      * Create an instance of {...@link AprSocketSession}. 
@@ -57,6 +55,7 @@ class AprSocketSession extends AprSessio
     AprSocketSession(
             IoService service, IoProcessor<AprSession> processor, long 
descriptor) throws Exception {
         super(service, processor, descriptor);
+        config = new SessionConfigImpl();
         this.config.setAll(service.getSessionConfig());
     }
 
@@ -64,7 +63,7 @@ class AprSocketSession extends AprSessio
      * {...@inheritdoc}
      */
     public SocketSessionConfig getConfig() {
-        return config;
+        return ( SocketSessionConfig ) config;
     }
 
     /**

Modified: 
mina/branches/2.0.1/mina-transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java
URL: 
http://svn.apache.org/viewvc/mina/branches/2.0.1/mina-transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java?rev=1004937&r1=1004936&r2=1004937&view=diff
==============================================================================
--- 
mina/branches/2.0.1/mina-transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java
 (original)
+++ 
mina/branches/2.0.1/mina-transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java
 Wed Oct  6 09:28:48 2010
@@ -29,19 +29,16 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.TooManyListenersException;
 
-import org.apache.mina.core.session.AbstractIoSession;
-import org.apache.mina.core.filterchain.DefaultIoFilterChain;
-import org.apache.mina.core.service.DefaultTransportMetadata;
-import org.apache.mina.util.ExceptionMonitor;
 import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.filterchain.DefaultIoFilterChain;
 import org.apache.mina.core.filterchain.IoFilterChain;
-import org.apache.mina.core.service.IoHandler;
+import org.apache.mina.core.service.DefaultTransportMetadata;
 import org.apache.mina.core.service.IoProcessor;
-import org.apache.mina.core.service.IoService;
 import org.apache.mina.core.service.IoServiceListenerSupport;
 import org.apache.mina.core.service.TransportMetadata;
+import org.apache.mina.core.session.AbstractIoSession;
 import org.apache.mina.core.write.WriteRequest;
-
+import org.apache.mina.util.ExceptionMonitor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -58,11 +55,8 @@ class SerialSessionImpl extends Abstract
                 "rxtx", "serial", false, true, SerialAddress.class,
                 SerialSessionConfig.class, IoBuffer.class);
 
-    private final SerialSessionConfig config = new 
DefaultSerialSessionConfig();
     private final IoProcessor<SerialSessionImpl> processor = new 
SerialIoProcessor();
-    private final IoHandler ioHandler;
     private final IoFilterChain filterChain;
-    private final SerialConnector service;
     private final IoServiceListenerSupport serviceListeners;
     private final SerialAddress address;
     private final SerialPort port;
@@ -74,9 +68,9 @@ class SerialSessionImpl extends Abstract
     SerialSessionImpl(
             SerialConnector service, IoServiceListenerSupport serviceListeners,
             SerialAddress address, SerialPort port) {
-        this.service = service;
+        super( service );
+        config = new DefaultSerialSessionConfig();
         this.serviceListeners = serviceListeners;
-        ioHandler = service.getHandler();
         filterChain = new DefaultIoFilterChain(this);
         this.port = port;
         this.address = address;
@@ -84,18 +78,17 @@ class SerialSessionImpl extends Abstract
         log = LoggerFactory.getLogger(SerialSessionImpl.class);
     }
 
-    public SerialSessionConfig getConfig() {
-        return config;
+
+    public SerialSessionConfig getConfig()
+    {
+        return ( SerialSessionConfig ) config;
     }
 
+
     public IoFilterChain getFilterChain() {
         return filterChain;
     }
 
-    public IoHandler getHandler() {
-        return ioHandler;
-    }
-
     public TransportMetadata getTransportMetadata() {
         return METADATA;
     }
@@ -113,10 +106,6 @@ class SerialSessionImpl extends Abstract
         return (SerialAddress) super.getServiceAddress();
     }
 
-    public IoService getService() {
-        return service;
-    }
-
     public void setDTR(boolean dtr) {
         port.setDTR(dtr);
     }
@@ -145,7 +134,7 @@ class SerialSessionImpl extends Abstract
         ReadWorker w = new ReadWorker();
         w.start();
         port.addEventListener(this);
-        service.getIdleStatusChecker0().addSession(this);
+        ( ( SerialConnector ) getService() 
).getIdleStatusChecker0().addSession( this );
         try {
             
getService().getFilterChainBuilder().buildFilterChain(getFilterChain());
             serviceListeners.fireSessionCreated(this);


Reply via email to