Return-Path:
Delivered-To: apmail-jakarta-commons-dev-archive@apache.org
Received: (qmail 80342 invoked from network); 12 Apr 2002 21:09:25 -0000
Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131)
by daedalus.apache.org with SMTP; 12 Apr 2002 21:09:25 -0000
Received: (qmail 8099 invoked by uid 97); 12 Apr 2002 21:09:29 -0000
Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org
Received: (qmail 8038 invoked by uid 97); 12 Apr 2002 21:09:28 -0000
Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm
Precedence: bulk
List-Unsubscribe:
List-Subscribe:
List-Help:
List-Post:
List-Id: "Jakarta Commons Developers List"
Reply-To: "Jakarta Commons Developers List"
Delivered-To: mailing list commons-dev@jakarta.apache.org
Received: (qmail 8027 invoked by uid 97); 12 Apr 2002 21:09:28 -0000
Date: 12 Apr 2002 21:09:20 -0000
Message-ID: <20020412210920.72223.qmail@icarus.apache.org>
From: marcsaeg@apache.org
To: jakarta-commons-cvs@apache.org
Subject: cvs commit:
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient
HttpConnection.java
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
marcsaeg 02/04/12 14:09:20
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpConnection.java
Log:
The setSoTimeout() method can now be called before the socket is opened.
In this case, Socket.setSoTimeout() will be called when the new socket
is created in open().
Revision Changes Path
1.9 +14 -7 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
Index: HttpConnection.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- HttpConnection.java 22 Feb 2002 19:14:43 -0000 1.8
+++ HttpConnection.java 12 Apr 2002 21:09:20 -0000 1.9
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v 1.8 2002/02/22 19:14:43 marcsaeg Exp $
- * $Revision: 1.8 $
- * $Date: 2002/02/22 19:14:43 $
+ * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v 1.9 2002/04/12 21:09:20 marcsaeg Exp $
+ * $Revision: 1.9 $
+ * $Date: 2002/04/12 21:09:20 $
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -79,7 +79,7 @@
*
* @author Rod Waldhoff
* @author Sean C. Sullivan
- * @version $Revision: 1.8 $ $Date: 2002/02/22 19:14:43 $
+ * @version $Revision: 1.9 $ $Date: 2002/04/12 21:09:20 $
*/
public class HttpConnection {
// ----------------------------------------------------------- Constructors
@@ -254,15 +254,19 @@
/**
* Set my {@link Socket}'s timeout, via
- * {@link Socket#setSoTimeout}.
+ * {@link Socket#setSoTimeout}. If the connection is already open,
+ * the SO_TIMEOUT is changed. If no connection is open, then subsequent
+ * connections will use the timeout value.
* @throws SocketException - if there is an error in the underlying
* protocol, such as a TCP error.
* @throws IllegalStateException if I am not connected
*/
public void setSoTimeout(int timeout) throws SocketException, IllegalStateException {
log.debug("HttpConnection.setSoTimeout()");
- assertOpen();
- _socket.setSoTimeout(timeout);
+ _so_timeout = timeout;
+ if(_socket != null){
+ _socket.setSoTimeout(timeout);
+ }
}
/**
@@ -282,6 +286,7 @@
_socket = new Socket(host,port);
}
}
+ _socket.setSoTimeout(_so_timeout);
_input = _socket.getInputStream();
_output = _socket.getOutputStream();
_open = true;
@@ -586,5 +591,7 @@
private boolean _ssl = false;
/** "\r\n", as bytes. */
private static final byte[] CRLF = "\r\n".getBytes();
+ /** SO_TIMEOUT value */
+ private int _so_timeout = 0;
}
--
To unsubscribe, e-mail:
For additional commands, e-mail: