public class JdkHttpDownloader extends Object implements DownloaderService
| Constructor and Description |
|---|
JdkHttpDownloader(int maxConns,
int connectTimeout,
int readTimeout,
long poolThreadLivingTime,
Proxy proxy) |
| Modifier and Type | Method and Description |
|---|---|
<T> Future<T> |
download(DownloadTask<T> task,
DownloadCallback<T> callback)
Submits a download task asynchronously.
|
<T> Future<T> |
download(DownloadTask<T> downloadTask,
DownloadCallback<T> callback,
int tries)
Submits a download task asynchronously.
|
boolean |
isShutdown()
Returns true if this executor has been shutdown.
|
void |
shutdown()
Shutdown the executor.
|
public JdkHttpDownloader(int maxConns,
int connectTimeout,
int readTimeout,
long poolThreadLivingTime,
Proxy proxy)
public <T> Future<T> download(DownloadTask<T> task, DownloadCallback<T> callback)
Downloaderdownload in interface DownloaderT - the result of the tasktask - the download taskcallback - download callbackpublic <T> Future<T> download(DownloadTask<T> downloadTask, DownloadCallback<T> callback, int tries)
Downloader
The task will be retried only when an IOException occurs.
tries is the max number of tries. For example: If tries==1, the download won't be
retried
(try 1 time, retry 0 time); If tries==5, the download will be retried at most 4 times.
download in interface DownloaderT - the result of the taskdownloadTask - the download taskcallback - download callbacktries - the max number of triespublic void shutdown()
Shutdownableshutdown in interface Shutdownablepublic boolean isShutdown()
ShutdownableisShutdown in interface ShutdownableCopyright © 2016. All rights reserved.