Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java @ 1970:368040e5c400
Improved the Scheduler to be able to cancel running WSPLGEN jobs.
flys-artifacts/trunk@3384 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 12 Dec 2011 08:15:12 +0000 |
parents | ccf2235035d6 |
children | cbeeaaad1056 |
comparison
equal
deleted
inserted
replaced
1969:baefcfba97aa | 1970:368040e5c400 |
---|---|
21 import org.geotools.feature.FeatureCollections; | 21 import org.geotools.feature.FeatureCollections; |
22 import org.geotools.feature.simple.SimpleFeatureBuilder; | 22 import org.geotools.feature.simple.SimpleFeatureBuilder; |
23 | 23 |
24 import de.intevation.artifacts.Artifact; | 24 import de.intevation.artifacts.Artifact; |
25 import de.intevation.artifacts.CallContext; | 25 import de.intevation.artifacts.CallContext; |
26 import de.intevation.artifacts.GlobalContext; | |
26 | 27 |
27 import de.intevation.artifacts.common.utils.FileTools; | 28 import de.intevation.artifacts.common.utils.FileTools; |
28 | 29 |
29 import de.intevation.artifactdatabase.state.Facet; | 30 import de.intevation.artifactdatabase.state.Facet; |
30 | 31 |
32 import de.intevation.flys.model.DGM; | 33 import de.intevation.flys.model.DGM; |
33 import de.intevation.flys.model.Floodplain; | 34 import de.intevation.flys.model.Floodplain; |
34 import de.intevation.flys.model.RiverAxis; | 35 import de.intevation.flys.model.RiverAxis; |
35 | 36 |
36 import de.intevation.flys.artifacts.FLYSArtifact; | 37 import de.intevation.flys.artifacts.FLYSArtifact; |
38 import de.intevation.flys.artifacts.context.FLYSContext; | |
37 import de.intevation.flys.artifacts.model.CalculationMessage; | 39 import de.intevation.flys.artifacts.model.CalculationMessage; |
38 import de.intevation.flys.artifacts.model.CalculationResult; | 40 import de.intevation.flys.artifacts.model.CalculationResult; |
39 import de.intevation.flys.artifacts.model.FacetTypes; | 41 import de.intevation.flys.artifacts.model.FacetTypes; |
40 import de.intevation.flys.artifacts.model.WQKms; | 42 import de.intevation.flys.artifacts.model.WQKms; |
41 import de.intevation.flys.artifacts.model.WSPLGENCalculation; | 43 import de.intevation.flys.artifacts.model.WSPLGENCalculation; |
139 context.getMeta(), | 141 context.getMeta(), |
140 "wsplgen.job.queued", | 142 "wsplgen.job.queued", |
141 "wsplgen.job.queued") | 143 "wsplgen.job.queued") |
142 )); | 144 )); |
143 | 145 |
144 Scheduler scheduler = Scheduler.getInstance(); | 146 GlobalContext gc = (GlobalContext) context.globalContext(); |
147 Scheduler scheduler = (Scheduler) gc.get(FLYSContext.SCHEDULER); | |
145 scheduler.addJob(job); | 148 scheduler.addJob(job); |
146 | 149 |
147 return null; | 150 return null; |
148 } | 151 } |
149 | 152 |
191 public void endOfLife(Artifact artifact, Object callContext) { | 194 public void endOfLife(Artifact artifact, Object callContext) { |
192 logger.info("FloodMapState.endOfLife: " + artifact.identifier()); | 195 logger.info("FloodMapState.endOfLife: " + artifact.identifier()); |
193 | 196 |
194 FLYSArtifact flys = (FLYSArtifact) artifact; | 197 FLYSArtifact flys = (FLYSArtifact) artifact; |
195 removeDirectory(flys); | 198 removeDirectory(flys); |
199 | |
200 Scheduler scheduler = Scheduler.getInstance(); | |
201 scheduler.cancelJob(flys.identifier()); | |
196 | 202 |
197 MapfileGenerator.getInstance().update(); | 203 MapfileGenerator.getInstance().update(); |
198 } | 204 } |
199 | 205 |
200 | 206 |