Logging every 5% elaborated rows when the total number is greatest than 100000

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-aggregator-se-plugin@163325 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2018-02-15 17:45:41 +00:00
parent 1b67851978
commit c9d6c39777
1 changed files with 8 additions and 2 deletions

View File

@ -25,6 +25,8 @@ public abstract class DocumentElaboration {
protected static final String ID = Record.ID;
protected static final int THRESHOLD_FOR_FIVE_PERCENT = 100000;
protected final AggregationStatus aggregationStatus;
protected final File file;
protected final Bucket bucket;
@ -52,7 +54,11 @@ public abstract class DocumentElaboration {
logger.info("{} - Going to elaborate {} rows", aggregationStatus.getAggregationInfo(), rowToBeElaborated);
int tenPercentOfNumberOfRows = (rowToBeElaborated/10)+1;
int percentOfNumberOfRows = (rowToBeElaborated/10)+1;
if(rowToBeElaborated>=THRESHOLD_FOR_FIVE_PERCENT) {
percentOfNumberOfRows = percentOfNumberOfRows/2;
}
int elaborated = 0;
String line;
@ -60,7 +66,7 @@ public abstract class DocumentElaboration {
while ((line = br.readLine()) != null) {
elaborateLine(line);
++elaborated;
if(elaborated % tenPercentOfNumberOfRows == 0){
if(elaborated % percentOfNumberOfRows == 0){
int elaboratedPercentage = elaborated*100/rowToBeElaborated;
logger.info("{} - Elaborated {} rows of {} (about {}%)", aggregationStatus.getAggregationInfo(), elaborated, rowToBeElaborated, elaboratedPercentage);
}