From c9d6c397774215e501e80a5fd51a159386147559 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 15 Feb 2018 17:45:41 +0000 Subject: [PATCH] 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 --- .../aggregator/persist/DocumentElaboration.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java b/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java index 6c69096..b5dfce5 100644 --- a/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java +++ b/src/main/java/org/gcube/accounting/aggregator/persist/DocumentElaboration.java @@ -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); }