multithreading - Periodically dump the content of a map to a file in java -


i have 2 json files contain on 1 million objects .

i have compare each object both files , write file if there diff object. (each object identified key , key written file).

currently using executorservice , doing comparisons using multiple threads , writing mismatches common concurrenthashmap.

the map dumped file in end .

i update file periodically rather waiting entire execution complete.

in case if wish write file once in every 2 minutes, how can achieve this.

i familiar done using thread not understand how implement along executorservice.

scheduledexecutorservice executor = executors.newsinglethreadscheduledexecutor(); executor.scheduleatfixedrate(() -> {     // code execute every 2 minutes }, 0, 2, timeunit.minutes); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -