@@ -118,6 +118,7 @@ private void setDirectoriesAndMap(Map<String, Map<String, String>> directoriesMa
118
118
String end = value == null ? null : value .get ("end" );
119
119
File tempFile = new File (temp );
120
120
if (!tempFile .exists ()) tempFile = new File (realPath , temp );
121
+ directories = new ArrayList <>();
121
122
if (tempFile .isDirectory ()) directories .add (tempFile );
122
123
else throw new IOException (temp + " is not valid directory." );
123
124
String forCheckPath = tempFile .getCanonicalPath () + FileUtils .pathSeparator ;
@@ -247,6 +248,7 @@ public void export(IFileLister<E, File> lister, IResultOutput saver, ILineProces
247
248
errorLogger .error ("process objects: {}" , lister .getName (), e );
248
249
if (e .response != null ) e .response .close ();
249
250
}
251
+ statistics .addAndGet (convertedList .size ());
250
252
}
251
253
if (hasNext ) {
252
254
json .addProperty ("start" , lister .currentEndFilepath ());
@@ -372,7 +374,7 @@ private List<File> loopForFutures(List<Future<IFileLister<E, File>>> futures) th
372
374
}
373
375
374
376
private Lock lock = new ReentrantLock ();
375
- private AtomicInteger integer = new AtomicInteger (threads );
377
+ private AtomicInteger integer = new AtomicInteger (0 );
376
378
377
379
private List <File > listForNextIteratively (List <File > directories ) throws Exception {
378
380
List <Future <IFileLister <E , File >>> futures = new ArrayList <>();
@@ -411,7 +413,7 @@ private List<File> listForNextIteratively(List<File> directories) throws Excepti
411
413
}
412
414
} catch (Exception e ) {
413
415
try { FileUtils .createIfNotExists (errorLogFile ); } catch (IOException ignored ) {}
414
- errorLogger .error ("excute lister failed" , e );
416
+ errorLogger .error ("execute lister failed" , e );
415
417
} finally {
416
418
lock .unlock ();
417
419
}
@@ -496,6 +498,7 @@ private List<IFileLister<E, File>> checkListerInPool(int cValue, int tiny) {
496
498
}
497
499
sleep (1000 );
498
500
count ++;
501
+ rootLogger .info ("finished count: {}." , statistics .get ());
499
502
}
500
503
if (notCheck ) return new ArrayList <>();
501
504
else return list ;
@@ -506,7 +509,7 @@ private void directoriesListing() throws Exception {
506
509
// directories = directories.parallelStream().map(this::directoriesFromLister).filter(Objects::nonNull)
507
510
// .reduce((list1, list2) -> { list1.addAll(list2); return list1; }).orElse(null);
508
511
// }
509
- while (directories != null && directories .size () > 0 ) directories = listForNextIteratively (directories );
512
+ while (directories .size () > 0 ) directories = listForNextIteratively (directories );
510
513
executorPool .shutdown ();
511
514
if (threads > 1 ) {
512
515
int cValue = threads >= 10 ? threads / 2 : 3 ;
@@ -557,7 +560,10 @@ private void directoriesListing() throws Exception {
557
560
list = checkListerInPool (cValue , tiny );
558
561
}
559
562
}
560
- while (!executorPool .isTerminated ()) sleep (1000 );
563
+ while (!executorPool .isTerminated ()) {
564
+ sleep (1000 );
565
+ rootLogger .info ("finished count: {}." , statistics .get ());
566
+ }
561
567
}
562
568
563
569
@ Override
0 commit comments