public synchronized void stopAllThreads() { if (state == ExplorationProcessState.RUNNING) { state = ExplorationProcessState.STOPPING; logger.info("Stopping all threads."); for (ExplorerThread strategy : runningThreads) { strategy.stopRunning(); } } }
ExplorerThread explorerThread = new ExplorerThread(newThreadContext); newThreadContext.setExplorerThread(explorerThread);
/** * Starts the design space exploration. Returns only when the {@link IStrategy#explore()} method returns. */ public void run() { GlobalContext globalContext = threadContext.getGlobalContext(); try { threadContext.init(); strategy.initStrategy(threadContext); strategy.explore(); threadContext.backtrackUntilRoot(); } catch (Throwable e) { Logger.getLogger(IStrategy.class).error("Thread stopped unexpectedly!", e); globalContext.registerException(e); } finally { globalContext.strategyFinished(this); dispose(); } }