Package org.opentripplanner.routing.services

Examples of org.opentripplanner.routing.services.GraphSource


        /*
         * Here we should not synchronize on graphSource as it may block for a while (during
         * reload/autoreload). For normal operations a simple get do not need to be synchronized so
         * we should be safe.
         */
        GraphSource graphSource = graphSources.get(routerId);
        if (graphSource == null) {
            LOG.error("no graph registered with the routerId '{}'", routerId);
            throw new GraphNotFoundException();
        }
        Graph graph = graphSource.getGraph();
        if (graph == null) {
            evictGraph(routerId);
            throw new GraphNotFoundException();
        }
        return graph;
View Full Code Here


    public boolean reloadGraphs(boolean preEvict) {
        boolean allSucceeded = true;
        synchronized (graphSources) {
            Collection<String> routerIds = getRouterIds();
            for (String routerId : routerIds) {
                GraphSource graphSource = graphSources.get(routerId);
                boolean success = graphSource.reload(true, preEvict);
                if (!success) {
                    evictGraph(routerId);
                }
                allSucceeded &= success;
            }
View Full Code Here

        if (graphSource.getGraph() == null) {
            LOG.warn("Can't register router ID '{}', null graph.", routerId);
            return false;
        }
        synchronized (graphSources) {
            GraphSource oldSource = graphSources.get(routerId);
            if (oldSource != null) {
                LOG.info("Graph '{}' already registered. Nothing to do.", routerId);
                return false;
            }
            graphSources.put(routerId, graphSource);
View Full Code Here

    @Override
    public boolean evictGraph(String routerId) {
        LOG.info("Evicting graph '{}'", routerId);
        synchronized (graphSources) {
            GraphSource graphSource = graphSources.get(routerId);
            graphSources.remove(routerId);
            if (graphSource != null) {
                graphSource.evict();
                return true;
            } else {
                return false;
            }
        }
View Full Code Here

    private void autoReloadScan() {
        synchronized (graphSources) {
            Collection<String> routerIds = getRouterIds();
            for (String routerId : routerIds) {
                GraphSource graphSource = graphSources.get(routerId);
                boolean success = graphSource.reload(false, AUTORELOAD_PREEVICT);
                if (!success) {
                    evictGraph(routerId);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.services.GraphSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.