Commit 15c9b2cb authored by Daniel Le Berre's avatar Daniel Le Berre

Fixed handling of Interrupted Exception with

Thread.currentThread().interrupt().
parent e6e2bd59
...@@ -360,6 +360,7 @@ public class ManyCore<S extends ISolver> ...@@ -360,6 +360,7 @@ public class ManyCore<S extends ISolver>
} while (this.remainingSolvers.get() > 0); } while (this.remainingSolvers.get() > 0);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// will happen when one solver found a solution // will happen when one solver found a solution
Thread.currentThread().interrupt();
} }
if (!this.solved) { if (!this.solved) {
assert this.remainingSolvers.get() == 0; assert this.remainingSolvers.get() == 0;
......
...@@ -58,7 +58,7 @@ public abstract class AbstractLinMultiObjOptimizer extends PseudoOptDecorator ...@@ -58,7 +58,7 @@ public abstract class AbstractLinMultiObjOptimizer extends PseudoOptDecorator
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
protected final List<ObjectiveFunction> objs = new ArrayList<ObjectiveFunction>(); protected final transient List<ObjectiveFunction> objs = new ArrayList<ObjectiveFunction>();
protected boolean initConstraintsSet = false; protected boolean initConstraintsSet = false;
...@@ -106,9 +106,9 @@ public abstract class AbstractLinMultiObjOptimizer extends PseudoOptDecorator ...@@ -106,9 +106,9 @@ public abstract class AbstractLinMultiObjOptimizer extends PseudoOptDecorator
} }
boolean res = super.admitABetterSolution(assumps); boolean res = super.admitABetterSolution(assumps);
if (res && isVerbose()) { if (res && isVerbose()) {
System.out.println(getLogPrefix() System.out.println(
+ "Current objective functions values: " getLogPrefix() + "Current objective functions values: "
+ Arrays.toString(getObjectiveValues())); + Arrays.toString(getObjectiveValues()));
} }
return res; return res;
} }
......
...@@ -96,7 +96,7 @@ public class CriterionOptimumComputer<S extends IPBSolver> { ...@@ -96,7 +96,7 @@ public class CriterionOptimumComputer<S extends IPBSolver> {
try { try {
this.lock.acquire(); this.lock.acquire();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); Thread.currentThread().interrupt();
} }
} }
} }
...@@ -127,12 +127,17 @@ public class CriterionOptimumComputer<S extends IPBSolver> { ...@@ -127,12 +127,17 @@ public class CriterionOptimumComputer<S extends IPBSolver> {
try { try {
this.lock.acquire(this.objs.size()); this.lock.acquire(this.objs.size());
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); Thread.currentThread().interrupt();
} }
} }
class OptimumValueWriter implements SolutionFoundListener { class OptimumValueWriter implements SolutionFoundListener {
/**
*
*/
private static final long serialVersionUID = 1L;
private final CriterionOptimumComputer<S> coc; private final CriterionOptimumComputer<S> coc;
private final int solverIndex; private final int solverIndex;
......
...@@ -225,6 +225,7 @@ public class RemoteControlStrategy implements RestartStrategy, ...@@ -225,6 +225,7 @@ public class RemoteControlStrategy implements RestartStrategy,
Thread.sleep(SLEEP_TIME); Thread.sleep(SLEEP_TIME);
} catch (InterruptedException e) { } catch (InterruptedException e) {
logger.log(e.getMessage()); logger.log(e.getMessage());
Thread.currentThread().interrupt();
} }
} }
this.phaseSelectionStrategy.assignLiteral(p); this.phaseSelectionStrategy.assignLiteral(p);
......
...@@ -335,6 +335,7 @@ public class GnuplotBasedSolverVisualisation implements SolverVisualisation { ...@@ -335,6 +335,7 @@ public class GnuplotBasedSolverVisualisation implements SolverVisualisation {
} catch (InterruptedException e) { } catch (InterruptedException e) {
GnuplotBasedSolverVisualisation.this.logger GnuplotBasedSolverVisualisation.this.logger
.log(e.getMessage()); .log(e.getMessage());
Thread.currentThread().interrupt();
} }
GnuplotBasedSolverVisualisation.this.logger GnuplotBasedSolverVisualisation.this.logger
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment