@@ -171,12 +171,18 @@ public void closeAllClients() {
171
171
* Sets the default timeout in milliseconds to wait for HTTPRequest responses from the server.
172
172
*
173
173
* @param timeout time in milliseconds to wait for HTTPRequests to finish.
174
+ * @param unit The unit the {@code timeout} value is represented in
174
175
*/
175
176
public void setTimeout (long timeout , TimeUnit unit ) {
176
177
this .defaultTimeoutMS = Math .min (Math .max (unit .toMillis (timeout ),HTTPRequest .MIN_TIMEOUT_MS ),
177
178
HTTPRequest .MAX_TIMEOUT_MS );
178
179
}
179
180
181
+ /**
182
+ * Checks the configured maximum connection idle time.
183
+ *
184
+ * @return The number of milliseconds until an idle connection is closed
185
+ */
180
186
public long getMaxIdleTimeout () {
181
187
return this .maxIdleTime ;
182
188
}
@@ -185,10 +191,11 @@ public long getMaxIdleTimeout() {
185
191
* Sets the max amount of time we will hold onto idle connections. A 0 means we close connections when done, less
186
192
* than zero means we will never expire connections.
187
193
*
188
- * @param it the time in milliseconds to wait before timing out a connection.
194
+ * @param idleTimeout the time in milliseconds to wait before timing out a connection.
195
+ * @param unit The unit the {@code idleTimeout} value is represented in
189
196
*/
190
- public void setMaxIdleTimeout (long it , TimeUnit unit ) {
191
- this .maxIdleTime = unit .toMillis (it );
197
+ public void setMaxIdleTimeout (long idleTimeout , TimeUnit unit ) {
198
+ this .maxIdleTime = unit .toMillis (idleTimeout );
192
199
if (this .maxIdleTime > 0 ) {
193
200
this .checkIdle = new Runnable () {
194
201
@ Override
@@ -207,7 +214,7 @@ public void run() {
207
214
* Sends a blocking HTTP request.
208
215
*
209
216
* @param url the url to send the request too.
210
- * @return an {@link HTTPResponseData} object containing the headers and content of the response.
217
+ * @return A {@link HTTPResponseData} object containing the headers and content of the response.
211
218
* @throws HTTPParsingException is thrown if the server sends back protocol or a response that is larger then allowed.
212
219
*/
213
220
public HTTPResponseData request (final URL url ) throws HTTPParsingException {
@@ -220,7 +227,7 @@ public HTTPResponseData request(final URL url) throws HTTPParsingException {
220
227
* @param url the url to send the request too.
221
228
* @param rm the {@link HTTPRequestMethod} to use on the request.
222
229
* @param bb the data to put in the body for this request.
223
- * @return an {@link HTTPResponseData} object containing the headers and content of the response.
230
+ * @return A {@link HTTPResponseData} object containing the headers and content of the response.
224
231
* @throws HTTPParsingException is thrown if the server sends back protocol or a response that is larger then allowed.
225
232
*/
226
233
public HTTPResponseData request (final URL url , final HTTPRequestMethod rm , final ByteBuffer bb ) throws HTTPParsingException {
@@ -242,12 +249,8 @@ public HTTPResponseData request(final URL url, final HTTPRequestMethod rm, final
242
249
/**
243
250
* Sends a blocking HTTP request.
244
251
*
245
- * @param ha the {@link HTTPAddress} to connect to, any hostname in the actual HTTPRequest will just be sent in the protocol.
246
252
* @param request the {@link HTTPRequest} to send the server once connected.
247
- * @param body the body to send with this request. You must have set the {@link HTTPRequest} correctly for this body.
248
- * @param unit the time unit of the timeout argument
249
- * @param timeout the maximum time to wait
250
- * @return an {@link HTTPResponseData} object containing the headers and content of the response.
253
+ * @return A {@link HTTPResponseData} object containing the headers and content of the response.
251
254
* @throws HTTPParsingException is thrown if the server sends back protocol or a response that is larger then allowed.
252
255
*/
253
256
public HTTPResponseData request (final ClientHTTPRequest request ) throws HTTPParsingException {
@@ -272,7 +275,7 @@ public HTTPResponseData request(final ClientHTTPRequest request) throws HTTPPars
272
275
* Sends an asynchronous HTTP request.
273
276
*
274
277
* @param url the {@link URL} to send the request too.
275
- * @return an {@link ListenableFuture} containing a {@link HTTPResponseData} object that will be completed when the request is finished,
278
+ * @return A {@link ListenableFuture} containing a {@link HTTPResponseData} object that will be completed when the request is finished,
276
279
* successfully or with errors.
277
280
*/
278
281
public ListenableFuture <HTTPResponseData > requestAsync (final URL url ) {
@@ -285,7 +288,7 @@ public ListenableFuture<HTTPResponseData> requestAsync(final URL url) {
285
288
* @param url the {@link URL} to send the request too.
286
289
* @param rm the {@link HTTPRequestMethod} to use on the request.
287
290
* @param bb the data to put in the body for this request.
288
- * @return an {@link ListenableFuture} containing a {@link HTTPResponseData} object that will be completed when the request is finished,
291
+ * @return A {@link ListenableFuture} containing a {@link HTTPResponseData} object that will be completed when the request is finished,
289
292
* successfully or with errors.
290
293
*/
291
294
public ListenableFuture <HTTPResponseData > requestAsync (final URL url , final HTTPRequestMethod rm ,
@@ -302,11 +305,7 @@ public ListenableFuture<HTTPResponseData> requestAsync(final URL url, final HTTP
302
305
/**
303
306
* Sends an asynchronous HTTP request.
304
307
*
305
- * @param ha the {@link HTTPAddress} to connect to, any hostname in the actual HTTPRequest will just be sent in the protocol.
306
308
* @param request the {@link HTTPRequest} to send the server once connected.
307
- * @param body the body to send with this request. You must have set the {@link HTTPRequest} correctly for this body.
308
- * @param unit the time unit of the timeout argument
309
- * @param timeout the maximum time to wait
310
309
* @return an {@link ListenableFuture} containing a {@link HTTPResponseData} object that will be completed when the request is finished,
311
310
* successfully or with errors.
312
311
*/
@@ -509,7 +508,8 @@ public void onRead(Client client) {
509
508
}
510
509
511
510
/**
512
- *
511
+ * Wrapper for the request that will handle the incoming response data (as well as notifying
512
+ * back to the client once the response is complete).
513
513
*/
514
514
private class HTTPRequestWrapper implements HTTPResponseCallback {
515
515
private final SettableListenableFuture <HTTPResponseData > slf = new SettableListenableFuture <>(false );
0 commit comments