You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/06/23 13:46:52 UTC

svn commit: r550031 - /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Author: olegk
Date: Sat Jun 23 04:46:51 2007
New Revision: 550031

URL: http://svn.apache.org/viewvc?view=rev&rev=550031
Log:
Removed ChannelAdaptor, which makes impossible optimized inter-channel data transfer using FileChannel#transferFrom() and FileChannel#transferTo()

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?view=diff&rev=550031&r1=550030&r2=550031
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java Sat Jun 23 04:46:51 2007
@@ -33,10 +33,8 @@
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
 import java.nio.channels.Channel;
-import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 import java.util.Collections;
@@ -64,7 +62,7 @@
             throw new IllegalArgumentException("Selection key may not be null");
         }
         this.key = key;
-        this.channel = new ChannelAdaptor((ByteChannel) this.key.channel());
+        this.channel = (ByteChannel) this.key.channel();
         this.callback = callback;
         this.attributes = Collections.synchronizedMap(new HashMap());
         this.socketTimeout = 0;
@@ -220,53 +218,6 @@
         }
         buffer.append("]");
         return buffer.toString();
-    }
-    
-    private class ChannelAdaptor implements ByteChannel {
-
-        private final ByteChannel channel;
-        
-        public ChannelAdaptor(final ByteChannel channel) {
-            super();
-            this.channel = channel;
-        }
-        
-        public int write(final ByteBuffer src) throws IOException {
-            if (IOSessionImpl.this.isClosed()) {
-                return 0;
-            }
-            try {
-                return this.channel.write(src);
-            } catch (ClosedChannelException ex) {
-                IOSessionImpl.this.close();
-                return 0;
-            }
-        }
-
-        public int read(final ByteBuffer dst) throws IOException {
-            if (IOSessionImpl.this.isClosed()) {
-                return -1;
-            }
-            try {
-                return this.channel.read(dst);
-            } catch (ClosedChannelException ex) {
-                IOSessionImpl.this.close();
-                return -1;
-            }
-        }
-
-        public void close() throws IOException {
-            this.channel.close();
-        }
-
-        public boolean isOpen() {
-            return this.channel.isOpen();
-        }
-
-        public String toString() {
-            return this.channel.toString();
-        }
-        
     }
 
 }