mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
commit
915b2969a3
1 changed files with 9 additions and 1 deletions
|
|
@ -629,13 +629,21 @@ public class Jsprit {
|
|||
});
|
||||
}
|
||||
if (es != null) {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
final Thread hook = new Thread() {
|
||||
public void run() {
|
||||
if (!es.isShutdown()) {
|
||||
System.err.println("shutdowHook shuts down executorService");
|
||||
es.shutdown();
|
||||
}
|
||||
}
|
||||
};
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
vra.addListener(new AlgorithmEndsListener() {
|
||||
@Override
|
||||
public void informAlgorithmEnds(VehicleRoutingProblem aProblem,
|
||||
Collection<VehicleRoutingProblemSolution> aSolutions) {
|
||||
Runtime.getRuntime().removeShutdownHook(hook);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue