directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r123279 - in incubator/directory/network/trunk/mina/src: examples/org/apache/mina/examples/echoserver examples/org/apache/mina/examples/netcat examples/org/apache/mina/examples/reverser java/org/apache/mina/io java/org/apache/mina/io/datagram java/org/apache/mina/io/filter java/org/apache/mina/io/socket java/org/apache/mina/protocol java/org/apache/mina/util
Date Fri, 24 Dec 2004 07:03:47 GMT
Author: trustin
Date: Thu Dec 23 23:03:45 2004
New Revision: 123279

URL: http://svn.apache.org/viewcvs?view=rev&rev=123279
Log:
 * Removed datagram package which is too outdated
 * Removed ReadBuffer and WriteBuffer and replaced them with simple ByteBuffers
 * Replaced IoSession.getWriteBuffer()... buf.flush() to IoSession.write() methods. (Now we need some write buffer pooling mechanism here)
 * Removed markerReleased() event handler.  dataWritten method now passes marker instead.
 * Added ProtocolEncoderOutput which provides a kind of output stream to ProtocolEncoder.  (This change is related with new IoSession.write() methods)

Performance is better and API is simpler and UDP friendly.
Added:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
Removed:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/ReadBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/WriteBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptorSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramReadBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramWriteBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketReadBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketWriteBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractReadBuffer.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractWriteBuffer.java
Modified:
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java	(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoProtocolHandler.java	Thu Dec 23 23:03:45 2004
@@ -18,11 +18,11 @@
  */
 package org.apache.mina.examples.echoserver;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
-import org.apache.mina.io.WriteBuffer;
 
 /**
  * TODO Document me.
@@ -57,51 +57,24 @@
         cause.printStackTrace( System.out );
     }
 
-    public void dataRead( IoSession IoSession )
-    {
-        ReadBuffer rb = IoSession.getReadBuffer();
-        WriteBuffer wb = IoSession.getWriteBuffer();
-
-        synchronized( rb )
-        {
-            synchronized( wb )
-            {
-                int nBytes = wb.putAsPossible( rb );
-                if( nBytes > 0 )
-                {
-                    System.out.println( Thread.currentThread().getName() + ' '
-                                        + IoSession.getRemoteAddress()
-                                        + ": READ (" + nBytes + "B)" );
-                    rb.signal();
-                    wb.flush();
-                }
-            }
-        }
-    }
-
-    public void dataWritten( IoSession IoSession )
+    public void dataRead( IoSession session, ByteBuffer rb )
     {
-        ReadBuffer rb = IoSession.getReadBuffer();
-        WriteBuffer wb = IoSession.getWriteBuffer();
-
         synchronized( rb )
         {
-            synchronized( wb )
-            {
-                int nBytes = wb.putAsPossible( rb );
-                if( nBytes > 0 )
-                {
-                    System.out.println( Thread.currentThread().getName() + ' '
-                                        + IoSession.getRemoteAddress()
-                                        + ": WRITTEN (" + nBytes + "B)" );
-                    rb.signal();
-                    wb.flush();
-                }
-            }
+            ByteBuffer wb = ByteBuffer.allocate(rb.remaining());
+            wb.put(rb);
+            wb.flip();
+            System.out.println( Thread.currentThread().getName() + ' '
+                                + session.getRemoteAddress()
+                                + ": READ (" + wb.remaining() + "B)" );
+            session.write(wb, null);
         }
     }
 
-    public void markerReleased( IoSession IoSession, Object marker )
+    public void dataWritten( IoSession IoSession, Object marker )
     {
+        System.out.println( Thread.currentThread().getName() + ' '
+                            + IoSession.getRemoteAddress()
+                            + ": WRITTEN" );
     }
 }

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java	(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatProtocolHandler.java	Thu Dec 23 23:03:45 2004
@@ -18,10 +18,11 @@
  */
 package org.apache.mina.examples.netcat;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandlerAdapter;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
 
 /**
  * TODO Document me.
@@ -46,17 +47,14 @@
         session.close();
     }
 
-    public void dataRead( IoSession session )
+    public void dataRead( IoSession session, ByteBuffer buf )
     {
-        ReadBuffer buf = session.getReadBuffer();
-
         synchronized( buf )
         {
             while( buf.hasRemaining() )
             {
                 System.out.print( ( char ) buf.get() );
             }
-            buf.signal();
         }
         System.out.flush();
     }

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java	(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineDecoder.java	Thu Dec 23 23:03:45 2004
@@ -18,7 +18,8 @@
  */
 package org.apache.mina.examples.reverser;
 
-import org.apache.mina.io.ReadBuffer;
+import java.nio.ByteBuffer;
+
 import org.apache.mina.protocol.ProtocolDecoder;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
@@ -34,7 +35,7 @@
 
     private StringBuffer decodeBuf = new StringBuffer();
 
-    public Object decode( ProtocolSession session, ReadBuffer in )
+    public Object decode( ProtocolSession session, ByteBuffer in )
             throws ProtocolViolationException
     {
         do
@@ -62,4 +63,4 @@
 
         return null;
     }
-}
\ No newline at end of file
+}

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java	(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineEncoder.java	Thu Dec 23 23:03:45 2004
@@ -18,8 +18,10 @@
  */
 package org.apache.mina.examples.reverser;
 
-import org.apache.mina.io.WriteBuffer;
+import java.nio.ByteBuffer;
+
 import org.apache.mina.protocol.ProtocolEncoder;
+import org.apache.mina.protocol.ProtocolEncoderOutput;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
 
@@ -32,39 +34,27 @@
 public class TextLineEncoder implements ProtocolEncoder
 {
 
-    private String encodeData;
-
-    private int encodePos;
-
-    public boolean encode( ProtocolSession session, Object message,
-                          WriteBuffer out ) throws ProtocolViolationException
+    public void encode( ProtocolSession session, Object message,
+                       ProtocolEncoderOutput out )
+            throws ProtocolViolationException
     {
 
-        if( message != encodeData )
+        String val = message.toString();
+        if( val.length() > 256 )
         {
-            String val = message.toString();
-            if( val.length() > 256 )
-            {
-                throw new ProtocolViolationException(
-                                                      "Cannot encode too long string." );
-            }
-            encodeData = val + "\r\n";
-            encodePos = 0;
+            throw new ProtocolViolationException(
+                                                  "Cannot encode too long string." );
         }
 
-        for( ; encodePos < encodeData.length(); encodePos++ )
+        val += "\r\n";
+
+        ByteBuffer buf = ByteBuffer.allocate( val.length() );
+        for( int i = 0; i < val.length(); i++ )
         {
-            if( out.hasRemaining() )
-            {
-                out.put( ( byte ) encodeData.charAt( encodePos ) );
-            }
-            else
-            {
-                return false;
-            }
+            buf.put( ( byte ) val.charAt( i ) );
         }
 
-        encodeData = null;
-        return true;
+        buf.flip();
+        out.write( buf );
     }
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.io;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 
 /**
@@ -36,9 +38,7 @@
 
     void exceptionCaught( IoSession session, Throwable cause );
 
-    void dataRead( IoSession session );
-
-    void dataWritten( IoSession session );
+    void dataRead( IoSession session, ByteBuffer buf );
 
-    void markerReleased( IoSession session, Object marker );
+    void dataWritten( IoSession session, Object marker );
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerAdapter.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.io;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 
 /**
@@ -45,15 +47,11 @@
     {
     }
 
-    public void dataRead( IoSession session )
-    {
-    }
-
-    public void dataWritten( IoSession session )
+    public void dataRead( IoSession session, ByteBuffer buf )
     {
     }
 
-    public void markerReleased( IoSession session, Object marker )
+    public void dataWritten( IoSession session, Object marker )
     {
     }
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.io;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 
 /**
@@ -42,10 +44,7 @@
     void exceptionCaught( IoHandler nextHandler, IoSession session,
                          Throwable cause );
 
-    void dataRead( IoHandler nextHandler, IoSession session );
-
-    void dataWritten( IoHandler nextHandler, IoSession session );
+    void dataRead( IoHandler nextHandler, IoSession session, ByteBuffer buf );
 
-    void markerReleased( IoHandler nextHandler, IoSession session,
-                        Object marker );
+    void dataWritten( IoHandler nextHandler, IoSession session, Object marker );
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilterAdapter.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.io;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 
 /**
@@ -58,20 +60,15 @@
         nextHandler.exceptionCaught( session, cause );
     }
 
-    public void dataRead( IoHandler nextHandler, IoSession session )
+    public void dataRead( IoHandler nextHandler, IoSession session,
+                         ByteBuffer buf )
     {
-        nextHandler.dataRead( session );
+        nextHandler.dataRead( session, buf );
     }
 
-    public void dataWritten( IoHandler nextHandler, IoSession session )
+    public void dataWritten( IoHandler nextHandler, IoSession session,
+                            Object marker )
     {
-        nextHandler.dataWritten( session );
+        nextHandler.dataWritten( session, marker );
     }
-
-    public void markerReleased( IoHandler nextHandler, IoSession session,
-                               Object marker )
-    {
-        nextHandler.markerReleased( session, marker );
-    }
-
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSession.java	Thu Dec 23 23:03:45 2004
@@ -19,6 +19,7 @@
 package org.apache.mina.io;
 
 import java.net.SocketAddress;
+import java.nio.ByteBuffer;
 
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
@@ -34,14 +35,16 @@
     IoHandler getHandler();
 
     void close();
+    
+    void write(byte[] buf, Object marker);
 
-    Object getAttachment();
+    void write(ByteBuffer buf, Object marker);
 
-    void setAttachment( Object attachment );
+    void write(byte[] buf, int offset, int length, Object marker);
 
-    ReadBuffer getReadBuffer();
+    Object getAttachment();
 
-    WriteBuffer getWriteBuffer();
+    void setAttachment( Object attachment );
 
     boolean isConnected();
 

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/ReadBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/ReadBuffer.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/WriteBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/WriteBuffer.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptor.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptorSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramAcceptorSession.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramReadBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramReadBuffer.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramSessionConfig.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramWriteBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/datagram/DatagramWriteBuffer.java?view=auto&rev=123278
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java	Thu Dec 23 23:03:45 2004
@@ -21,13 +21,13 @@
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
+import java.nio.ByteBuffer;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilterAdapter;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
 
 /**
  * TODO Document me.
@@ -49,19 +49,16 @@
         blacklist.remove( address );
     }
 
-    public void dataRead( IoHandler nextHandler, IoSession session )
+    public void dataRead( IoHandler nextHandler, IoSession session, ByteBuffer buf )
     {
         if( isBlocked( session ) )
         {
             // just ignore all
-            ReadBuffer buf = session.getReadBuffer();
-            buf.skipAll();
-            buf.signal();
         }
         else
         {
             // or forward
-            super.dataRead( nextHandler, session );
+            super.dataRead( nextHandler, session, buf );
         }
     }
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/IoThreadPoolFilter.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,7 @@
  */
 package org.apache.mina.io.filter;
 
+import java.nio.ByteBuffer;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
 import java.util.Iterator;
@@ -28,7 +29,6 @@
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilter;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
 import org.apache.mina.util.BlockingSet;
 import org.apache.mina.util.Queue;
 import org.apache.mina.util.Stack;
@@ -165,20 +165,14 @@
         fireEvent( nextHandler, session, EventType.EXCEPTION, cause );
     }
 
-    public void dataRead( IoHandler nextHandler, IoSession session )
+    public void dataRead( IoHandler nextHandler, IoSession session, ByteBuffer buf )
     {
-        fireEvent( nextHandler, session, EventType.READ, null );
+        fireEvent( nextHandler, session, EventType.READ, buf );
     }
 
-    public void dataWritten( IoHandler nextHandler, IoSession session )
+    public void dataWritten( IoHandler nextHandler, IoSession session, Object marker )
     {
-        fireEvent( nextHandler, session, EventType.WRITTEN, null );
-    }
-
-    public void markerReleased( IoHandler nextHandler, IoSession session,
-                               Object marker )
-    {
-        fireEvent( nextHandler, session, EventType.MARKER, marker );
+        fireEvent( nextHandler, session, EventType.WRITTEN, marker );
     }
 
     private void fireEvent( IoHandler nextHandler, IoSession session,
@@ -257,8 +251,6 @@
 
         private static final EventType IDLE = new EventType();
 
-        private static final EventType MARKER = new EventType();
-
         private static final EventType EXCEPTION = new EventType();
 
         private EventType()
@@ -372,7 +364,7 @@
         {
             if( type == EventType.READ )
             {
-                ReadBuffer buf = session.getReadBuffer();
+                ByteBuffer buf = (ByteBuffer) data;
                 boolean fire;
                 synchronized( buf )
                 {
@@ -381,16 +373,12 @@
 
                 if( fire )
                 {
-                    nextHandler.dataRead( session );
+                    nextHandler.dataRead( session, buf );
                 }
             }
             else if( type == EventType.WRITTEN )
             {
-                nextHandler.dataWritten( session );
-            }
-            else if( type == EventType.MARKER )
-            {
-                nextHandler.markerReleased( session, data );
+                nextHandler.dataWritten( session, data );
             }
             else if( type == EventType.EXCEPTION )
             {

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketIoProcessor.java	Thu Dec 23 23:03:45 2004
@@ -253,8 +253,7 @@
 
     private void read( SocketSession session )
     {
-        SocketReadBuffer lock = ( SocketReadBuffer ) session.getReadBuffer();
-        ByteBuffer readBuf = lock.buf();
+        ByteBuffer buf = session.getReadBuffer();
         SocketChannel ch = session.getChannel();
 
         try
@@ -262,21 +261,20 @@
             int readBytes = 0;
             int ret;
 
-            synchronized( lock )
+            synchronized( buf )
             {
-                readBuf.compact();
+                buf.compact();
 
                 try
                 {
-                    while( ( ret = ch.read( readBuf ) ) > 0 )
+                    while( ( ret = ch.read( buf ) ) > 0 )
                     {
                         readBytes += ret;
                     }
                 }
                 finally
                 {
-                    readBuf.flip();
-                    readBuf.mark();
+                    buf.flip();
                 }
 
                 session.increaseReadBytes( readBytes );
@@ -285,14 +283,15 @@
                 {
                     if( readBytes > 0 )
                     {
-                        lock.markBaseIndex();
-                        session.getFilterManager().fireDataRead( session );
+                        session.getFilterManager().fireDataRead( session, buf );
                     }
                     else
                     {
-                        SelectionKey key = session.getSelectionKey();
-                        key.interestOps( key.interestOps()
-                                         & ( ~SelectionKey.OP_READ ) );
+                        // FIXME will spin in multi-threaded env.
+                        
+//                        SelectionKey key = session.getSelectionKey();
+//                        key.interestOps( key.interestOps()
+//                                         & ( ~SelectionKey.OP_READ ) );
                     }
                 }
                 else
@@ -393,114 +392,64 @@
             if( session.isClosed() )
                 continue;
 
-            flush( session );
+            try
+            {
+                flush( session );
+            }
+            catch( IOException e )
+            {
+                session.getFilterManager().fireExceptionCaught( session, e );
+            }
         }
     }
 
-    private void flush( SocketSession session )
+    private void flush( SocketSession session ) throws IOException
     {
-        SocketWriteBuffer lock = ( SocketWriteBuffer ) session
-                .getWriteBuffer();
-        ByteBuffer writeBuf = lock.buf();
         SocketChannel ch = session.getChannel();
 
-        try
-        {
-            synchronized( lock )
+        Queue writeBufferQueue = session.getWriteBufferQueue();
+        Queue writeMarkerQueue = session.getWriteMarkerQueue();
+        
+        ByteBuffer buf;
+        Object marker;
+        for ( ;; ) {
+            synchronized (writeBufferQueue) {
+                buf = (ByteBuffer) writeBufferQueue.first();
+                marker = writeMarkerQueue.first();
+            }
+            
+            if (buf == null)
+                break;
+            
+            if (buf.remaining() == 0) {
+                synchronized (writeBufferQueue) {
+                    writeBufferQueue.pop();
+                    writeMarkerQueue.pop();
+                }
+                
+                session.getFilterManager().fireDataWritten(session, marker);
+                continue;
+            }
+            
+            try
             {
-                writeBuf.flip();
-
-                // ignore empty write buffer
-                if( writeBuf.remaining() == 0 )
+                ch.write( buf );
+            }
+            finally
+            {
+                SelectionKey key = session.getSelectionKey();
+                if( buf.hasRemaining() )
                 {
-                    writeBuf.clear();
-
-                    Queue markers = lock.getMarkers();
-                    for( ;; )
-                    {
-                        SocketWriteBuffer.Marker marker = ( SocketWriteBuffer.Marker ) markers
-                                .pop();
-                        if( marker == null )
-                            break;
-
-                        session.getFilterManager()
-                                .fireMarkerReleased( session,
-                                                     marker.getValue() );
-                    }
+                    // Kernel buffer is full
+                    key.interestOps( key.interestOps()
+                                     | SelectionKey.OP_WRITE );
                 }
                 else
                 {
-                    int writtenBytes;
-
-                    try
-                    {
-                        writtenBytes = ch.write( writeBuf );
-                    }
-                    finally
-                    {
-                        SelectionKey key = session.getSelectionKey();
-
-                        if( writeBuf.hasRemaining() )
-                        {
-                            // Kernel buffer is full
-                            key.interestOps( key.interestOps()
-                                             | SelectionKey.OP_WRITE );
-                        }
-                        else
-                        {
-                            key.interestOps( key.interestOps()
-                                             & ( ~SelectionKey.OP_WRITE ) );
-                        }
-
-                        writeBuf.compact();
-                        writeBuf.mark();
-                    }
-
-                    if( writtenBytes > 0 )
-                    {
-                        session.increaseWrittenBytes( writtenBytes );
-                        lock.markBaseIndex();
-                        session.getFilterManager().fireDataWritten( session );
-                        Queue markers = lock.getMarkers();
-                        for( ;; )
-                        {
-                            SocketWriteBuffer.Marker marker = ( SocketWriteBuffer.Marker ) markers
-                                    .first();
-                            if( marker == null )
-                                break;
-
-                            int bytesLeft = marker.getBytesLeft();
-                            if( bytesLeft > writtenBytes )
-                            {
-                                marker.setBytesLeft( bytesLeft - writtenBytes );
-                                break;
-                            }
-                            else if( bytesLeft == writtenBytes )
-                            {
-                                markers.pop();
-                                session
-                                        .getFilterManager()
-                                        .fireMarkerReleased( session,
-                                                             marker.getValue() );
-                                break;
-                            }
-                            else
-                            {
-                                markers.pop();
-                                session
-                                        .getFilterManager()
-                                        .fireMarkerReleased( session,
-                                                             marker.getValue() );
-                                writtenBytes -= bytesLeft;
-                            }
-                        }
-                    }
+                    key.interestOps( key.interestOps()
+                                     & ( ~SelectionKey.OP_WRITE ) );
                 }
             }
-        }
-        catch( IOException e )
-        {
-            session.getFilterManager().fireExceptionCaught( session, e );
         }
     }
 

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketReadBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketReadBuffer.java?view=auto&rev=123278
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketSession.java	Thu Dec 23 23:03:45 2004
@@ -27,10 +27,9 @@
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
-import org.apache.mina.io.WriteBuffer;
 import org.apache.mina.util.ByteBufferPool;
 import org.apache.mina.util.IoHandlerFilterManager;
+import org.apache.mina.util.Queue;
 
 /**
  * TODO Insert type comment.
@@ -46,9 +45,11 @@
 
     private final SocketSessionConfig config;
 
-    private final SocketReadBuffer readBuf;
+    private final ByteBuffer readBuf;
 
-    private final SocketWriteBuffer writeBuf;
+    private final Queue writeBufferQueue;
+
+    private final Queue writeMarkerQueue;
 
     private final IoHandler handler;
 
@@ -78,14 +79,14 @@
      * Creates a new instance.
      */
     SocketSession( IoHandlerFilterManager filterManager, SocketChannel ch,
-               IoHandler defaultHandler )
+                  IoHandler defaultHandler )
     {
         this.filterManager = filterManager;
         this.ch = ch;
         this.config = new SocketSessionConfig( ch );
-        this.readBuf = new SocketReadBuffer( this, ( ByteBuffer ) ByteBufferPool
-                .open().limit( 0 ) );
-        this.writeBuf = new SocketWriteBuffer( this, ByteBufferPool.open() );
+        this.readBuf = ( ByteBuffer ) ByteBufferPool.open().limit( 0 );
+        this.writeBufferQueue = new Queue();
+        this.writeMarkerQueue = new Queue();
         this.handler = defaultHandler;
         this.remoteAddress = ch.socket().getRemoteSocketAddress();
         this.localAddress = ch.socket().getLocalSocketAddress();
@@ -113,8 +114,7 @@
 
     void dispose()
     {
-        ByteBufferPool.close( readBuf.buf() );
-        ByteBufferPool.close( writeBuf.buf() );
+        ByteBufferPool.close( readBuf );
     }
 
     public IoHandler getHandler()
@@ -137,18 +137,39 @@
         this.attachment = attachment;
     }
 
-    public ReadBuffer getReadBuffer()
+    ByteBuffer getReadBuffer()
     {
         return readBuf;
     }
 
-    public WriteBuffer getWriteBuffer()
+    Queue getWriteBufferQueue()
+    {
+        return writeBufferQueue;
+    }
+
+    Queue getWriteMarkerQueue()
     {
-        return writeBuf;
+        return writeMarkerQueue;
     }
 
-    void flush()
+    public void write( byte[] buf, int offset, int length, Object marker )
     {
+        write( ByteBuffer.wrap( buf, offset, length ), marker );
+    }
+
+    public void write( byte[] buf, Object marker )
+    {
+        write( ByteBuffer.wrap( buf ), marker );
+    }
+
+    public void write( ByteBuffer buf, Object marker )
+    {
+        synchronized( writeBufferQueue )
+        {
+            writeBufferQueue.push( buf );
+            writeMarkerQueue.push( marker );
+        }
+
         SocketIoProcessor.getInstance().flushSession( this );
     }
 

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketWriteBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/SocketWriteBuffer.java?view=auto&rev=123278
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java	Thu Dec 23 23:03:45 2004
@@ -19,13 +19,12 @@
 package org.apache.mina.protocol;
 
 import java.net.SocketAddress;
+import java.nio.ByteBuffer;
 
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.SessionConfig;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.ReadBuffer;
-import org.apache.mina.io.WriteBuffer;
 import org.apache.mina.util.ProtocolHandlerFilterManager;
 import org.apache.mina.util.Queue;
 
@@ -106,43 +105,22 @@
                     .getAttachment(), cause );
         }
 
-        public void dataRead( IoSession session )
+        public void dataRead( IoSession session, ByteBuffer in )
         {
             ProtocolSession psession = ( ProtocolSession ) session
                     .getAttachment();
-            ReadBuffer in = session.getReadBuffer();
-            int sizeBefore;
-            int sizeAfter;
             Object result;
-
             try
             {
-                do
+                synchronized( in )
                 {
-                    result = null;
-
-                    synchronized( in )
-                    {
-                        sizeBefore = in.remaining();
-                        result = decoder.decode( psession, in );
-                        sizeAfter = in.remaining();
-                    }
-
-                    if( sizeBefore != sizeAfter )
-                    {
-                        in.signal();
-                    }
+                    result = decoder.decode( psession, in );
+                }
 
-                    if( result != null )
-                    {
-                        filterManager.fireMessageReceived( psession, result );
-                    }
-                    else
-                    {
-                        break;
-                    }
+                if( result != null )
+                {
+                    filterManager.fireMessageReceived( psession, result );
                 }
-                while( sizeAfter > 0 );
             }
             catch( Throwable t )
             {
@@ -150,12 +128,7 @@
             }
         }
 
-        public void dataWritten( IoSession session )
-        {
-            write( session );
-        }
-
-        public void markerReleased( IoSession session, Object marker )
+        public void dataWritten( IoSession session, Object marker )
         {
             filterManager.fireMessageSent( ( ProtocolSession ) session
                     .getAttachment(), marker );
@@ -172,26 +145,18 @@
                 return;
             }
 
-            WriteBuffer out = session.getWriteBuffer();
-
             try
             {
                 while( !writeQueue.isEmpty() )
                 {
-                    synchronized( out )
+                    synchronized( writeQueue )
                     {
-                        Object message = writeQueue.first();
+                        Object message = writeQueue.pop();
                         if( message == null )
                             break;
-                        if( encoder.encode( psession, message, out ) )
-                        {
-                            out.putMarker( writeQueue.pop() );
-                            out.flush();
-                        }
-                        else
-                        {
-                            break;
-                        }
+
+                        psession.encOut.setMessage( message );
+                        encoder.encode( psession, message, psession.encOut );
                     }
                 }
             }
@@ -210,6 +175,8 @@
 
         private final Queue writeQueue = new Queue();
 
+        private final ProtocolEncoderOutputImpl encOut;
+
         private Object attachment;
 
         private ProtocolSessionImpl( IoSession session,
@@ -217,6 +184,7 @@
         {
             this.session = session;
             this.adapter = adapter;
+            this.encOut = new ProtocolEncoderOutputImpl( session );
         }
 
         public ProtocolHandler getHandler()
@@ -251,7 +219,7 @@
 
         public boolean write( Object message )
         {
-            synchronized( session.getWriteBuffer() )
+            synchronized( writeQueue )
             {
                 writeQueue.push( message );
             }
@@ -303,6 +271,40 @@
         public boolean isIdle( IdleStatus status )
         {
             return session.isIdle( status );
+        }
+    }
+
+    private static class ProtocolEncoderOutputImpl implements
+                                                  ProtocolEncoderOutput
+    {
+
+        private final IoSession session;
+
+        private Object message;
+
+        private ProtocolEncoderOutputImpl( IoSession session )
+        {
+            this.session = session;
+        }
+
+        public void setMessage( Object message )
+        {
+            this.message = message;
+        }
+
+        public void write( ByteBuffer buf )
+        {
+            session.write( buf, message );
+        }
+
+        public void write( byte[] buf )
+        {
+            session.write( buf, message );
+        }
+
+        public void write( byte[] buf, int offset, int length )
+        {
+            session.write( buf, offset, length, message );
         }
     }
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolDecoder.java	Thu Dec 23 23:03:45 2004
@@ -18,7 +18,8 @@
  */
 package org.apache.mina.protocol;
 
-import org.apache.mina.io.ReadBuffer;
+import java.nio.ByteBuffer;
+
 
 /**
  * TODO Insert type comment.
@@ -28,6 +29,6 @@
  */
 public interface ProtocolDecoder
 {
-    Object decode( ProtocolSession session, ReadBuffer in )
+    Object decode( ProtocolSession session, ByteBuffer in )
             throws ProtocolViolationException;
 }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoder.java	Thu Dec 23 23:03:45 2004
@@ -18,7 +18,6 @@
  */
 package org.apache.mina.protocol;
 
-import org.apache.mina.io.WriteBuffer;
 
 /**
  * TODO Insert type comment.
@@ -28,6 +27,6 @@
  */
 public interface ProtocolEncoder
 {
-    boolean encode( ProtocolSession session, Object message, WriteBuffer out )
-            throws ProtocolViolationException;
+    void encode( ProtocolSession session, Object message,
+                ProtocolEncoderOutput out ) throws ProtocolViolationException;
 }

Added: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java?view=auto&rev=123279
==============================================================================
--- (empty file)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolEncoderOutput.java	Thu Dec 23 23:03:45 2004
@@ -0,0 +1,34 @@
+/*
+ *   @(#) $Id: ProtocolEncoder.java 122629 2004-12-17 08:14:08Z trustin $
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.protocol;
+
+import java.nio.ByteBuffer;
+
+/**
+ * TODO Document me.
+ * 
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$
+ */
+public interface ProtocolEncoderOutput
+{
+    void write(ByteBuffer buf);
+    void write(byte[] buf);
+    void write(byte[] buf, int offset, int length);
+}

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractReadBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractReadBuffer.java?view=auto&rev=123278
==============================================================================

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractWriteBuffer.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/AbstractWriteBuffer.java?view=auto&rev=123278
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java?view=diff&rev=123279&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java&r1=123278&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java&r2=123279
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/util/IoHandlerFilterManager.java	Thu Dec 23 23:03:45 2004
@@ -18,6 +18,8 @@
  */
 package org.apache.mina.util;
 
+import java.nio.ByteBuffer;
+
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.IoHandlerFilter;
@@ -56,20 +58,16 @@
             session.getHandler().exceptionCaught( session, cause );
         }
 
-        public void dataRead( IoHandler nextHandler, IoSession session )
-        {
-            session.getHandler().dataRead( session );
-        }
-
-        public void dataWritten( IoHandler nextHandler, IoSession session )
+        public void dataRead( IoHandler nextHandler, IoSession session,
+                             ByteBuffer buf )
         {
-            session.getHandler().dataWritten( session );
+            session.getHandler().dataRead( session, buf );
         }
 
-        public void markerReleased( IoHandler nextHandler, IoSession session,
-                                   Object marker )
+        public void dataWritten( IoHandler nextHandler, IoSession session,
+                                Object marker )
         {
-            session.getHandler().markerReleased( session, marker );
+            session.getHandler().dataWritten( session, marker );
         }
 
         public void init()
@@ -232,25 +230,12 @@
         }
     }
 
-    public void fireDataRead( IoSession session )
-    {
-        Entry head = this.head;
-        try
-        {
-            head.filter.dataRead( head.nextHandler, session );
-        }
-        catch( Throwable e )
-        {
-            fireExceptionCaught( session, e );
-        }
-    }
-
-    public void fireDataWritten( IoSession session )
+    public void fireDataRead( IoSession session, ByteBuffer buf )
     {
         Entry head = this.head;
         try
         {
-            head.filter.dataWritten( head.nextHandler, session );
+            head.filter.dataRead( head.nextHandler, session, buf );
         }
         catch( Throwable e )
         {
@@ -258,12 +243,12 @@
         }
     }
 
-    public void fireMarkerReleased( IoSession session, Object marker )
+    public void fireDataWritten( IoSession session, Object marker )
     {
         Entry head = this.head;
         try
         {
-            head.filter.markerReleased( head.nextHandler, session, marker );
+            head.filter.dataWritten( head.nextHandler, session, marker );
         }
         catch( Throwable e )
         {
@@ -364,13 +349,13 @@
                     }
                 }
 
-                public void dataRead( IoSession session )
+                public void dataRead( IoSession session, ByteBuffer buf )
                 {
                     try
                     {
                         Entry.this.nextEntry.filter
                                 .dataRead( Entry.this.nextEntry.nextHandler,
-                                           session );
+                                           session, buf );
                     }
                     catch( Throwable e )
                     {
@@ -378,29 +363,14 @@
                     }
                 }
 
-                public void dataWritten( IoSession session )
+                public void dataWritten( IoSession session, Object marker )
                 {
                     try
                     {
                         Entry.this.nextEntry.filter
                                 .dataWritten(
                                               Entry.this.nextEntry.nextHandler,
-                                              session );
-                    }
-                    catch( Throwable e )
-                    {
-                        exceptionCaught( session, e );
-                    }
-                }
-
-                public void markerReleased( IoSession session, Object marker )
-                {
-                    try
-                    {
-                        Entry.this.nextEntry.filter
-                                .markerReleased(
-                                                 Entry.this.nextEntry.nextHandler,
-                                                 session, marker );
+                                              session, marker );
                     }
                     catch( Throwable e )
                     {

Mime
View raw message