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 2009/07/13 20:11:27 UTC
svn commit: r793643 - in /httpcomponents/httpcore/trunk:
httpcore-nio/src/main/java/org/apache/http/impl/nio/
httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/
httpcore-nio/src/main/java/org/apache/http/nio/params/
httpcore/src/main/java/org...
Author: olegk
Date: Mon Jul 13 18:11:27 2009
New Revision: 793643
URL: http://svn.apache.org/viewvc?rev=793643&view=rev
Log:
Javadoc cleanups for 4.1-alpha1 release
Modified:
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java
httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java
httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/NHttpConnectionBase.java Mon Jul 13 18:11:27 2009
@@ -203,7 +203,7 @@
protected HttpEntity prepareDecoder(final HttpMessage message) throws HttpException {
BasicHttpEntity entity = new BasicHttpEntity();
long len = this.incomingContentStrategy.determineLength(message);
- this.contentDecoder = createChunkDecoder(
+ this.contentDecoder = createContentDecoder(
len,
this.session.channel(),
this.inbuf,
@@ -233,8 +233,6 @@
/**
* Factory method for {@link ContentDecoder} instances.
*
- * @since 4.1
- *
* @param len content length, if known, {@link ContentLengthStrategy#CHUNKED} or
* {@link ContentLengthStrategy#IDENTITY}, if unknown.
* @param channel the session channel.
@@ -242,8 +240,10 @@
* @param metrics transport metrics.
*
* @return content decoder.
+ *
+ * @since 4.1
*/
- protected ContentDecoder createChunkDecoder(
+ protected ContentDecoder createContentDecoder(
final long len,
final ReadableByteChannel channel,
final SessionInputBuffer buffer,
@@ -276,8 +276,6 @@
/**
* Factory method for {@link ContentEncoder} instances.
*
- * @since 4.1
- *
* @param len content length, if known, {@link ContentLengthStrategy#CHUNKED} or
* {@link ContentLengthStrategy#IDENTITY}, if unknown.
* @param channel the session channel.
@@ -285,6 +283,8 @@
* @param metrics transport metrics.
*
* @return content encoder.
+ *
+ * @since 4.1
*/
protected ContentEncoder createContentEncoder(
final long len,
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java Mon Jul 13 18:11:27 2009
@@ -89,6 +89,8 @@
* @param interestOpsQueueing Ops queueing flag.
*
* @throws IOReactorException in case if a non-recoverable I/O error.
+ *
+ * @since 4.1
*/
public AbstractIOReactor(long selectTimeout, boolean interestOpsQueueing) throws IOReactorException {
super();
@@ -203,6 +205,8 @@
/**
* Returns <code>true</code> if interest Ops queueing is enabled, <code>false</code> otherwise.
+ *
+ * @since 4.1
*/
public boolean getInterestOpsQueueing() {
return this.interestOpsQueueing;
@@ -359,7 +363,6 @@
}
}
-
private void processNewChannels() throws IOReactorException {
ChannelEntry entry;
while ((entry = this.newChannels.poll()) != null) {
@@ -442,10 +445,6 @@
}
}
- /**
- Processes all pending {@link java.nio.channels.SelectionKey#interestOps(int) interestOps(int)}
- operations.
- */
private void processPendingInterestOps() {
// validity check
if (!this.interestOpsQueueing) {
@@ -466,6 +465,31 @@
}
}
+ /**
+ * Adds an {@link InterestOpEntry} to the interest ops queue for this instance.
+ *
+ * @return <code>true</code> if the operation could be performed successfully,
+ * <code>false</code> otherwise.
+ *
+ * @since 4.1
+ */
+ protected boolean queueInterestOps(final InterestOpEntry entry) {
+ // validity checks
+ if (!this.interestOpsQueueing) {
+ throw new IllegalStateException("Interest ops queueing not enabled");
+ }
+ if (entry == null) {
+ return false;
+ }
+
+ synchronized (this.interestOpsQueue) {
+ // add this operation to the interestOps() queue
+ this.interestOpsQueue.add(entry);
+ }
+
+ return true;
+ }
+
/**
* Closes out all I/O sessions maintained by this I/O reactor.
*/
@@ -586,27 +610,4 @@
shutdown(1000);
}
- /**
- * Adds an {@link InterestOpEntry} to the interest ops queue for this instance.
- *
- * @return <code>true</code> if the operation could be performed successfully,
- * <code>false</code> otherwise.
- */
- protected boolean queueInterestOps(final InterestOpEntry entry) {
- // validity checks
- if (!this.interestOpsQueueing) {
- throw new IllegalStateException("Interest ops queueing not enabled");
- }
- if (entry == null) {
- return false;
- }
-
- synchronized (this.interestOpsQueue) {
- // add this operation to the interestOps() queue
- this.interestOpsQueue.add(entry);
- }
-
- return true;
- }
-
}
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java Mon Jul 13 18:11:27 2009
@@ -80,8 +80,11 @@
* @param interestOpsQueueing Ops queueing flag.
*
* @throws IOReactorException in case if a non-recoverable I/O error.
+ *
+ * @since 4.1
*/
- public BaseIOReactor(long selectTimeout, boolean interestOpsQueueing) throws IOReactorException {
+ public BaseIOReactor(
+ long selectTimeout, boolean interestOpsQueueing) throws IOReactorException {
super(selectTimeout, interestOpsQueueing);
this.bufferingSessions = new HashSet<IOSession>();
this.timeoutCheckInterval = selectTimeout;
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java Mon Jul 13 18:11:27 2009
@@ -63,6 +63,15 @@
private int socketTimeout;
private volatile int currentEventMask;
+ /**
+ * Creates new instance of IOSessionImpl.
+ *
+ * @param key the selection key.
+ * @param interestOpsCallback interestOps callback.
+ * @param sessionClosedCallback session closed callback.
+ *
+ * @since 4.1
+ */
public IOSessionImpl(
final SelectionKey key,
final InterestOpsCallback interestOpsCallback,
@@ -81,6 +90,12 @@
this.status = ACTIVE;
}
+ /**
+ * Creates new instance of IOSessionImpl.
+ *
+ * @param key the selection key.
+ * @param sessionClosedCallback session closed callback.
+ */
public IOSessionImpl(
final SelectionKey key,
final SessionClosedCallback sessionClosedCallback) {
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/InterestOpEntry.java Mon Jul 13 18:11:27 2009
@@ -36,6 +36,8 @@
/**
* Helper class, representing an entry on an {@link java.nio.channels.SelectionKey#interestOps(int)
* interestOps(int)} queue.
+ *
+ * @since 4.1
*/
public class InterestOpEntry {
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorPNames.java Mon Jul 13 18:11:27 2009
@@ -70,6 +70,8 @@
* <p>
* This parameter expects a value of type {@link Boolean}.
* </p>
+ *
+ * @since 4.1
*/
public static final String INTEREST_OPS_QUEUEING = "http.nio.interest-ops-queueing";
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/nio/params/NIOReactorParams.java Mon Jul 13 18:11:27 2009
@@ -46,13 +46,26 @@
super();
}
+ /**
+ * Obtains the value of {@link NIOReactorPNames#CONTENT_BUFFER_SIZE} parameter.
+ * If not set, defaults to <code>4096</code>.
+ *
+ * @param params HTTP parameters.
+ * @return content buffer size.
+ */
public static int getContentBufferSize(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
- return params.getIntParameter(CONTENT_BUFFER_SIZE, 1024);
+ return params.getIntParameter(CONTENT_BUFFER_SIZE, 4096);
}
+ /**
+ * Sets value of the {@link NIOReactorPNames#CONTENT_BUFFER_SIZE} parameter.
+ *
+ * @param params HTTP parameters.
+ * @param size content buffer size.
+ */
public static void setContentBufferSize(final HttpParams params, int size) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -60,6 +73,13 @@
params.setIntParameter(CONTENT_BUFFER_SIZE, size);
}
+ /**
+ * Obtains the value of {@link NIOReactorPNames#SELECT_INTERVAL} parameter.
+ * If not set, defaults to <code>1000</code>.
+ *
+ * @param params HTTP parameters.
+ * @return I/O select interval in milliseconds.
+ */
public static long getSelectInterval(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -67,6 +87,12 @@
return params.getLongParameter(SELECT_INTERVAL, 1000);
}
+ /**
+ * Sets value of the {@link NIOReactorPNames#SELECT_INTERVAL} parameter.
+ *
+ * @param params HTTP parameters.
+ * @param ms I/O select interval in milliseconds.
+ */
public static void setSelectInterval(final HttpParams params, long ms) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -74,6 +100,13 @@
params.setLongParameter(SELECT_INTERVAL, ms);
}
+ /**
+ * Obtains the value of {@link NIOReactorPNames#GRACE_PERIOD} parameter.
+ * If not set, defaults to <code>500</code>.
+ *
+ * @param params HTTP parameters.
+ * @return shutdown grace period in milliseconds.
+ */
public static long getGracePeriod(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -81,6 +114,12 @@
return params.getLongParameter(GRACE_PERIOD, 500);
}
+ /**
+ * Sets value of the {@link NIOReactorPNames#GRACE_PERIOD} parameter.
+ *
+ * @param params HTTP parameters.
+ * @param ms shutdown grace period in milliseconds.
+ */
public static void setGracePeriod(final HttpParams params, long ms) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -88,6 +127,15 @@
params.setLongParameter(GRACE_PERIOD, ms);
}
+ /**
+ * Obtains the value of {@link NIOReactorPNames#INTEREST_OPS_QUEUEING} parameter.
+ * If not set, defaults to <code>false</code>.
+ *
+ * @param params HTTP parameters.
+ * @return interest ops queuing flag.
+ *
+ * @since 4.1
+ */
public static boolean getInterestOpsQueueing(final HttpParams params) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
@@ -95,7 +143,16 @@
return params.getBooleanParameter(INTEREST_OPS_QUEUEING, false);
}
- public static void setInterestOpsQueueing(final HttpParams params, boolean interestOpsQueueing) {
+ /**
+ * Sets value of the {@link NIOReactorPNames#INTEREST_OPS_QUEUEING} parameter.
+ *
+ * @param params HTTP parameters.
+ * @param interestOpsQueueing interest ops queuing.
+ *
+ * @since 4.1
+ */
+ public static void setInterestOpsQueueing(
+ final HttpParams params, boolean interestOpsQueueing) {
if (params == null) {
throw new IllegalArgumentException("HTTP parameters may not be null");
}
Modified: httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java?rev=793643&r1=793642&r2=793643&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java (original)
+++ httpcomponents/httpcore/trunk/httpcore/src/main/java/org/apache/http/impl/io/AbstractMessageParser.java Mon Jul 13 18:11:27 2009
@@ -156,6 +156,8 @@
*
* @throws IOException in case of an I/O error
* @throws HttpException in case of HTTP protocol violation
+ *
+ * @since 4.1
*/
public static Header[] parseHeaders(
final SessionInputBuffer inbuffer,