[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r234099 - in
From:       olegk () apache ! org
Date:       2005-08-20 17:23:06
Message-ID: 20050820172307.34598.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: olegk
Date: Sat Aug 20 10:23:00 2005
New Revision: 234099

URL: http://svn.apache.org/viewcvs?rev=234099&view=rev
Log:
Constructors made public

Modified:
    jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataReceiver.java
  jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataTransmitter.java
  jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataReceiver.java
  jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataTransmitter.java


Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataReceiver.java
                
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/a \
pache/http/impl/io/NIOSocketHttpDataReceiver.java?rev=234099&r1=234098&r2=234099&view=diff
 ==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataReceiver.java \
                (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataReceiver.java \
Sat Aug 20 10:23:00 2005 @@ -31,10 +31,7 @@
 
 import java.io.IOException;
 import java.net.Socket;
-import java.net.SocketTimeoutException;
 import java.nio.ByteBuffer;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 
 import org.apache.http.params.HttpConnectionParams;
@@ -52,11 +49,8 @@
 public class NIOSocketHttpDataReceiver extends NIOHttpDataReceiver {
 
     private final SocketChannel channel;
-    private final Selector selector;
     
-    private long readTimeout = 0;
-    
-    protected NIOSocketHttpDataReceiver(final Socket socket) throws IOException {
+    public NIOSocketHttpDataReceiver(final Socket socket) throws IOException {
         super();
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");
@@ -65,14 +59,13 @@
             throw new IllegalArgumentException("Socket does not implement NIO \
channel");  }
         this.channel = socket.getChannel();
-        this.channel.configureBlocking(false);
-        this.selector = Selector.open();
-        this.channel.register(this.selector, SelectionKey.OP_READ);
         initBuffer(socket.getReceiveBufferSize());
     }
     
     public void reset(final HttpParams params) {
-        this.readTimeout = HttpConnectionParams.getSoTimeout(params);
+        if (HttpConnectionParams.getSoTimeout(params) > 0) {
+        	throw new IllegalStateException("Socket timeout not supported by NIO \
connections"); +        }
         super.reset(params); 
     }
 
@@ -80,22 +73,11 @@
         if (dst == null) {
             throw new IllegalArgumentException("Byte buffer may not be null");
         }
-        this.selector.select(this.readTimeout);
-        int result = this.channel.read(dst);
-        if (result == 0) {
-            throw new SocketTimeoutException("Socket read timeout after " 
-                    + this.readTimeout + " ms");
-        }
-        return result;
+        return this.channel.read(dst);
     }
   
     public boolean isDataAvailable(int timeout) throws IOException {
-        if (hasDataInBuffer()) {
-            return true;
-        } else {
-            this.selector.select(timeout);
-            return !this.selector.selectedKeys().isEmpty();
-        }
+        return hasDataInBuffer();
     }    
         
 }

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataTransmitter.java
                
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/a \
pache/http/impl/io/NIOSocketHttpDataTransmitter.java?rev=234099&r1=234098&r2=234099&view=diff
 ==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataTransmitter.java \
                (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/NIOSocketHttpDataTransmitter.java \
Sat Aug 20 10:23:00 2005 @@ -48,7 +48,7 @@
 
     private final SocketChannel channel;
     
-    protected NIOSocketHttpDataTransmitter(final Socket socket) throws \
SocketException { +    public NIOSocketHttpDataTransmitter(final Socket socket) \
throws SocketException {  super();
         if (socket == null) {
             throw new IllegalArgumentException("Socket may not be null");

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataReceiver.java
                
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/a \
pache/http/impl/io/OldIOSocketHttpDataReceiver.java?rev=234099&r1=234098&r2=234099&view=diff
 ==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataReceiver.java \
                (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataReceiver.java \
Sat Aug 20 10:23:00 2005 @@ -85,7 +85,7 @@
         return new BufferedInputStream(socket.getInputStream(), buffersize);
     }
     
-    protected OldIOSocketHttpDataReceiver(final Socket socket) throws IOException {
+    public OldIOSocketHttpDataReceiver(final Socket socket) throws IOException {
         super(createInputStream(socket));
         this.socket = socket;
     }

Modified: jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataTransmitter.java
                
URL: http://svn.apache.org/viewcvs/jakarta/httpclient/trunk/http-common/src/java/org/a \
pache/http/impl/io/OldIOSocketHttpDataTransmitter.java?rev=234099&r1=234098&r2=234099&view=diff
 ==============================================================================
--- jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataTransmitter.java \
                (original)
+++ jakarta/httpclient/trunk/http-common/src/java/org/apache/http/impl/io/OldIOSocketHttpDataTransmitter.java \
Sat Aug 20 10:23:00 2005 @@ -58,7 +58,7 @@
         return new BufferedOutputStream(socket.getOutputStream(), buffersize);
     }
     
-    protected OldIOSocketHttpDataTransmitter(final Socket socket) throws IOException \
{ +    public OldIOSocketHttpDataTransmitter(final Socket socket) throws IOException \
{  super(createOutputStream(socket));
     }
     


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic