forked from lsmyrnaios/UrlsWorker
- Reduce memory consumption when loading a zipFile.
- Check whether the "zipBatchCounter" is larger than the "totalZipBatches". - Improve the "failed tasks" log-message.
This commit is contained in:
parent
018326eedd
commit
ce49bff50e
|
@ -60,6 +60,12 @@ public class FullTextsController {
|
|||
return ResponseEntity.badRequest().body(errorMsg);
|
||||
}
|
||||
|
||||
if ( zipBatchCounter > totalZipBatches ) {
|
||||
String errorMsg = "The given \"zipBatchCounter\" (" + zipBatchCounter + ") is greater than the \"totalZipBatches\" (" + totalZipBatches + ")!";
|
||||
logger.error(errorMsg);
|
||||
return ResponseEntity.badRequest().body(errorMsg);
|
||||
}
|
||||
|
||||
File zipFile = FilesZipper.zipMultipleFilesAndGetZip(assignmentsCounter, zipBatchCounter, fileNamesWithExtensions, currentAssignmentsBaseFullTextsPath);
|
||||
if ( zipFile == null ) {
|
||||
String errorMsg = "Failed to create the zip file for \"zipBatchCounter\"-" + zipBatchCounter;
|
||||
|
|
|
@ -127,7 +127,7 @@ public class PublicationsRetrieverPlugin {
|
|||
|
||||
int numFailedTasks = LoaderAndChecker.invokeAllTasksAndWait(callableTasks);
|
||||
if ( numFailedTasks > 0 )
|
||||
logger.warn(numFailedTasks + " tasks failed!");
|
||||
logger.warn(numFailedTasks + " tasks failed, from assignments_" + assignmentRequestCounter);
|
||||
addUrlReportsToWorkerReport();
|
||||
callableTasks.clear(); // Reset the thread-tasks-list for the next batch.
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ public class FileStorageService {
|
|||
}
|
||||
|
||||
|
||||
private static final int bufferSize = 20971520;
|
||||
private static final int bufferSize = 10485760; // 10 MB
|
||||
public ByteArrayOutputStream loadFileAsAStream(String fullFileName)
|
||||
{
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bufferSize); // 20 MB
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bufferSize);
|
||||
try {
|
||||
FileInputStream fileInputStream = new FileInputStream(fullFileName);
|
||||
int bytesRead;
|
||||
|
|
Loading…
Reference in New Issue