From 94e2c0f6f1115a72ff5c0fc7e3d8a63cdbe12a3e Mon Sep 17 00:00:00 2001 From: pailakka Date: Thu, 26 Apr 2018 14:18:38 +0300 Subject: [PATCH 1/2] Change compactLegsByReversedSearch default value to better refleact earlier situation --- src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java | 1 - .../java/org/opentripplanner/routing/core/RoutingRequest.java | 2 +- .../graph_builder/module/osm/TestIntermediatePlaces.java | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java b/src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java index 94501f2642a..949461151d7 100644 --- a/src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java +++ b/src/main/java/org/opentripplanner/index/IndexGraphQLSchema.java @@ -663,7 +663,6 @@ public IndexGraphQLSchema(GraphIndex index) { .name("compactLegsByReversedSearch") .description("Whether legs should be compacted by performing a reversed search. Experimental argument, will be removed!.") .type(Scalars.GraphQLBoolean) - .defaultValue(true) .build()) .dataFetcher(environment -> new GraphQlPlanner(index).plan(environment)) .build(); diff --git a/src/main/java/org/opentripplanner/routing/core/RoutingRequest.java b/src/main/java/org/opentripplanner/routing/core/RoutingRequest.java index 248b6b4afca..8561199a087 100644 --- a/src/main/java/org/opentripplanner/routing/core/RoutingRequest.java +++ b/src/main/java/org/opentripplanner/routing/core/RoutingRequest.java @@ -369,7 +369,7 @@ public class RoutingRequest implements Cloneable, Serializable { /** * When true, do a full reversed search to compact the legs of the GraphPath. */ - public boolean compactLegsByReversedSearch = false; + public boolean compactLegsByReversedSearch = true; /** * If true, cost turns as they would be in a country where driving occurs on the right; otherwise, cost them as they would be in a country where diff --git a/src/test/java/org/opentripplanner/graph_builder/module/osm/TestIntermediatePlaces.java b/src/test/java/org/opentripplanner/graph_builder/module/osm/TestIntermediatePlaces.java index 8ac9edfca3f..8ba9a2a74f8 100644 --- a/src/test/java/org/opentripplanner/graph_builder/module/osm/TestIntermediatePlaces.java +++ b/src/test/java/org/opentripplanner/graph_builder/module/osm/TestIntermediatePlaces.java @@ -139,6 +139,7 @@ private void handleRequest(GenericLocation from, GenericLocation to, GenericLoca request.maxTransfers = 4; request.from = from; request.to = to; + request.compactLegsByReversedSearch = false; for (GenericLocation intermediateLocation : via) { request.addIntermediatePlace(intermediateLocation); } From 4764495e0cae31685cccc4617a14f237eda99304 Mon Sep 17 00:00:00 2001 From: pailakka Date: Thu, 26 Apr 2018 14:19:06 +0300 Subject: [PATCH 2/2] Use ConcurrentHashMap when loading graph from file (to prevent updaters crashing) --- src/main/java/org/opentripplanner/routing/graph/Graph.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/opentripplanner/routing/graph/Graph.java b/src/main/java/org/opentripplanner/routing/graph/Graph.java index 22f9613b343..dfee89d5591 100644 --- a/src/main/java/org/opentripplanner/routing/graph/Graph.java +++ b/src/main/java/org/opentripplanner/routing/graph/Graph.java @@ -753,7 +753,7 @@ public static Graph load(ObjectInputStream in, LoadLevel level, // vertex list is transient because it can be reconstructed from edges LOG.debug("Loading edges..."); List edges = (ArrayList) in.readObject(); - graph.vertices = new HashMap(); + graph.vertices = new ConcurrentHashMap(); for (Edge e : edges) { graph.vertices.put(e.getFromVertex().getLabel(), e.getFromVertex());