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 2008/12/27 23:06:37 UTC
svn commit: r729685 -
/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java
Author: olegk
Date: Sat Dec 27 14:06:36 2008
New Revision: 729685
URL: http://svn.apache.org/viewvc?rev=729685&view=rev
Log:
Javadoc updates
Modified:
httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java
Modified: httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java?rev=729685&r1=729684&r2=729685&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java (original)
+++ httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/params/HttpConnectionParams.java Sat Dec 27 14:06:36 2008
@@ -32,11 +32,7 @@
package org.apache.http.params;
/**
- * An adaptor for accessing connection parameters in {@link HttpParams}.
- * <br/>
- * Note that the <i>implements</i> relation to {@link CoreConnectionPNames}
- * is for compatibility with existing application code only. References to
- * the parameter names should use the interface, not this class.
+ * Utility class for accessing connection parameters in {@link HttpParams}.
*
* @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
*
@@ -46,19 +42,16 @@
*/
public final class HttpConnectionParams implements CoreConnectionPNames {
- /**
- */
private HttpConnectionParams() {
super();
}
/**
- * Returns the default socket timeout (<tt>SO_TIMEOUT</tt>) in milliseconds which is the
- * timeout for waiting for data. A timeout value of zero is interpreted as an infinite
- * timeout. This value is used when no socket timeout is set in the
- * method parameters.
- *
- * @return timeout in milliseconds
+ * Obtains value of the {@link CoreConnectionPNames#SO_TIMEOUT} parameter.
+ * If not set, defaults to <code>0</code>.
+ *
+ * @param HTTP parameters.
+ * @return SO_TIMEOUT.
*/
public static int getSoTimeout(final HttpParams params) {
if (params == null) {
@@ -68,12 +61,10 @@
}
/**
- * Sets the default socket timeout (<tt>SO_TIMEOUT</tt>) in milliseconds which is the
- * timeout for waiting for data. A timeout value of zero is interpreted as an infinite
- * timeout. This value is used when no socket timeout is set in the
- * method parameters.
+ * Sets value of the {@link CoreConnectionPNames#SO_TIMEOUT} parameter.
*
- * @param timeout Timeout in milliseconds
+ * @param HTTP parameters.
+ * @param SO_TIMEOUT.
*/
public static void setSoTimeout(final HttpParams params, int timeout) {
if (params == null) {
@@ -84,10 +75,11 @@
}
/**
- * Tests if Nagle's algorithm is to be used.
- *
- * @return <tt>true</tt> if the Nagle's algorithm is to NOT be used
- * (that is enable TCP_NODELAY), <tt>false</tt> otherwise.
+ * Obtains value of the {@link CoreConnectionPNames#TCP_NODELAY} parameter.
+ * If not set, defaults to <code>true</code>.
+ *
+ * @param HTTP parameters.
+ * @return Nagle's algorithm flag
*/
public static boolean getTcpNoDelay(final HttpParams params) {
if (params == null) {
@@ -98,14 +90,10 @@
}
/**
- * Determines whether Nagle's algorithm is to be used. The Nagle's algorithm
- * tries to conserve bandwidth by minimizing the number of segments that are
- * sent. When applications wish to decrease network latency and increase
- * performance, they can disable Nagle's algorithm (that is enable TCP_NODELAY).
- * Data will be sent earlier, at the cost of an increase in bandwidth consumption.
- *
- * @param value <tt>true</tt> if the Nagle's algorithm is to NOT be used
- * (that is enable TCP_NODELAY), <tt>false</tt> otherwise.
+ * Sets value of the {@link CoreConnectionPNames#TCP_NODELAY} parameter.
+ *
+ * @param HTTP parameters.
+ * @param Nagle's algorithm flag
*/
public static void setTcpNoDelay(final HttpParams params, boolean value) {
if (params == null) {
@@ -114,6 +102,13 @@
params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY, value);
}
+ /**
+ * Obtains value of the {@link CoreConnectionPNames#SOCKET_BUFFER_SIZE}
+ * parameter. If not set, defaults to <code>-1</code>.
+ *
+ * @param HTTP parameters.
+ * @return socket buffer size
+ */
public static int getSocketBufferSize(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -122,6 +117,13 @@
(CoreConnectionPNames.SOCKET_BUFFER_SIZE, -1);
}
+ /**
+ * Sets value of the {@link CoreConnectionPNames#SOCKET_BUFFER_SIZE}
+ * parameter.
+ *
+ * @param HTTP parameters.
+ * @param socket buffer size
+ */
public static void setSocketBufferSize(final HttpParams params, int size) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -130,10 +132,11 @@
}
/**
- * Returns linger-on-close timeout. Value <tt>0</tt> implies that the option is
- * disabled. Value <tt>-1</tt> implies that the JRE default is used.
- *
- * @return the linger-on-close timeout
+ * Obtains value of the {@link CoreConnectionPNames#SO_LINGER} parameter.
+ * If not set, defaults to <code>-1</code>.
+ *
+ * @param HTTP parameters.
+ * @return SO_LINGER.
*/
public static int getLinger(final HttpParams params) {
if (params == null) {
@@ -143,14 +146,10 @@
}
/**
- * Returns linger-on-close timeout. This option disables/enables immediate return
- * from a close() of a TCP Socket. Enabling this option with a non-zero Integer
- * timeout means that a close() will block pending the transmission and
- * acknowledgement of all data written to the peer, at which point the socket is
- * closed gracefully. Value <tt>0</tt> implies that the option is
- * disabled. Value <tt>-1</tt> implies that the JRE default is used.
- *
- * @param value the linger-on-close timeout
+ * Sets value of the {@link CoreConnectionPNames#SO_LINGER} parameter.
+ *
+ * @param HTTP parameters.
+ * @param SO_LINGER.
*/
public static void setLinger(final HttpParams params, int value) {
if (params == null) {
@@ -160,10 +159,11 @@
}
/**
- * Returns the timeout until a connection is etablished. A value of zero
- * means the timeout is not used. The default value is zero.
- *
- * @return timeout in milliseconds.
+ * Obtains value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT}
+ * parameter. If not set, defaults to <code>0</code>.
+ *
+ * @param HTTP parameters.
+ * @return connect timeout.
*/
public static int getConnectionTimeout(final HttpParams params) {
if (params == null) {
@@ -174,10 +174,11 @@
}
/**
- * Sets the timeout until a connection is etablished. A value of zero
- * means the timeout is not used. The default value is zero.
- *
- * @param timeout Timeout in milliseconds.
+ * Sets value of the {@link CoreConnectionPNames#CONNECTION_TIMEOUT}
+ * parameter.
+ *
+ * @param HTTP parameters.
+ * @param connect timeout.
*/
public static void setConnectionTimeout(final HttpParams params, int timeout) {
if (params == null) {
@@ -188,13 +189,11 @@
}
/**
- * Tests whether stale connection check is to be used. Disabling
- * stale connection check may result in slight performance improvement
- * at the risk of getting an I/O error when executing a request over a
- * connection that has been closed at the server side.
- *
- * @return <tt>true</tt> if stale connection check is to be used,
- * <tt>false</tt> otherwise.
+ * Obtains value of the {@link CoreConnectionPNames#STALE_CONNECTION_CHECK}
+ * parameter. If not set, defaults to <code>true</code>.
+ *
+ * @param HTTP parameters.
+ * @return stale connection check flag.
*/
public static boolean isStaleCheckingEnabled(final HttpParams params) {
if (params == null) {
@@ -205,13 +204,11 @@
}
/**
- * Defines whether stale connection check is to be used. Disabling
- * stale connection check may result in slight performance improvement
- * at the risk of getting an I/O error when executing a request over a
- * connection that has been closed at the server side.
- *
- * @param value <tt>true</tt> if stale connection check is to be used,
- * <tt>false</tt> otherwise.
+ * Sets value of the {@link CoreConnectionPNames#STALE_CONNECTION_CHECK}
+ * parameter.
+ *
+ * @param HTTP parameters.
+ * @param stale connection check flag.
*/
public static void setStaleCheckingEnabled(final HttpParams params, boolean value) {
if (params == null) {