@Test public void startWithFailure() { runnableBase.start(solution); Assertions.assertThatThrownBy(() -> runnableBase.start(solution)) .hasMessage("SolverExecutor start method can only be invoked when the status is STOPPED"); }
public void start(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new SolverExecutorException("SolverExecutor start method can only be invoked when the status is STOPPED"); } this.solution = solution; try { this.solver = buildSolver(solverDef, registry); } catch (Exception e) { status.set(STOPPED); throw new SolverExecutorException(e.getMessage(), e); } solver.addEventListener(event -> { if (isAlive() && isStarted()) { eventListener.bestSolutionChanged(event); } }); startPermit.release(); }
SolverExecutor extends RunnableBase { public void start(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new SolverExecutorException("SolverExecutor start method can only be invoked when the status is STOPPED"); } this.solution = solution; try { this.solver = buildSolver(solverDef, registry); } catch (Exception e) { status.set(STOPPED); throw new SolverExecutorException(e.getMessage(), e); } solver.addEventListener(event -> { if (isAlive() && isStarted()) { eventListener.bestSolutionChanged(event); } }); startPermit.release(); } }
SolverExecutor extends RunnableBase { public void start(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new SolverExecutorException("SolverExecutor start method can only be invoked when the status is STOPPED"); } this.solution = solution; try { this.solver = buildSolver(solverDef, registry); } catch (Exception e) { status.set(STOPPED); throw new SolverExecutorException(e.getMessage(), e); } solver.addEventListener(event -> { if (isAlive() && isStarted()) { eventListener.bestSolutionChanged(event); } }); startPermit.release(); } SolverExecutor(final SolverDef solverDef,
                          final KieServerRegistry registry,
                          final SolverEventListener<TaskAssigningSolution> eventListener); }
SolverExecutor extends RunnableBase { public void start(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new SolverExecutorException("SolverExecutor start method can only be invoked when the status is STOPPED"); } this.solution = solution; try { this.solver = buildSolver(solverDef, registry); } catch (Exception e) { status.set(STOPPED); throw new SolverExecutorException(e.getMessage(), e); } solver.addEventListener(event -> { if (isAlive() && isStarted()) { eventListener.bestSolutionChanged(event); } }); startPermit.release(); } SolverExecutor(final SolverDef solverDef,
                          final KieServerRegistry registry,
                          final SolverEventListener<TaskAssigningSolution> eventListener); void start(final TaskAssigningSolution solution); boolean isStarted(); boolean isStopped(); void stop(); @Override void destroy(); void addProblemFactChanges(final List<ProblemFactChange<TaskAssigningSolution>> changes); @Override void run(); }
SolverExecutor extends RunnableBase { public void start(final TaskAssigningSolution solution) { checkNotNull("solution", solution); if (!status.compareAndSet(STOPPED, STARTING)) { throw new SolverExecutorException("SolverExecutor start method can only be invoked when the status is STOPPED"); } this.solution = solution; try { this.solver = buildSolver(solverDef, registry); } catch (Exception e) { status.set(STOPPED); throw new SolverExecutorException(e.getMessage(), e); } solver.addEventListener(event -> { if (isAlive() && isStarted()) { eventListener.bestSolutionChanged(event); } }); startPermit.release(); } SolverExecutor(final SolverDef solverDef,
                          final KieServerRegistry registry,
                          final SolverEventListener<TaskAssigningSolution> eventListener); void start(final TaskAssigningSolution solution); boolean isStarted(); boolean isStopped(); void stop(); @Override void destroy(); void addProblemFactChanges(final List<ProblemFactChange<TaskAssigningSolution>> changes); @Override void run();  }