Revision 42170
Added by Sandro La Bruzzo about 8 years ago
DownloadServiceFeeder.java | ||
---|---|---|
16 | 16 |
import eu.dnetlib.data.objectstore.worker.DownloadWorker; |
17 | 17 |
import eu.dnetlib.enabling.resultset.client.ResultSetClient; |
18 | 18 |
import eu.dnetlib.rmi.common.ResultSet; |
19 |
import eu.dnetlib.rmi.data.*; |
|
19 |
import eu.dnetlib.rmi.data.DownloadItem; |
|
20 |
import eu.dnetlib.rmi.data.DownloadPlugin; |
|
21 |
import eu.dnetlib.rmi.data.ObjectStoreServiceException; |
|
22 |
import eu.dnetlib.rmi.data.Protocols; |
|
20 | 23 |
import org.apache.commons.logging.Log; |
21 | 24 |
import org.apache.commons.logging.LogFactory; |
22 | 25 |
import org.springframework.beans.factory.annotation.Autowired; |
... | ... | |
72 | 75 |
* @param protocol the protocol used to download the file |
73 | 76 |
* @param mimeType the mime type of the Files |
74 | 77 |
* @param numberOfThreads the number of threads to use for download at the same time |
75 |
* @throws DownloadServiceException the download service exception |
|
76 | 78 |
* @throws ObjectStoreServiceException |
77 | 79 |
*/ |
78 | 80 |
public DownloadReportMap download(final String epr, |
... | ... | |
84 | 86 |
final String basePath, |
85 | 87 |
final List<String> regularExpression, |
86 | 88 |
final int connectTimeoutMs, |
87 |
final int readTimeoutMs, final int sleepTimeMs) throws DownloadServiceException, ObjectStoreServiceException {
|
|
89 |
final int readTimeoutMs, final int sleepTimeMs) throws ObjectStoreServiceException { |
|
88 | 90 |
final DownloadPlugin downloadPlugin = downloadPluginEnumerator.get(plugin); |
89 | 91 |
if ((basePath != null) && (basePath.isEmpty() == false)) { |
90 | 92 |
downloadPlugin.setBasePath(basePath); |
91 | 93 |
} |
92 | 94 |
|
93 | 95 |
final Iterable<String> urlInfo = resultSetClient.iter(ResultSet.fromJson(epr), String.class); |
94 |
final BlockingQueue<String> itemsQueue = Queues.newArrayBlockingQueue(1024);
|
|
96 |
final BlockingQueue<String> itemsQueue = Queues.newArrayBlockingQueue(numberOfThreads * 5);
|
|
95 | 97 |
final ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads); |
96 | 98 |
final ObjectStore objStore = objectStoreDao.getObjectStore(objectStoreID); |
97 | 99 |
|
Also available in: Unified diff
fixed download into gridfs