public void prepare(final StorableProperties properties) { ExecutorCompletionService completionService = new ExecutorCompletionService<>(threadPool); int counter = 0; for (final PrepareContractionHierarchies prepare : getPreparations()) { LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + getMemInfo() + ")"); final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting()); completionService.submit(new Runnable() { @Override public void run() { // toString is not taken into account so we need to cheat, see http://stackoverflow.com/q/6113746/194609 for other options Thread.currentThread().setName(name); prepare.doWork(); properties.put(CH.PREPARE + "date." + name, createFormatter().format(new Date())); } }, name); } threadPool.shutdown(); try { for (int i = 0; i < getPreparations().size(); i++) { completionService.take().get(); } } catch (Exception e) { threadPool.shutdownNow(); throw new RuntimeException(e); } }
public void prepare(final StorableProperties properties) { ExecutorCompletionService completionService = new ExecutorCompletionService<>(threadPool); int counter = 0; for (final PrepareContractionHierarchies prepare : getPreparations()) { LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + getMemInfo() + ")"); final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting()); completionService.submit(new Runnable() { @Override public void run() { // toString is not taken into account so we need to cheat, see http://stackoverflow.com/q/6113746/194609 for other options Thread.currentThread().setName(name); prepare.doWork(); properties.put(CH.PREPARE + "date." + name, createFormatter().format(new Date())); } }, name); } threadPool.shutdown(); try { for (int i = 0; i < getPreparations().size(); i++) { completionService.take().get(); } } catch (Exception e) { threadPool.shutdownNow(); throw new RuntimeException(e); } }
public void prepare(final StorableProperties properties) { int counter = 0; for (final PrepareContractionHierarchies prepare : getPreparations()) { LOGGER.info((++counter) + "/" + getPreparations().size() + " calling CH prepare.doWork for " + prepare.getWeighting() + " ... (" + Helper.getMemInfo() + ")"); final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting()); threadPool.execute(new Runnable() {
public void prepare( final StorableProperties properties ) for (final PrepareContractionHierarchies prepare : getPreparations()) logger.info((++counter) + "/" + getPreparations().size() + " calling prepare.doWork for " + prepare.getWeighting() + " ... (" + Helper.getMemInfo() + ")"); final String name = AbstractWeighting.weightingToFileName(prepare.getWeighting()); chPreparePool.execute(new Runnable()