7 |
import java.util.Queue; |
import java.util.Queue; |
8 |
import java.util.Set; |
import java.util.Set; |
9 |
import java.util.concurrent.CyclicBarrier; |
import java.util.concurrent.CyclicBarrier; |
10 |
|
import java.util.concurrent.ExecutorService; |
11 |
import java.util.concurrent.Executors; |
import java.util.concurrent.Executors; |
12 |
import java.util.concurrent.ThreadFactory; |
import java.util.concurrent.ThreadFactory; |
|
import java.util.concurrent.ThreadPoolExecutor; |
|
13 |
import java.util.concurrent.atomic.AtomicInteger; |
import java.util.concurrent.atomic.AtomicInteger; |
14 |
|
|
15 |
import ags.utils.dataStructures.trees.thirdGenKD.KdTree; |
import ags.utils.dataStructures.trees.thirdGenKD.KdTree; |
16 |
import dk.daoas.adressevedligehold.ReloadHelper; |
import dk.daoas.adressevedligehold.ReloadTask; |
17 |
import dk.daoas.adressevedligehold.ServiceConfig; |
import dk.daoas.adressevedligehold.ServiceConfig; |
18 |
import dk.daoas.adressevedligehold.beans.Address; |
import dk.daoas.adressevedligehold.beans.Address; |
19 |
import dk.daoas.adressevedligehold.db.DBConnection; |
import dk.daoas.adressevedligehold.db.DBConnection; |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
ThreadPoolExecutor threadPool; |
ExecutorService threadPool; |
47 |
|
|
48 |
boolean isIncremental; |
boolean isIncremental; |
49 |
|
|
85 |
max_workers = 1; |
max_workers = 1; |
86 |
} |
} |
87 |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
88 |
setupThreadPool(max_workers); |
|
89 |
|
threadPool = Executors.newFixedThreadPool(max_workers, new WorkerThreadFactory() ); |
90 |
|
|
91 |
logger.info("Starting with INCREMENTAL:" + isIncremental); |
logger.info("Starting with INCREMENTAL:" + isIncremental); |
92 |
|
|
121 |
// END OF MAIN run |
// END OF MAIN run |
122 |
|
|
123 |
threadPool.shutdown(); //Calc is done now |
threadPool.shutdown(); //Calc is done now |
124 |
|
threadPool = null;//release early for GC |
125 |
|
|
126 |
|
|
127 |
|
manager.submitTask( new ReloadTask("AfstandAndenRute/" + distributor) ); |
128 |
|
|
129 |
|
|
130 |
long now = System.currentTimeMillis(); |
long now = System.currentTimeMillis(); |
131 |
long elapsed = now - start ; |
long elapsed = now - start ; |
216 |
db.saveBatch(); |
db.saveBatch(); |
217 |
|
|
218 |
if (test_mode == false && this.isAborted() == false) { |
if (test_mode == false && this.isAborted() == false) { |
219 |
db.renameResultTables(); |
db.renameResultTables(); |
|
|
|
|
ReloadHelper.triggerReload( "AfstandAndenRute/" + distributor ); |
|
220 |
|
|
221 |
|
|
222 |
} else { |
} else { |
237 |
return String.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, mseconds); |
return String.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, mseconds); |
238 |
} |
} |
239 |
|
|
|
private void setupThreadPool(int max_workers) { |
|
|
threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(max_workers, new WorkerThreadFactory() ); |
|
|
} |
|
240 |
|
|
241 |
static class WorkerThreadFactory implements ThreadFactory { |
static class WorkerThreadFactory implements ThreadFactory { |
242 |
int count = 0; |
int count = 0; |