public boolean loadOrDoWork(final StorableProperties properties) {
        ExecutorCompletionService completionService = new ExecutorCompletionService<>(threadPool);
        int counter = 0;
        final AtomicBoolean prepared = new AtomicBoolean(false);
        for (final PrepareLandmarks plm : preparations) {
            counter++;
            final int tmpCounter = counter;
            final String name = AbstractWeighting.weightingToFileName(plm.getWeighting(), false);
            completionService.submit(new Runnable() {
                @Override
                public void run() {
                    if (plm.loadExisting())
                        return;

                    LOGGER.info(tmpCounter + "/" + getPreparations().size() + " calling LM prepare.doWork for " + plm.getWeighting() + " ... (" + getMemInfo() + ")");
                    prepared.set(true);
                    Thread.currentThread().setName(name);
                    plm.doWork();
                    properties.put(Landmark.PREPARE + "date." + name, createFormatter().format(new Date()));
                }
            }, name);
        }

        threadPool.shutdown();

        try {
            for (int i = 0; i < preparations.size(); i++) {
                completionService.take().get();
            }
        } catch (Exception e) {
            threadPool.shutdownNow();
            throw new RuntimeException(e);
        }
        return prepared.get();
    }
public boolean loadOrDoWork ( final StorableProperties properties ) { ExecutorCompletionService completionService = new ExecutorCompletionService < > ( threadPool ) ; int counter = 0 ; final AtomicBoolean prepared = new AtomicBoolean ( false ) ; for ( final PrepareLandmarks plm : preparations ) { counter ++ ; final int tmpCounter = counter ; final String name = AbstractWeighting . weightingToFileName ( plm . getWeighting ( ) , false ) ; completionService . submit ( new Runnable ( ) { @ Override public void run ( ) { if ( plm . loadExisting ( ) ) return ; LOGGER . info ( tmpCounter + "/" + getPreparations ( ) . size ( ) + " calling LM prepare.doWork for " + plm . getWeighting ( ) + " ... (" + getMemInfo ( ) + ")" ) ; prepared . set ( true ) ; Thread . currentThread ( ) . setName ( name ) ; plm . doWork ( ) ; properties . put ( Landmark . PREPARE + "date." + name , createFormatter ( ) . format ( new Date ( ) ) ) ; } } , name ) ; } threadPool . shutdown ( ) ; try { for ( int i = 0 ; i < preparations . size ( ) ; i ++ ) { completionService . take ( ) . get ( ) ; } } catch ( Exception e ) { threadPool . shutdownNow ( ) ; throw new RuntimeException ( e ) ; } return prepared . get ( ) ; }
This method calculates the landmark data for all weightings (optionally in parallel) or if already existent loads it.

@return true if the preparation data for at least one weighting was calculated.
@see com.graphhopper.routing.ch.CHAlgoFactoryDecorator#prepare(StorableProperties) for a very similar method