Changeset 7474
- Timestamp:
- Apr 12, 2018, 10:33:31 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.12-stable/src/plugins/core/net/sf/basedb/plugins/AnnotationFlatFileImporter.java
r7204 r7474 643 643 private int numRemoved; 644 644 private ProgressReporter progress; 645 // Percentages will be adjusted based on number of annotations 646 private int progressParser = 50; // Progress percentage for file-parsing 647 private int progressDatabase = 48; // Progress percentage for database update 645 648 646 649 @Override … … 761 764 ++i; 762 765 } 766 767 // Recalculate progress parts so that the file parsing is between 10-50% depedning on number of annotations 768 int dbPart = (1 + mappers.size() % 20); 769 progressParser = Math.max(100 / (1+dbPart), 10); 770 progressDatabase = 98 - progressParser; 771 763 772 batcher = new AnnotationBatcher(dc, itemType); 764 773 batcher.addAnnotationTypes(mappers.values()); … … 948 957 for (Set<NewAnnotations> n : itemCache.values()) 949 958 { 950 if (progress != null && current % 100 == 0) 951 { 952 progress.display(50 + (48 * current) / total, "Saving to database (" + current + " of " + total + " items done)..."); 959 // progressParser should be between 10-50 and is a good interval for progress reporting 960 if (progress != null && current % progressParser == 0) 961 { 962 progress.display(progressParser + (progressDatabase * current) / total, "Saving to database (" + current + " of " + total + " items done)..."); 953 963 } 954 964 current++; … … 996 1006 /** 997 1007 Overriding default implementation since we want file parsing to 998 only use 50% and the remaining 50% for storing to the database. 1008 only use 'progressParser'% and the remaining 'progressDatabase'% 1009 for storing to the database. 999 1010 */ 1000 1011 @Override 1001 1012 protected int getProgress(FlatFileParser ffp) 1002 1013 { 1003 return super.getProgress(ffp) * 50 / 100; 1014 if (ffp.getParsedDataLines() == 0) return 0; 1015 return super.getProgress(ffp) * progressParser / 100; 1004 1016 } 1005 1017 // -------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.