@Override public void run() { logger.info("Timeout, stopping threads..."); globalContext.stopAllThreads(); wasTimeout.set(true); } };
/** * Stops the exploration asynchronously. It has no effect if the exploration is already terminated or not even * started. */ public void stopExplorationAsync() { if (globalContext.isDone()) { logger.info("Cannot stop exploration - design space exploration has already finished."); } else if (globalContext.isNotStarted()) { logger.info("Cannot stop exploration - design space exploration has not been started."); } else { globalContext.stopAllThreads(); } }
/** * Stops the exploration and waits for termination. It has no effect if the exploration is already terminated or not * even started. */ public void stopExploration() { if (globalContext.isDone()) { logger.info("Cannot stop exploration - design space exploration has already finished."); } else if (globalContext.isNotStarted()) { logger.info("Cannot stop exploration - design space exploration has not been started."); } else { globalContext.stopAllThreads(); waitForTerminaition(); } }
context.getGlobalContext().stopAllThreads(); so.barrierBeforeChildGeneration.await(); return;
public synchronized void newSolution(ThreadContext context) { solutionSaver.setSolutionsCollection(solutions); Fitness fitness = context.getLastFitness(); DesignSpaceManager dsm = context.getDesignSpaceManager(); Object id = dsm.getCurrentState(); IStateCoderFactory stateCoderFactory = context.getGlobalContext().getStateCoderFactory(); SolutionTrajectory solutionTrajectory = dsm.getTrajectoryInfo().createSolutionTrajectory(stateCoderFactory); solutionTrajectory.setFitness(fitness); if (acceptOnlyGoalSolutions && !fitness.isSatisifiesHardObjectives()) { unsavedSolutionCallbacks(context, solutionTrajectory); return; } boolean solutionSaved = solutionSaver.saveSolution(context, id, solutionTrajectory); if (solutionSaved) { enoughSolutions.solutionFound(context, solutionTrajectory); savedSolutionCallbacks(context, solutionTrajectory); if (enoughSolutions.enoughSolutions()) { context.getGlobalContext().stopAllThreads(); } } else { unsavedSolutionCallbacks(context, solutionTrajectory); } }