41 |
|
|
42 |
ThreadPoolExecutor threadPool; |
ThreadPoolExecutor threadPool; |
43 |
|
|
44 |
|
boolean isIncremental; |
45 |
|
String type; |
46 |
|
|
47 |
|
|
48 |
public AfstandAndenRuteTask(String distributor) { |
public AfstandAndenRuteTask(String distributor, String type) { |
49 |
this.distributor = distributor; |
this.distributor = distributor; |
50 |
|
this.type = type; |
51 |
|
|
52 |
|
type = type.toUpperCase(); |
53 |
|
switch(type) { |
54 |
|
case "FULL": |
55 |
|
isIncremental = false; |
56 |
|
break; |
57 |
|
case "INCREMENTAL": |
58 |
|
isIncremental = true; |
59 |
|
break; |
60 |
|
default: |
61 |
|
throw new RuntimeException("Unknown type" + type); |
62 |
|
} |
63 |
} |
} |
64 |
|
|
65 |
|
|
66 |
@Override |
@Override |
67 |
protected void taskRun() throws Exception { |
protected void taskRun() throws Exception { |
68 |
|
|
|
|
|
|
|
|
|
|
|
|
//Setup j.u.l Logger |
|
|
//Logger root = Logger.getLogger(""); |
|
|
//FileHandler fhandler = new FileHandler("fulddaekning.log"); // Ingen max størrelse, ingen rotation og ingen append |
|
|
//fhandler.setFormatter( new SimpleFormatter() ); |
|
|
//root.addHandler( fhandler ); |
|
|
|
|
|
|
|
69 |
|
|
70 |
Constants.init(distributor); |
Constants.init(distributor); |
71 |
Constants consts = Constants.getInstance(); |
Constants consts = Constants.getInstance(); |
84 |
} |
} |
85 |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
logger.info("Starting with MAX_WORKERS:" + max_workers); |
86 |
setupThreadPool(max_workers); |
setupThreadPool(max_workers); |
87 |
|
|
88 |
|
logger.info("Starting with INCREMENTAL:" + isIncremental); |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
try (Connection conn = DBConnection.getConnection() ) { |
try (Connection conn = DBConnection.getConnection() ) { |
93 |
Database db = new Database(conn); |
Database db = new Database(conn, isIncremental); |
94 |
|
|
95 |
|
db.prepareIncrementalSearch(); |
96 |
|
|
97 |
Queue<Address> ikkeDaekkede = db.hentAlleIkkedaekkedeAdresser(consts.getMinPostnr(), consts.getMaxPostnr() ); |
Queue<Address> ikkeDaekkede = db.hentAlleIkkedaekkedeAdresser(consts.getMinPostnr(), consts.getMaxPostnr() ); |
98 |
antalIkkeDaekkede = ikkeDaekkede.size(); |
antalIkkeDaekkede = ikkeDaekkede.size(); |
249 |
|
|
250 |
@Override |
@Override |
251 |
public String getDetail() { |
public String getDetail() { |
252 |
// TODO Auto-generated method stub |
if (isIncremental) { |
253 |
return ""; |
return "Type: incremental"; |
254 |
|
} else { |
255 |
|
return "Type: full"; |
256 |
|
} |
257 |
} |
} |
258 |
|
|
259 |
|
|