You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2021/06/22 17:46:27 UTC
[lucene-solr] branch branch_8x updated: LUCENE-10012: Pull down fix
from 9.0 (master) branch.
This is an automated email from the ASF dual-hosted git repository.
kwright pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new be472f0 LUCENE-10012: Pull down fix from 9.0 (master) branch.
new e5998fb Merge branch 'branch_8x' of https://gitbox.apache.org/repos/asf/lucene-solr into branch_8x
be472f0 is described below
commit be472f014097a092cc1010e68fa42cfd929424bd
Author: Karl Wright <Da...@gmail.com>
AuthorDate: Tue Jun 22 13:45:35 2021 -0400
LUCENE-10012: Pull down fix from 9.0 (master) branch.
---
.../apache/lucene/spatial3d/geom/GeoStandardPath.java | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
index bc01cd9..cf8d063 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
@@ -22,7 +22,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.List;
import java.util.Map;
@@ -923,7 +923,7 @@ class GeoStandardPath extends GeoBasePath {
/** End point of the segment */
public final GeoPoint end;
/** Place to keep any complete segment distances we've calculated so far */
- public final Map<DistanceStyle,Double> fullDistanceCache = new HashMap<DistanceStyle,Double>();
+ public final Map<DistanceStyle,Double> fullDistanceCache = new ConcurrentHashMap<DistanceStyle,Double>();
/** Normalized plane connecting the two points and going through world center */
public final Plane normalizedConnectingPlane;
/** Cutoff plane parallel to connecting plane representing one side of the path segment */
@@ -1018,14 +1018,12 @@ class GeoStandardPath extends GeoBasePath {
*@return the distance metric, in aggregation form.
*/
public double fullPathDistance(final DistanceStyle distanceStyle) {
- synchronized (fullDistanceCache) {
- Double dist = fullDistanceCache.get(distanceStyle);
- if (dist == null) {
- dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z));
- fullDistanceCache.put(distanceStyle, dist);
- }
- return dist.doubleValue();
+ Double dist = fullDistanceCache.get(distanceStyle);
+ if (dist == null) {
+ dist = distanceStyle.toAggregationForm(distanceStyle.computeDistance(start, end.x, end.y, end.z));
+ fullDistanceCache.put(distanceStyle, dist);
}
+ return dist.doubleValue();
}
/** Check if point is within this segment.