diff --git a/algo-common/src/main/java/org/neo4j/gds/result/AbstractCentralityResultBuilder.java b/algo-common/src/main/java/org/neo4j/gds/result/AbstractCentralityResultBuilder.java index c9c6b94c9df..7fb7529b9c7 100644 --- a/algo-common/src/main/java/org/neo4j/gds/result/AbstractCentralityResultBuilder.java +++ b/algo-common/src/main/java/org/neo4j/gds/result/AbstractCentralityResultBuilder.java @@ -22,7 +22,7 @@ import org.HdrHistogram.DoubleHistogram; import org.jetbrains.annotations.NotNull; import org.neo4j.gds.api.ProcedureReturnColumns; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.scaling.LogScaler; import org.neo4j.gds.scaling.ScalerFactory; @@ -95,7 +95,7 @@ private Optional computeCentralityHistogram() { return Optional.of(CentralityStatistics.histogram( nodeCount, centralityFunction, - Pools.DEFAULT, + DefaultPool.INSTANCE, concurrency )); } catch (ArrayIndexOutOfBoundsException e) { diff --git a/algo-common/src/main/java/org/neo4j/gds/result/AbstractCommunityResultBuilder.java b/algo-common/src/main/java/org/neo4j/gds/result/AbstractCommunityResultBuilder.java index ae782035337..58ee87adef0 100644 --- a/algo-common/src/main/java/org/neo4j/gds/result/AbstractCommunityResultBuilder.java +++ b/algo-common/src/main/java/org/neo4j/gds/result/AbstractCommunityResultBuilder.java @@ -22,7 +22,7 @@ import org.HdrHistogram.Histogram; import org.jetbrains.annotations.Nullable; import org.neo4j.gds.api.ProcedureReturnColumns; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.ProgressTimer; import java.util.Map; @@ -54,7 +54,7 @@ protected AbstractCommunityResultBuilder( ProcedureReturnColumns returnColumns, int concurrency ) { - this(returnColumns, Pools.DEFAULT, concurrency); + this(returnColumns, DefaultPool.INSTANCE, concurrency); } protected AbstractCommunityResultBuilder( diff --git a/algo-common/src/test/java/org/neo4j/gds/result/CommunityStatisticsTest.java b/algo-common/src/test/java/org/neo4j/gds/result/CommunityStatisticsTest.java index ff833682001..5063bad3c1f 100644 --- a/algo-common/src/test/java/org/neo4j/gds/result/CommunityStatisticsTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/result/CommunityStatisticsTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.TestSupport; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import java.util.HashMap; import java.util.Map; @@ -49,7 +49,7 @@ void communitySizes( var communitySizes = CommunityStatistics.communitySizes( nodeCount, communityFunction, - Pools.DEFAULT, + DefaultPool.INSTANCE, concurrency ); expectedCommunitySizes.forEach((communityId, expectedSize) -> { @@ -72,7 +72,7 @@ void communityCount( CommunityStatistics.communityCount( nodeCount, communityFunction, - Pools.DEFAULT, + DefaultPool.INSTANCE, concurrency ) ); @@ -91,7 +91,7 @@ void communityCountAndHistogram( var communityCountAndHistogram = CommunityStatistics.communityCountAndHistogram( nodeCount, communityFunction, - Pools.DEFAULT, + DefaultPool.INSTANCE, concurrency ); diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/CenterTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/CenterTest.java index 24159e087e6..20ad760ed70 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/CenterTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/CenterTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -63,7 +63,7 @@ void normalizes(NodePropertyValues properties, double avg, double[] expected) { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.avg).isEqualTo(avg); @@ -81,7 +81,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var avg = 4.444; diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/L1NormTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/L1NormTest.java index 1acf05847a2..10b7cef7416 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/L1NormTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/L1NormTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -62,7 +62,7 @@ void scale(int nodeCount, NodePropertyValues properties, double l1norm, double[] nodeCount, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.l1Norm).isEqualTo(l1norm); @@ -79,7 +79,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); for (int i = 0; i < 10; i++) { @@ -95,7 +95,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var l1norm = 40D; diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/L2NormTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/L2NormTest.java index 0808221440a..b8f93a15f2f 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/L2NormTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/L2NormTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -53,7 +53,7 @@ void normalizes(NodePropertyValues properties, double euclideanLength, double[] 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.euclideanLength).isEqualTo(euclideanLength); @@ -70,7 +70,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); for (int i = 0; i < 10; i++) { @@ -86,7 +86,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var euclideanLength = 16.124; diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/LogScalerTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/LogScalerTest.java index 220eebde88f..680bfd05608 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/LogScalerTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/LogScalerTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; import org.neo4j.gds.nodeproperties.LongTestPropertyValues; @@ -72,7 +72,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); for (int i = 0; i < 5; i++) { diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/MaxTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/MaxTest.java index ba805420c8e..9d50bbb5afc 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/MaxTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/MaxTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -70,7 +70,7 @@ void scale(int nodeCount, NodePropertyValues properties, double absMax, double[] nodeCount, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.maxAbs).isEqualTo(absMax); @@ -88,7 +88,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.statistics()).containsExactlyEntriesOf(Map.of("absMax", List.of(0D))); @@ -106,7 +106,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/MeanTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/MeanTest.java index 80ac7bc12ab..39b5a4bf82c 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/MeanTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/MeanTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -57,7 +57,7 @@ void normalizes(NodePropertyValues properties, double avg, double min, double ma 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.avg).isEqualTo(avg); @@ -81,7 +81,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.statistics()).containsExactlyInAnyOrderEntriesOf(Map.of( @@ -103,7 +103,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var avg = 4.444; diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/MinMaxTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/MinMaxTest.java index d2f0fe13f9a..edc881c051d 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/MinMaxTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/MinMaxTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -53,7 +53,7 @@ void normalizes(NodePropertyValues properties, double min, double max) { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.min).isEqualTo(min); @@ -77,7 +77,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.statistics()).containsExactlyEntriesOf(Map.of( @@ -98,7 +98,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/ScalerTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/ScalerTest.java index c67bc368df1..a5f6c2966ab 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/ScalerTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/ScalerTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -39,14 +39,14 @@ void shouldAccumulateStatsCorrectly() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var meanScaler2 = (Mean) Mean.buildFrom(CypherMapWrapper.empty()).create( new DoubleTestPropertyValues(nodeId -> 2 * nodeId), 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var meanScaler1Stats = meanScaler1.statistics(); diff --git a/algo-common/src/test/java/org/neo4j/gds/scaling/StdScoreTest.java b/algo-common/src/test/java/org/neo4j/gds/scaling/StdScoreTest.java index 8495767c73b..236975d31ff 100644 --- a/algo-common/src/test/java/org/neo4j/gds/scaling/StdScoreTest.java +++ b/algo-common/src/test/java/org/neo4j/gds/scaling/StdScoreTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.nodeproperties.DoubleTestPropertyValues; @@ -56,7 +56,7 @@ void normalizes(NodePropertyValues properties, double avg, double std, double[] 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(scaler.avg).isEqualTo(avg); @@ -78,7 +78,7 @@ void handlesMissingValue() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var avg = 4.444; @@ -100,7 +100,7 @@ void avoidsDivByZero() { 10, 1, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); for (int i = 0; i < 10; i++) { diff --git a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutFactory.java b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutFactory.java index c8e6a41d9bf..617846da09a 100644 --- a/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutFactory.java +++ b/algo/src/main/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutFactory.java @@ -24,7 +24,7 @@ import org.neo4j.gds.approxmaxkcut.config.ApproxMaxKCutConfig; import org.neo4j.gds.collections.haa.HugeAtomicByteArray; import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeByteArray; @@ -51,7 +51,7 @@ public ApproxMaxKCut build( CONFIG configuration, ProgressTracker progressTracker ) { - return new ApproxMaxKCut(graph, Pools.DEFAULT, configuration, progressTracker); + return new ApproxMaxKCut(graph, DefaultPool.INSTANCE, configuration, progressTracker); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/betweenness/BetweennessCentralityFactory.java b/algo/src/main/java/org/neo4j/gds/betweenness/BetweennessCentralityFactory.java index 7925fc0cb21..9bae0ded336 100644 --- a/algo/src/main/java/org/neo4j/gds/betweenness/BetweennessCentralityFactory.java +++ b/algo/src/main/java/org/neo4j/gds/betweenness/BetweennessCentralityFactory.java @@ -23,7 +23,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; @@ -66,7 +66,7 @@ public BetweennessCentrality build( graph, strategy, traverserFactory, - Pools.DEFAULT, + DefaultPool.INSTANCE, configuration.concurrency(), progressTracker ); diff --git a/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityFactory.java b/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityFactory.java index c2219971cc2..df3bd6b0353 100644 --- a/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityFactory.java +++ b/algo/src/main/java/org/neo4j/gds/closeness/ClosenessCentralityFactory.java @@ -22,7 +22,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; import org.neo4j.gds.core.utils.progress.tasks.Tasks; @@ -37,7 +37,7 @@ public ClosenessCentrality build( return ClosenessCentrality.of( graph, configuration, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/conductance/ConductanceFactory.java b/algo/src/main/java/org/neo4j/gds/conductance/ConductanceFactory.java index ace1f7357e5..a7d1050f318 100644 --- a/algo/src/main/java/org/neo4j/gds/conductance/ConductanceFactory.java +++ b/algo/src/main/java/org/neo4j/gds/conductance/ConductanceFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; import org.neo4j.gds.core.utils.progress.tasks.Tasks; @@ -43,7 +43,7 @@ public Conductance build( CONFIG configuration, ProgressTracker progressTracker ) { - return new Conductance(graph, Pools.DEFAULT, configuration, progressTracker); + return new Conductance(graph, DefaultPool.INSTANCE, configuration, progressTracker); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityFactory.java b/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityFactory.java index 150061c5256..c3387586ad4 100644 --- a/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityFactory.java +++ b/algo/src/main/java/org/neo4j/gds/degree/DegreeCentralityFactory.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; @@ -45,7 +45,7 @@ public DegreeCentrality build( CONFIG configuration, ProgressTracker progressTracker ) { - return new DegreeCentrality(graph, Pools.DEFAULT, configuration, progressTracker); + return new DegreeCentrality(graph, DefaultPool.INSTANCE, configuration, progressTracker); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRP.java b/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRP.java index 34234604985..14c1e4375e9 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRP.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/fastrp/FastRP.java @@ -22,8 +22,8 @@ import org.jetbrains.annotations.TestOnly; import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -221,7 +221,7 @@ void propagateEmbeddings() { ); ParallelUtil.parallelPartitionsConsume( - RunWithConcurrency.builder().executor(Pools.DEFAULT).concurrency(concurrency), + RunWithConcurrency.builder().executor(DefaultPool.INSTANCE).concurrency(concurrency), partitions.stream(), taskSupplier ); diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageAlgorithmFactory.java index 8d1736e0f40..f47eb2e3599 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageAlgorithmFactory.java @@ -22,7 +22,7 @@ import org.neo4j.gds.GraphStoreAlgorithmFactory; import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.config.MutateConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.model.ModelCatalog; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -49,7 +49,7 @@ public GraphSageAlgorithmFactory(ModelCatalog modelCatalog) { @Override public GraphSage build(GraphStore graphStore, CONFIG configuration, ProgressTracker progressTracker) { - var executorService = Pools.DEFAULT; + var executorService = DefaultPool.INSTANCE; var model = resolveModel( modelCatalog, configuration.modelUser(), diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageTrainAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageTrainAlgorithmFactory.java index d8ef87ba90c..358316dbe2c 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageTrainAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/graphsage/algo/GraphSageTrainAlgorithmFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -58,7 +58,7 @@ public GraphSageTrain build( GraphSageTrainConfig configuration, ProgressTracker progressTracker ) { - var executorService = Pools.DEFAULT; + var executorService = DefaultPool.INSTANCE; if(configuration.hasRelationshipWeightProperty()) { validateRelationshipWeightPropertyValue(graph, configuration.concurrency(), executorService); } diff --git a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2Vec.java b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2Vec.java index 4b78949d26f..48f7d1cba55 100644 --- a/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2Vec.java +++ b/algo/src/main/java/org/neo4j/gds/embeddings/node2vec/Node2Vec.java @@ -21,7 +21,7 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeObjectArray; @@ -60,7 +60,7 @@ public Node2VecModel.Result compute() { graph, config, progressTracker, - Pools.DEFAULT + DefaultPool.INSTANCE ); var probabilitiesBuilder = new RandomWalkProbabilities.Builder( diff --git a/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicCentralityAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicCentralityAlgorithmFactory.java index 82ed47682a0..879f6fa54bd 100644 --- a/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicCentralityAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/harmonic/HarmonicCentralityAlgorithmFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; public class HarmonicCentralityAlgorithmFactory extends GraphAlgorithmFactory { @@ -39,7 +39,7 @@ public HarmonicCentrality build( return new HarmonicCentrality( graph, configuration.concurrency(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/indexInverse/InverseRelationshipsAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/indexInverse/InverseRelationshipsAlgorithmFactory.java index 8430d1e0f92..e1a9eb96a16 100644 --- a/algo/src/main/java/org/neo4j/gds/indexInverse/InverseRelationshipsAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/indexInverse/InverseRelationshipsAlgorithmFactory.java @@ -23,7 +23,7 @@ import org.neo4j.gds.GraphStoreAlgorithmFactory; import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.AdjacencyListBehavior; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -45,7 +45,7 @@ public InverseRelationships build( InverseRelationshipsConfig configuration, ProgressTracker progressTracker ) { - return new InverseRelationships(graphStore, configuration, progressTracker, Pools.DEFAULT); + return new InverseRelationships(graphStore, configuration, progressTracker, DefaultPool.INSTANCE); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFAlgorithmFactory.java index 69e3692a5b3..f479f7d5d6d 100644 --- a/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/influenceMaximization/CELFAlgorithmFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -53,7 +53,7 @@ public CELF build( configuration.seedSetSize(), configuration.propagationProbability(), configuration.monteCarloSimulations(), - Pools.DEFAULT, + DefaultPool.INSTANCE, configuration.concurrency(), configuration.randomSeed().orElse(0L), DEFAULT_BATCH_SIZE, diff --git a/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringFactory.java b/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringFactory.java index 1f532f1c713..2e4e0694855 100644 --- a/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringFactory.java +++ b/algo/src/main/java/org/neo4j/gds/k1coloring/K1ColoringFactory.java @@ -23,7 +23,7 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.config.BaseConfig; import org.neo4j.gds.config.IterationsConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -54,7 +54,7 @@ public K1Coloring build( configuration.maxIterations(), configuration.batchSize(), configuration.concurrency(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/kmeans/KmeansAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/kmeans/KmeansAlgorithmFactory.java index b1f5d26521d..25aab9a298f 100644 --- a/algo/src/main/java/org/neo4j/gds/kmeans/KmeansAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/kmeans/KmeansAlgorithmFactory.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; @@ -61,7 +61,7 @@ public Kmeans build( return Kmeans.createKmeans(graph, configuration, ImmutableKmeansContext .builder() .progressTracker(progressTracker) - .executor(Pools.DEFAULT) + .executor(DefaultPool.INSTANCE) .build()); } diff --git a/algo/src/main/java/org/neo4j/gds/kmeans/KmeansContext.java b/algo/src/main/java/org/neo4j/gds/kmeans/KmeansContext.java index d90627dfefb..b5729e27c47 100644 --- a/algo/src/main/java/org/neo4j/gds/kmeans/KmeansContext.java +++ b/algo/src/main/java/org/neo4j/gds/kmeans/KmeansContext.java @@ -21,7 +21,7 @@ import org.immutables.value.Value; import org.neo4j.gds.annotation.ValueClass; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import java.util.concurrent.ExecutorService; @@ -31,7 +31,7 @@ public interface KmeansContext { @Value.Default default ExecutorService executor() { - return Pools.DEFAULT; + return DefaultPool.INSTANCE; } @Value.Default diff --git a/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationFactory.java b/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationFactory.java index 33c1a0db598..08232a8ab0f 100644 --- a/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationFactory.java +++ b/algo/src/main/java/org/neo4j/gds/labelpropagation/LabelPropagationFactory.java @@ -22,7 +22,7 @@ import com.carrotsearch.hppc.LongDoubleScatterMap; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -53,7 +53,7 @@ public LabelPropagation build( return new LabelPropagation( graph, configuration, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java b/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java index 5fd0d037076..b9b27794150 100644 --- a/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java +++ b/algo/src/main/java/org/neo4j/gds/leiden/Leiden.java @@ -25,7 +25,7 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.api.schema.Direction; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -77,7 +77,7 @@ public Leiden( this.theta = theta; this.randomSeed = randomSeed; // TODO: Pass these two as parameters - this.executorService = Pools.DEFAULT; + this.executorService = DefaultPool.INSTANCE; this.concurrency = concurrency; this.dendrogramManager = new LeidenDendrogramManager( rootGraph, diff --git a/algo/src/main/java/org/neo4j/gds/louvain/LouvainAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/louvain/LouvainAlgorithmFactory.java index 9898c9e3db5..7d8e79dda4f 100644 --- a/algo/src/main/java/org/neo4j/gds/louvain/LouvainAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/louvain/LouvainAlgorithmFactory.java @@ -31,7 +31,7 @@ import org.neo4j.gds.core.Aggregation; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.NativeFactory; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -61,7 +61,7 @@ public Louvain build( configuration.tolerance(), configuration.concurrency(), progressTracker, - Pools.DEFAULT + DefaultPool.INSTANCE ); } diff --git a/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationFactory.java b/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationFactory.java index 17fa061e0ed..e3047b883c9 100644 --- a/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationFactory.java +++ b/algo/src/main/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationFactory.java @@ -25,7 +25,7 @@ import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray; import org.neo4j.gds.config.BaseConfig; import org.neo4j.gds.config.IterationsConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -106,7 +106,7 @@ public ModularityOptimization build( seedProperty, configuration.concurrency(), configuration.batchSize(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankAlgorithmFactory.java index e076c0856e5..d62d9c6d84d 100644 --- a/algo/src/main/java/org/neo4j/gds/pagerank/PageRankAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/pagerank/PageRankAlgorithmFactory.java @@ -27,8 +27,8 @@ import org.neo4j.gds.beta.pregel.Pregel; import org.neo4j.gds.beta.pregel.PregelComputation; import org.neo4j.gds.beta.pregel.PregelSchema; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -121,7 +121,7 @@ public PageRankAlgorithm build( configuration, computation, mode, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } @@ -143,7 +143,7 @@ private LongToDoubleFunction degreeFunction( var degreeCentrality = new DegreeCentrality( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/main/java/org/neo4j/gds/paths/delta/DeltaSteppingFactory.java b/algo/src/main/java/org/neo4j/gds/paths/delta/DeltaSteppingFactory.java index b7d38aba171..23456c2dd14 100644 --- a/algo/src/main/java/org/neo4j/gds/paths/delta/DeltaSteppingFactory.java +++ b/algo/src/main/java/org/neo4j/gds/paths/delta/DeltaSteppingFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; @@ -38,7 +38,7 @@ public DeltaStepping build( T configuration, ProgressTracker progressTracker ) { - return DeltaStepping.of(graph, configuration, Pools.DEFAULT, progressTracker); + return DeltaStepping.of(graph, configuration, DefaultPool.INSTANCE, progressTracker); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/paths/traverse/BFS.java b/algo/src/main/java/org/neo4j/gds/paths/traverse/BFS.java index 4f21860c24a..15ea38e5e36 100644 --- a/algo/src/main/java/org/neo4j/gds/paths/traverse/BFS.java +++ b/algo/src/main/java/org/neo4j/gds/paths/traverse/BFS.java @@ -23,8 +23,8 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; import org.neo4j.gds.collections.haa.HugeAtomicLongArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.paged.HugeAtomicBitSet; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -199,7 +199,7 @@ public HugeLongArray compute() { if (currentDepth == maximumDepth) { break; } - ParallelUtil.run(bfsTaskList, Pools.DEFAULT); + ParallelUtil.run(bfsTaskList, DefaultPool.INSTANCE); if (targetFoundIndex.get() != Long.MAX_VALUE) { break; diff --git a/algo/src/main/java/org/neo4j/gds/paths/yens/Yens.java b/algo/src/main/java/org/neo4j/gds/paths/yens/Yens.java index 7eb0cf73b97..a07aa9bfcee 100644 --- a/algo/src/main/java/org/neo4j/gds/paths/yens/Yens.java +++ b/algo/src/main/java/org/neo4j/gds/paths/yens/Yens.java @@ -21,7 +21,7 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -113,7 +113,7 @@ public PathFindingResult compute() { RunWithConcurrency.builder() .concurrency(config.concurrency()) .tasks(tasks) - .executor(Pools.DEFAULT) + .executor(DefaultPool.INSTANCE) .run(); progressTracker.logProgress(); diff --git a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesFactory.java b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesFactory.java index 99f7dbb2498..745c32c2a85 100644 --- a/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesFactory.java +++ b/algo/src/main/java/org/neo4j/gds/scaleproperties/ScalePropertiesFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -69,7 +69,7 @@ public ScaleProperties build( graph, configuration, progressTracker, - Pools.DEFAULT + DefaultPool.INSTANCE ); } diff --git a/algo/src/main/java/org/neo4j/gds/similarity/filteredknn/FilteredKnnFactory.java b/algo/src/main/java/org/neo4j/gds/similarity/filteredknn/FilteredKnnFactory.java index ef6dbe66a79..056fac86cbf 100644 --- a/algo/src/main/java/org/neo4j/gds/similarity/filteredknn/FilteredKnnFactory.java +++ b/algo/src/main/java/org/neo4j/gds/similarity/filteredknn/FilteredKnnFactory.java @@ -23,7 +23,7 @@ import org.apache.commons.lang3.function.TriFunction; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -68,7 +68,7 @@ public FilteredKnn build(Graph graph, CONFIG configuration, ProgressTracker prog KnnContext knnContext = ImmutableKnnContext .builder() .progressTracker(progressTracker) - .executor(Pools.DEFAULT) + .executor(DefaultPool.INSTANCE) .build(); if (configuration.seedTargetNodes()) { diff --git a/algo/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityFactory.java b/algo/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityFactory.java index 9e4940c9143..42eac124cb9 100644 --- a/algo/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityFactory.java +++ b/algo/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityFactory.java @@ -22,7 +22,7 @@ import com.carrotsearch.hppc.BitSet; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -59,7 +59,7 @@ public NodeSimilarity build( configuration.sourceNodeFilter().toNodeFilter(graph), configuration.targetNodeFilter().toNodeFilter(graph), configuration.concurrency(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnContext.java b/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnContext.java index cab6b05a4f7..54acdbc5726 100644 --- a/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnContext.java +++ b/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnContext.java @@ -21,7 +21,7 @@ import org.immutables.value.Value; import org.neo4j.gds.annotation.ValueClass; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import java.util.concurrent.ExecutorService; @@ -31,7 +31,7 @@ public interface KnnContext { @Value.Default default ExecutorService executor() { - return Pools.DEFAULT; + return DefaultPool.INSTANCE; } @Value.Default diff --git a/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnFactory.java b/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnFactory.java index d09bff5787d..8dded7f2ec8 100644 --- a/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnFactory.java +++ b/algo/src/main/java/org/neo4j/gds/similarity/knn/KnnFactory.java @@ -22,7 +22,7 @@ import com.carrotsearch.hppc.LongArrayList; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -59,7 +59,7 @@ public Knn build( ImmutableKnnContext .builder() .progressTracker(progressTracker) - .executor(Pools.DEFAULT) + .executor(DefaultPool.INSTANCE) .build() ); } diff --git a/algo/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityFactory.java b/algo/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityFactory.java index 4da718731e9..b1eb71e31f2 100644 --- a/algo/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityFactory.java +++ b/algo/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityFactory.java @@ -22,7 +22,7 @@ import com.carrotsearch.hppc.BitSet; import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -54,7 +54,7 @@ public NodeSimilarity build( configuration, similarityComputer, configuration.concurrency(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java index b0fa97c7ebd..60e0761b4b8 100644 --- a/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/steiner/SteinerTreeAlgorithmFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; import org.neo4j.gds.core.utils.progress.tasks.Tasks; @@ -51,7 +51,7 @@ public ShortestPathsSteinerAlgorithm build( configuration.delta(), configuration.concurrency(), configuration.applyRerouting(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/topologicalsort/TopologicalSort.java b/algo/src/main/java/org/neo4j/gds/topologicalsort/TopologicalSort.java index 86f7c36258d..5a9f1f3e07d 100644 --- a/algo/src/main/java/org/neo4j/gds/topologicalsort/TopologicalSort.java +++ b/algo/src/main/java/org/neo4j/gds/topologicalsort/TopologicalSort.java @@ -23,8 +23,8 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; import org.neo4j.gds.collections.haa.HugeAtomicLongArray; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.ParalleLongPageCreator; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -98,7 +98,7 @@ private void initializeInDegrees() { } private void traverse() { - ForkJoinPool forkJoinPool = Pools.createForkJoinPool(concurrency); + ForkJoinPool forkJoinPool = ExecutorServiceUtil.createForkJoinPool(concurrency); var tasks = ConcurrentHashMap.>newKeySet(); ParallelUtil.parallelForEachNode(nodeCount, concurrency, TerminationFlag.RUNNING_TRUE, nodeId -> { diff --git a/algo/src/main/java/org/neo4j/gds/traversal/RandomWalk.java b/algo/src/main/java/org/neo4j/gds/traversal/RandomWalk.java index fa93cf218e2..2a6bd961037 100644 --- a/algo/src/main/java/org/neo4j/gds/traversal/RandomWalk.java +++ b/algo/src/main/java/org/neo4j/gds/traversal/RandomWalk.java @@ -22,7 +22,7 @@ import org.neo4j.gds.Algorithm; import org.neo4j.gds.api.Graph; import org.neo4j.gds.config.SourceNodesConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -150,7 +150,7 @@ private void startWalkers( TOMB, terminationFlag ), - Pools.DEFAULT_SINGLE_THREAD_POOL + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL ).whenComplete((__, ___) -> { progressTracker.endSubTask("RandomWalk"); }); diff --git a/algo/src/main/java/org/neo4j/gds/traversal/RandomWalkAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/traversal/RandomWalkAlgorithmFactory.java index 831f7f3d860..39637f4ee02 100644 --- a/algo/src/main/java/org/neo4j/gds/traversal/RandomWalkAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/traversal/RandomWalkAlgorithmFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -45,7 +45,7 @@ public RandomWalk build( RandomWalkBaseConfig configuration, ProgressTracker progressTracker ) { - return RandomWalk.create(graph, configuration, progressTracker, Pools.DEFAULT); + return RandomWalk.create(graph, configuration, progressTracker, DefaultPool.INSTANCE); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCountFactory.java b/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCountFactory.java index f76deba421b..4622d95cc86 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCountFactory.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/IntersectingTriangleCountFactory.java @@ -23,7 +23,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; import org.neo4j.gds.collections.haa.HugeAtomicLongArray; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -48,7 +48,7 @@ public IntersectingTriangleCount build( return IntersectingTriangleCount.create( graph, configuration, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); } diff --git a/algo/src/main/java/org/neo4j/gds/triangle/TriangleStreamFactory.java b/algo/src/main/java/org/neo4j/gds/triangle/TriangleStreamFactory.java index 83a9692f4c4..1c07b8b17c5 100644 --- a/algo/src/main/java/org/neo4j/gds/triangle/TriangleStreamFactory.java +++ b/algo/src/main/java/org/neo4j/gds/triangle/TriangleStreamFactory.java @@ -21,7 +21,7 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; public class TriangleStreamFactory extends GraphAlgorithmFactory { @@ -33,6 +33,6 @@ public String taskName() { @Override public TriangleStream build(Graph graph, TriangleCountBaseConfig configuration, ProgressTracker progressTracker) { - return TriangleStream.create(graph, Pools.DEFAULT, configuration.concurrency()); + return TriangleStream.create(graph, DefaultPool.INSTANCE, configuration.concurrency()); } } diff --git a/algo/src/main/java/org/neo4j/gds/undirected/ToUndirectedAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/undirected/ToUndirectedAlgorithmFactory.java index e3ace5ed1ac..ce858c0903a 100644 --- a/algo/src/main/java/org/neo4j/gds/undirected/ToUndirectedAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/undirected/ToUndirectedAlgorithmFactory.java @@ -22,7 +22,7 @@ import org.neo4j.gds.GraphStoreAlgorithmFactory; import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.AdjacencyListBehavior; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -39,7 +39,7 @@ public ToUndirected build( ToUndirectedConfig configuration, ProgressTracker progressTracker ) { - return new ToUndirected(graphStore, configuration, progressTracker, Pools.DEFAULT); + return new ToUndirected(graphStore, configuration, progressTracker, DefaultPool.INSTANCE); } @Override diff --git a/algo/src/main/java/org/neo4j/gds/walking/CollapsePathAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/walking/CollapsePathAlgorithmFactory.java index fbb5471a1fd..da8284beb3d 100644 --- a/algo/src/main/java/org/neo4j/gds/walking/CollapsePathAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/walking/CollapsePathAlgorithmFactory.java @@ -24,7 +24,7 @@ import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import java.util.Collection; @@ -66,7 +66,7 @@ public CollapsePath build( config.allowSelfLoops(), RelationshipType.of(config.mutateRelationshipType()), config.concurrency(), - Pools.DEFAULT + DefaultPool.INSTANCE ); } diff --git a/algo/src/main/java/org/neo4j/gds/wcc/WccAlgorithmFactory.java b/algo/src/main/java/org/neo4j/gds/wcc/WccAlgorithmFactory.java index 12452cfa332..130ae57ecce 100644 --- a/algo/src/main/java/org/neo4j/gds/wcc/WccAlgorithmFactory.java +++ b/algo/src/main/java/org/neo4j/gds/wcc/WccAlgorithmFactory.java @@ -21,8 +21,8 @@ import org.neo4j.gds.GraphAlgorithmFactory; import org.neo4j.gds.api.Graph; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; @@ -50,7 +50,7 @@ public Wcc build( } return new Wcc( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, ParallelUtil.DEFAULT_BATCH_SIZE, configuration, progressTracker diff --git a/algo/src/test/java/org/neo4j/gds/allshortestpaths/MSBFSAllShortestPathsTest.java b/algo/src/test/java/org/neo4j/gds/allshortestpaths/MSBFSAllShortestPathsTest.java index c12834b6ba3..4a817d7be80 100644 --- a/algo/src/test/java/org/neo4j/gds/allshortestpaths/MSBFSAllShortestPathsTest.java +++ b/algo/src/test/java/org/neo4j/gds/allshortestpaths/MSBFSAllShortestPathsTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.Graph; import org.neo4j.gds.config.ConcurrencyConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.graphbuilder.GraphBuilder; import static org.junit.jupiter.api.Assertions.fail; @@ -76,7 +76,7 @@ void testResults() { .addRelationshipType(RELATIONSHIP) .build() .graph(); - testASP(new MSBFSAllShortestPaths(graph, ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT)); + testASP(new MSBFSAllShortestPaths(graph, ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE)); } private void testASP(final MSBFSASPAlgorithm hugeMSBFSAllShortestPaths) { diff --git a/algo/src/test/java/org/neo4j/gds/allshortestpaths/WeightedAllShortestPathsTest.java b/algo/src/test/java/org/neo4j/gds/allshortestpaths/WeightedAllShortestPathsTest.java index 3a58d13e787..53defe79ee9 100644 --- a/algo/src/test/java/org/neo4j/gds/allshortestpaths/WeightedAllShortestPathsTest.java +++ b/algo/src/test/java/org/neo4j/gds/allshortestpaths/WeightedAllShortestPathsTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.PropertyMapping; import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.graphbuilder.GraphBuilder; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -88,7 +88,7 @@ void testResults() { final ResultConsumer mock = mock(ResultConsumer.class); - new WeightedAllShortestPaths(graph, Pools.DEFAULT, 4) + new WeightedAllShortestPaths(graph, DefaultPool.INSTANCE, 4) .compute() .forEach(r -> { assertNotEquals(Double.POSITIVE_INFINITY, r.distance); @@ -115,7 +115,7 @@ void shouldThrowIfGraphHasNoRelationshipProperty() { .graph(); UnsupportedOperationException exception = assertThrows(UnsupportedOperationException.class, () -> { - new WeightedAllShortestPaths(graph, Pools.DEFAULT, 4); + new WeightedAllShortestPaths(graph, DefaultPool.INSTANCE, 4); }); assertTrue(exception.getMessage().contains("not supported")); diff --git a/algo/src/test/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutTest.java b/algo/src/test/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutTest.java index 397ac21f29e..8a9b33b6b20 100644 --- a/algo/src/test/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutTest.java +++ b/algo/src/test/java/org/neo4j/gds/approxmaxkcut/ApproxMaxKCutTest.java @@ -28,7 +28,7 @@ import org.neo4j.gds.collections.haa.HugeAtomicDoubleArray; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.paged.HugeByteArray; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; @@ -172,7 +172,7 @@ void computeCorrectResults( var graph = minimize ? minGraph : maxGraph; var approxMaxKCut = new ApproxMaxKCut( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); @@ -214,7 +214,7 @@ void respectMinCommunitySizes(int concurrency) { var approxMaxKCut = new ApproxMaxKCut( maxGraph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/betweenness/BetweennessCentralityTest.java b/algo/src/test/java/org/neo4j/gds/betweenness/BetweennessCentralityTest.java index 161554b0ec3..dee1368f0c6 100644 --- a/algo/src/test/java/org/neo4j/gds/betweenness/BetweennessCentralityTest.java +++ b/algo/src/test/java/org/neo4j/gds/betweenness/BetweennessCentralityTest.java @@ -29,7 +29,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -141,7 +141,7 @@ void sampling(int concurrency, TestGraph graph, int samplingSize, Map selectionStrategy.next())).containsExactly( graph.toMappedNodeId("a"), @@ -107,9 +107,9 @@ void neverIncludeZeroDegNodesIfBetterChoicesExist() { TestGraph graph = fromGdl("(), (), (), (), (), (a)-->(), (), (), ()"); SelectionStrategy selectionStrategy = new RandomDegreeSelectionStrategy(1); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); assertEquals(1, samplingSize(selectionStrategy)); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); assertEquals(graph.toMappedNodeId("a"), selectionStrategy.next()); } @@ -118,18 +118,18 @@ void not100PercentLikelyUnlessMaxDegNode() { TestGraph graph = fromGdl("(a)-->(b), (b)-->(c), (b)-->(d)"); SelectionStrategy selectionStrategy = new RandomDegreeSelectionStrategy(1, Optional.of(42L)); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); assertEquals(1, samplingSize(selectionStrategy)); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); assertEquals(graph.toMappedNodeId("b"), selectionStrategy.next()); } @Test void selectHighDegreeNode() { SelectionStrategy selectionStrategy = new RandomDegreeSelectionStrategy(1); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); assertEquals(1, samplingSize(selectionStrategy)); - selectionStrategy.init(graph, Pools.DEFAULT, 1); + selectionStrategy.init(graph, DefaultPool.INSTANCE, 1); var isA = selectionStrategy.next(); var isB = selectionStrategy.next(); assertTrue(isA != SelectionStrategy.NONE_SELECTED || isB != SelectionStrategy.NONE_SELECTED); diff --git a/algo/src/test/java/org/neo4j/gds/betweenness/WeightedBetweennessCentralityTest.java b/algo/src/test/java/org/neo4j/gds/betweenness/WeightedBetweennessCentralityTest.java index f7a7a33f86c..6b1d8db1526 100644 --- a/algo/src/test/java/org/neo4j/gds/betweenness/WeightedBetweennessCentralityTest.java +++ b/algo/src/test/java/org/neo4j/gds/betweenness/WeightedBetweennessCentralityTest.java @@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.Graph; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -86,7 +86,7 @@ void shouldEqualWithUnweightedWhenWeightsAreEqual() { equallyWeightedGraph, new RandomDegreeSelectionStrategy(7, Optional.of(42L)), ForwardTraverser.Factory.weighted(), - Pools.DEFAULT, + DefaultPool.INSTANCE, 8, ProgressTracker.NULL_TRACKER ); @@ -94,7 +94,7 @@ void shouldEqualWithUnweightedWhenWeightsAreEqual() { equallyWeightedGraph, new RandomDegreeSelectionStrategy(7, Optional.of(42L)), ForwardTraverser.Factory.unweighted(), - Pools.DEFAULT, + DefaultPool.INSTANCE, 8, ProgressTracker.NULL_TRACKER ); @@ -119,7 +119,7 @@ void shouldComputeWithWeights() { weightedGraph, new RandomDegreeSelectionStrategy(7, Optional.of(42L)), ForwardTraverser.Factory.weighted(), - Pools.DEFAULT, + DefaultPool.INSTANCE, 8, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDirectedTest.java b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDirectedTest.java index 2b24a33c676..df826b3294b 100644 --- a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDirectedTest.java +++ b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDirectedTest.java @@ -20,7 +20,7 @@ package org.neo4j.gds.closeness; import org.junit.jupiter.api.Test; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -88,7 +88,7 @@ void testCentrality() { var algo = ClosenessCentrality.of( graph, ImmutableClosenessCentralityStreamConfig.builder().build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -108,7 +108,7 @@ void testCentralityWithWassermanFaust() { var algo = ClosenessCentrality.of( graph, ImmutableClosenessCentralityStreamConfig.builder().useWassermanFaust(true).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDiscoTest.java b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDiscoTest.java index 2a0fb88d9d6..c2256052152 100644 --- a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDiscoTest.java +++ b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityDiscoTest.java @@ -22,7 +22,7 @@ import org.assertj.core.data.Offset; import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -67,7 +67,7 @@ void testHuge() { var algo = ClosenessCentrality.of( graph, ImmutableClosenessCentralityStreamConfig.builder().concurrency(2).useWassermanFaust(true).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityTest.java b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityTest.java index 46702494f6d..eaa49008d1f 100644 --- a/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityTest.java +++ b/algo/src/test/java/org/neo4j/gds/closeness/ClosenessCentralityTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.TestProgressTracker; import org.neo4j.gds.compat.Neo4jProxy; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -93,7 +93,7 @@ void testGetCentrality() { var algo = ClosenessCentrality.of( graph, ImmutableClosenessCentralityStreamConfig.builder().build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -116,7 +116,7 @@ void shouldLogProgress() { var algo = ClosenessCentrality.of( graph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); diff --git a/algo/src/test/java/org/neo4j/gds/conductance/ConductanceTest.java b/algo/src/test/java/org/neo4j/gds/conductance/ConductanceTest.java index 3e8ca895100..a5045d4cd22 100644 --- a/algo/src/test/java/org/neo4j/gds/conductance/ConductanceTest.java +++ b/algo/src/test/java/org/neo4j/gds/conductance/ConductanceTest.java @@ -28,7 +28,7 @@ import org.neo4j.gds.TestSupport; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.TaskProgressTracker; @@ -134,7 +134,7 @@ void computeCorrectResults( var conductance = new Conductance( orientation == Orientation.NATURAL ? naturalGraph : undirectedGraph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/degree/DegreeCentralityTest.java b/algo/src/test/java/org/neo4j/gds/degree/DegreeCentralityTest.java index bb38b51b23b..e3f795a479f 100644 --- a/algo/src/test/java/org/neo4j/gds/degree/DegreeCentralityTest.java +++ b/algo/src/test/java/org/neo4j/gds/degree/DegreeCentralityTest.java @@ -28,7 +28,7 @@ import org.neo4j.gds.TestProgressTracker; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; @@ -148,7 +148,7 @@ void shouldComputeCorrectResults(boolean weighted, Orientation orientation, Map< var degreeCentrality = new DegreeCentrality( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); @@ -200,7 +200,7 @@ void testProgressLogging(boolean weighted) { var progressTracker = new TestProgressTracker(progressTask, log, 1, EmptyTaskRegistryFactory.INSTANCE); var degreeCentrality = new DegreeCentrality( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, progressTracker ); @@ -225,7 +225,7 @@ void shouldSupportAllOrientations(Orientation orientation) { var degreeCentrality = new DegreeCentrality( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, config, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/fastrp/FastRPTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/fastrp/FastRPTest.java index 451e7ff643b..2d549b3b577 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/fastrp/FastRPTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/fastrp/FastRPTest.java @@ -31,7 +31,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.ArrayIdMap; import org.neo4j.gds.core.loading.LabelInformationBuilders; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -626,7 +626,7 @@ void shouldBeDeterministicGivenSameOriginalIds() { .nodes(firstIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var secondMappedToOriginal = HugeLongArray.newArray(nodeCount); @@ -650,7 +650,7 @@ void shouldBeDeterministicGivenSameOriginalIds() { .nodes(secondIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var random = new SplittableRandom(42); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageEmbeddingsGeneratorTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageEmbeddingsGeneratorTest.java index 5cfed409328..a1b4fe0032d 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageEmbeddingsGeneratorTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageEmbeddingsGeneratorTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.params.provider.EnumSource; import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.CSRGraphStore; import org.neo4j.gds.core.utils.paged.HugeObjectArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -74,7 +74,7 @@ void makesEmbeddings(Aggregator.AggregatorType aggregatorType) { var features = GraphSageHelper.initializeSingleLabelFeatures(weightedGraph, config); - var trainModel = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainModel = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); GraphSageModelTrainer.ModelTrainResult result = trainModel.train(weightedGraph, features); @@ -84,7 +84,7 @@ void makesEmbeddings(Aggregator.AggregatorType aggregatorType) { config.concurrency(), new SingleLabelFeatureFunction(), config.randomSeed(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -112,7 +112,7 @@ void makesEmbeddingsFromMultiLabelModel(Aggregator.AggregatorType aggregatorType var trainer = new MultiLabelGraphSageTrain( weightedGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -125,7 +125,7 @@ void makesEmbeddingsFromMultiLabelModel(Aggregator.AggregatorType aggregatorType config.concurrency(), model.data().featureFunction(), model.trainConfig().randomSeed(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -167,7 +167,7 @@ void embeddingsForNodeFilteredGraph() { var trainer = new SingleLabelGraphSageTrain( filteredGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -180,7 +180,7 @@ void embeddingsForNodeFilteredGraph() { config.concurrency(), model.data().featureFunction(), model.trainConfig().randomSeed(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageModelTrainerTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageModelTrainerTest.java index 71fb4e5276e..93c3cdc0221 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageModelTrainerTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageModelTrainerTest.java @@ -34,7 +34,7 @@ import org.neo4j.gds.beta.generator.PropertyProducer; import org.neo4j.gds.beta.generator.RandomGraphGenerator; import org.neo4j.gds.beta.generator.RelationshipDistribution; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeObjectArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.embeddings.graphsage.algo.GraphSageTrainConfigImpl; @@ -120,7 +120,7 @@ void trainsWithRelationshipWeight(AggregatorType aggregatorType) { .modelUser("") .build(); - var trainModel = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainModel = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); int nodeCount = 5_000; var bigGraph = RandomGraphGenerator @@ -160,7 +160,7 @@ void trainsWithMeanAggregator(boolean useRelationshipWeight) { .modelName(MODEL_NAME) .build(); - var trainModel = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainModel = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); var maybeWeights = useRelationshipWeight ? Optional.of("times") : Optional.empty(); @@ -201,7 +201,7 @@ void trainsWithPoolAggregator(boolean useRelationshipWeight) { .modelName(MODEL_NAME) .build(); - var trainModel = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainModel = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); GraphSageModelTrainer.ModelTrainResult result = trainModel.train(graph, features); Layer[] layers = result.layers(); @@ -251,7 +251,7 @@ void shouldTrainModelWithArrayProperties() { .modelUser("") .build(); - var trainer = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainer = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); var result = trainer.train(arrayGraph, arrayFeatures); @@ -276,7 +276,7 @@ void testLosses() { var trainer = new GraphSageModelTrainer( config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -309,7 +309,7 @@ void testLossesWithPoolAggregator() { var trainer = new GraphSageModelTrainer( config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -329,7 +329,7 @@ void testLossesWithPoolAggregator() { void testConvergence() { var trainer = new GraphSageModelTrainer( configBuilder.modelName("convergingModel:)").tolerance(100.0).epochs(10).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -355,13 +355,13 @@ void batchesPerIteration() { var trainResultWithoutSampling = new GraphSageModelTrainer( configBuilder.maybeBatchSamplingRatio(1.0).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).train(unweightedGraph, features); var trainResultWithSampling = new GraphSageModelTrainer( configBuilder.maybeBatchSamplingRatio(0.01).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).train(unweightedGraph, features); @@ -386,7 +386,7 @@ void l2Penalty(double penalty, double expectedLoss) { var result = new GraphSageModelTrainer( config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).train(unweightedGraph, features); @@ -404,8 +404,8 @@ void seededSingleBatch(long seed) { .concurrency(1) .build(); - var trainer = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); - var otherTrainer = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainer = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); + var otherTrainer = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); var result = trainer.train(unweightedGraph, features); var otherResult = otherTrainer.train(unweightedGraph, features); @@ -424,8 +424,8 @@ void seededMultiBatch(long seed) { .batchSize(5) .build(); - var trainer = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); - var otherTrainer = new GraphSageModelTrainer(config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var trainer = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); + var otherTrainer = new GraphSageModelTrainer(config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); var result = trainer.train(unweightedGraph, features); var otherResult = otherTrainer.train(unweightedGraph, features); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageTest.java index a201bb9f114..eb6f3cd9b89 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/GraphSageTest.java @@ -35,7 +35,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.config.RandomGraphGeneratorConfig; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.loading.CSRGraphStoreUtil; import org.neo4j.gds.core.loading.construction.NodeLabelTokens; @@ -146,7 +146,7 @@ void shouldNotMakeNanEmbeddings(Aggregator.AggregatorType aggregator) { var trainAlgo = new SingleLabelGraphSageTrain( orphanGraph, trainConfig, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -180,7 +180,7 @@ void differentTrainAndPredictionGraph() { .concurrency(1) .build(); - var graphSageTrain = new SingleLabelGraphSageTrain(graph, trainConfig, Pools.DEFAULT, ProgressTracker.NULL_TRACKER, testGdsVersion); + var graphSageTrain = new SingleLabelGraphSageTrain(graph, trainConfig, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion); var model = graphSageTrain.compute(); @@ -205,7 +205,7 @@ void differentTrainAndPredictionGraph() { .batchSize(2) .build(); - var graphSage = new GraphSage(trainGraph, model, streamConfig, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var graphSage = new GraphSage(trainGraph, model, streamConfig, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); assertThat(graphSage.compute().embeddings().size()).isEqualTo(predictNodeCount); } diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/algo/MultiLabelGraphSageTrainTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/algo/MultiLabelGraphSageTrainTest.java index b4c98ffb212..58aac3b66b2 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/algo/MultiLabelGraphSageTrainTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/graphsage/algo/MultiLabelGraphSageTrainTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.embeddings.graphsage.ActivationFunction; import org.neo4j.gds.embeddings.graphsage.Aggregator; @@ -98,7 +98,7 @@ void shouldRunWithDifferentProjectedFeatureSizes(String name, GraphSageTrainConf var multiLabelGraphSageTrain = new MultiLabelGraphSageTrain( weightedGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -119,7 +119,7 @@ void shouldStoreMultiLabelFeatureFunctionInModel() { var multiLabelGraphSageTrain = new MultiLabelGraphSageTrain( weightedGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -148,7 +148,7 @@ void runsTrainingOnMultiLabelGraph() { var graphSageTrain = new MultiLabelGraphSageTrain( weightedGraph, graphSageTrainConfig, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -191,7 +191,7 @@ void shouldFailUnequalLengthArrays() { var multiLabelGraphSageTrain = new MultiLabelGraphSageTrain( unequalGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); @@ -216,7 +216,7 @@ void shouldFailMissingArrayProperty(Graph graph, String property, long missingNo var multiLabelGraphSageTrain = new MultiLabelGraphSageTrain( graph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER, testGdsVersion ); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNTest.java index a2e414e07b8..e830ae44650 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/hashgnn/HashGNNTest.java @@ -36,7 +36,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.GraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.ArrayIdMap; import org.neo4j.gds.core.loading.LabelInformationBuilders; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -422,7 +422,7 @@ void shouldBeDeterministicGivenSameOriginalIds() { .nodes(firstIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var secondMappedToOriginal = HugeLongArray.newArray(nodeCount); @@ -446,7 +446,7 @@ void shouldBeDeterministicGivenSameOriginalIds() { .nodes(secondIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var random = new SplittableRandom(42); diff --git a/algo/src/test/java/org/neo4j/gds/embeddings/node2vec/Node2VecTest.java b/algo/src/test/java/org/neo4j/gds/embeddings/node2vec/Node2VecTest.java index 06712e2221c..8b4ede616d6 100644 --- a/algo/src/test/java/org/neo4j/gds/embeddings/node2vec/Node2VecTest.java +++ b/algo/src/test/java/org/neo4j/gds/embeddings/node2vec/Node2VecTest.java @@ -44,7 +44,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.GraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.ArrayIdMap; import org.neo4j.gds.core.loading.LabelInformationBuilders; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -280,7 +280,7 @@ void shouldBeFairlyConsistentUnderOriginalIds(EmbeddingInitializer embeddingInit .nodes(firstIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var secondMappedToOriginal = HugeLongArray.newArray(nodeCount); @@ -302,7 +302,7 @@ void shouldBeFairlyConsistentUnderOriginalIds(EmbeddingInitializer embeddingInit .nodes(secondIdMap) .relationshipType(RelationshipType.of("REL")) .orientation(Orientation.UNDIRECTED) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); var random = new SplittableRandom(42); diff --git a/algo/src/test/java/org/neo4j/gds/harmonic/HarmonicCentralityTest.java b/algo/src/test/java/org/neo4j/gds/harmonic/HarmonicCentralityTest.java index d1129e9da9d..99009e5bb62 100644 --- a/algo/src/test/java/org/neo4j/gds/harmonic/HarmonicCentralityTest.java +++ b/algo/src/test/java/org/neo4j/gds/harmonic/HarmonicCentralityTest.java @@ -24,7 +24,7 @@ import org.neo4j.gds.TestProgressTracker; import org.neo4j.gds.api.Graph; import org.neo4j.gds.compat.Neo4jProxy; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Tasks; @@ -67,7 +67,7 @@ void shouldComputeHarmonicCentrality() { var harmonicCentrality = new HarmonicCentrality( graph, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -89,7 +89,7 @@ void testLogging() { var algo = new HarmonicCentrality( graph, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); diff --git a/algo/src/test/java/org/neo4j/gds/indexInverse/InverseRelationshipsTest.java b/algo/src/test/java/org/neo4j/gds/indexInverse/InverseRelationshipsTest.java index a5f46a2c531..9e17be857dd 100644 --- a/algo/src/test/java/org/neo4j/gds/indexInverse/InverseRelationshipsTest.java +++ b/algo/src/test/java/org/neo4j/gds/indexInverse/InverseRelationshipsTest.java @@ -27,7 +27,7 @@ import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.compat.Neo4jProxy; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -79,7 +79,7 @@ void shouldCreateIndexedRelationships(int concurrency) { graphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); assertThat(inverseRelationshipsPerType).hasSize(1); @@ -110,7 +110,7 @@ void shouldIndexMultipleTypes(Object relTypes) { graphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); assertThat(inverseRelationshipsPerType).hasSize(internalTypes.size()); diff --git a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnConnectedGraphTest.java b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnConnectedGraphTest.java index e406cadefdb..7125941382f 100644 --- a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnConnectedGraphTest.java +++ b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnConnectedGraphTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.Orientation; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.TaskProgressTracker; @@ -99,7 +99,7 @@ void testSpreadWithSeed1() { // gain[d|a,b,d,e] : 0 {a already activates d} 1(d) 1(d) = 2/3 =0.667 IdFunction idFunction = variable -> graph.toMappedNodeId(variable); - CELF celf = new CELF(graph, 5, 0.2, 3, Pools.DEFAULT, 2, 0, DEFAULT_BATCH_SIZE, + CELF celf = new CELF(graph, 5, 0.2, 3, DefaultPool.INSTANCE, 2, 0, DEFAULT_BATCH_SIZE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); var celfResult = celf.compute(); diff --git a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnTreeGraphTest.java b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnTreeGraphTest.java index 6831373860b..43198fb6275 100644 --- a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnTreeGraphTest.java +++ b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CELFOnTreeGraphTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -136,7 +136,7 @@ void testSpreadWithSeed1() { 5, 0.51, 3, - Pools.DEFAULT, + DefaultPool.INSTANCE, 1, 10, DEFAULT_BATCH_SIZE, diff --git a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CelfTest.java b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CelfTest.java index 282613cd08b..80e7254bdcc 100644 --- a/algo/src/test/java/org/neo4j/gds/influenceMaximization/CelfTest.java +++ b/algo/src/test/java/org/neo4j/gds/influenceMaximization/CelfTest.java @@ -24,7 +24,7 @@ import org.neo4j.gds.api.schema.Direction; import org.neo4j.gds.beta.generator.RandomGraphGenerator; import org.neo4j.gds.beta.generator.RelationshipDistribution; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import static org.assertj.core.api.Assertions.assertThat; @@ -44,7 +44,7 @@ void shouldNotReturnNegativeGains(int seedSize) { .build() .generate(); - var celf = new CELF(graph, seedSize, 0.1, 3, Pools.DEFAULT, 1, 10, 5, ProgressTracker.NULL_TRACKER).compute(); + var celf = new CELF(graph, seedSize, 0.1, 3, DefaultPool.INSTANCE, 1, 10, 5, ProgressTracker.NULL_TRACKER).compute(); for (var a : celf) { assertThat(a.value).isNotNegative(); } diff --git a/algo/src/test/java/org/neo4j/gds/k1coloring/K1ColoringTest.java b/algo/src/test/java/org/neo4j/gds/k1coloring/K1ColoringTest.java index 252cdff3b0a..121bd5ca2a9 100644 --- a/algo/src/test/java/org/neo4j/gds/k1coloring/K1ColoringTest.java +++ b/algo/src/test/java/org/neo4j/gds/k1coloring/K1ColoringTest.java @@ -32,7 +32,7 @@ import org.neo4j.gds.core.Aggregation; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -69,7 +69,7 @@ void testK1Coloring() { 1000, DEFAULT_BATCH_SIZE, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -110,7 +110,7 @@ void testParallelK1Coloring() { 100, DEFAULT_BATCH_SIZE, 8, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -177,7 +177,7 @@ void everyNodeShouldHaveBeenColored() { 100, DEFAULT_BATCH_SIZE, 8, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -214,7 +214,7 @@ void shouldLogProgress(){ config.maxIterations(), DEFAULT_BATCH_SIZE, config.concurrency(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); diff --git a/algo/src/test/java/org/neo4j/gds/labelpropagation/LabelPropagationTest.java b/algo/src/test/java/org/neo4j/gds/labelpropagation/LabelPropagationTest.java index 4c2ead6bfc8..2f60b5a3989 100644 --- a/algo/src/test/java/org/neo4j/gds/labelpropagation/LabelPropagationTest.java +++ b/algo/src/test/java/org/neo4j/gds/labelpropagation/LabelPropagationTest.java @@ -29,7 +29,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -83,7 +83,7 @@ void shouldUseOriginalNodeIdWhenSeedPropertyIsMissing() { LabelPropagation lp = new LabelPropagation( graph, ImmutableLabelPropagationStreamConfig.builder().maxIterations(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); assertArrayEquals( @@ -109,7 +109,7 @@ void shouldUseSeedProperty() { .seedProperty("seedId") .maxIterations(1) .build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -146,7 +146,7 @@ private void testLPClustering(Graph graph, int batchSize) { LabelPropagation lp = new LabelPropagation( graph, DEFAULT_CONFIG, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); lp.withBatchSize(batchSize); @@ -202,7 +202,7 @@ void shouldLogProgress() { var lp = new LabelPropagation( graph, DEFAULT_CONFIG, - Pools.DEFAULT, + DefaultPool.INSTANCE, testTracker ); diff --git a/algo/src/test/java/org/neo4j/gds/labelpropagation/NonStabilizingLabelPropagationTest.java b/algo/src/test/java/org/neo4j/gds/labelpropagation/NonStabilizingLabelPropagationTest.java index acfea1e94fb..aa25dc610c9 100644 --- a/algo/src/test/java/org/neo4j/gds/labelpropagation/NonStabilizingLabelPropagationTest.java +++ b/algo/src/test/java/org/neo4j/gds/labelpropagation/NonStabilizingLabelPropagationTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -62,7 +62,7 @@ void testLabelPropagationDoesStabilize() { LabelPropagation labelPropagation = new LabelPropagation( graph, ImmutableLabelPropagationStreamConfig.builder().build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); LabelPropagationResult compute = labelPropagation.compute(); diff --git a/algo/src/test/java/org/neo4j/gds/leiden/GraphAggregationPhaseTest.java b/algo/src/test/java/org/neo4j/gds/leiden/GraphAggregationPhaseTest.java index 10b2236fcf8..93cd013212f 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/GraphAggregationPhaseTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/GraphAggregationPhaseTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.schema.Direction; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -79,7 +79,7 @@ void testGraphAggregation() { Direction.UNDIRECTED, communities, 1L, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, 4, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER diff --git a/algo/src/test/java/org/neo4j/gds/leiden/GraphWithSelfLoopTest.java b/algo/src/test/java/org/neo4j/gds/leiden/GraphWithSelfLoopTest.java index a82da2cf43b..7724f5827e7 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/GraphWithSelfLoopTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/GraphWithSelfLoopTest.java @@ -23,7 +23,8 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.schema.Direction; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -70,7 +71,7 @@ void shouldCalculateModularityCorrectly() { 1.0 / graph.relationshipCount(), 1.0 / graph.relationshipCount(), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); @@ -86,7 +87,7 @@ void shouldAggregateCorrectly(){ Direction.UNDIRECTED, communities, 2L, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, 4, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER @@ -121,7 +122,7 @@ void shouldMaintainPartition() { Direction.UNDIRECTED, refinedCommunities, 2, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, 1, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER @@ -164,7 +165,7 @@ void shouldCalculateModularityInSummaryGraph() { Direction.UNDIRECTED, localCommunities, 2, - Pools.DEFAULT, + DefaultPool.INSTANCE, 1, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER @@ -180,7 +181,7 @@ void shouldCalculateModularityInSummaryGraph() { 1.0 / graph.relationshipCount(), 1.0 / graph.relationshipCount(), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/leiden/LeidenTest.java b/algo/src/test/java/org/neo4j/gds/leiden/LeidenTest.java index 2685788beb0..7f1d0c56d85 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/LeidenTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/LeidenTest.java @@ -30,7 +30,7 @@ import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.config.RandomGraphGeneratorConfig; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -219,7 +219,7 @@ void shouldMaintainPartition() { Direction.UNDIRECTED, refinedCommunities, 4, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, 1, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER diff --git a/algo/src/test/java/org/neo4j/gds/leiden/ModularityComputerTest.java b/algo/src/test/java/org/neo4j/gds/leiden/ModularityComputerTest.java index 9264951ada4..5d11a2e780b 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/ModularityComputerTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/ModularityComputerTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.schema.Direction; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -83,7 +83,7 @@ void shouldCalculateModularityCorrectly() { 1.0 / graph.relationshipCount(), 1.0 / graph.relationshipCount(), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); assertThat(modularity).isCloseTo(0.4230, Offset.offset(1e-3)); @@ -102,7 +102,7 @@ void shouldCalculateModularityInSummaryGraph() { Direction.UNDIRECTED, localCommunities, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, 1, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER @@ -116,7 +116,7 @@ void shouldCalculateModularityInSummaryGraph() { 1.0 / graph.relationshipCount(), 1.0 / graph.relationshipCount(), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); assertThat(modularity).isCloseTo(0.4230, Offset.offset(1e-3)); diff --git a/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseKarateTest.java b/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseKarateTest.java index 89a8ebc17d3..cab2f6b6dcd 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseKarateTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseKarateTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -73,7 +73,7 @@ void testRefinementPhase() { 0.01, 19L, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseTest.java b/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseTest.java index 2321b3638c9..f9597a50a14 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/RefinementPhaseTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -80,7 +80,7 @@ void shouldRefine() { 0.01, 19L, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); var refinementResult = refinement.run(); diff --git a/algo/src/test/java/org/neo4j/gds/leiden/WeightedModularityComputerTest.java b/algo/src/test/java/org/neo4j/gds/leiden/WeightedModularityComputerTest.java index 65f3fbd70e4..92de2482424 100644 --- a/algo/src/test/java/org/neo4j/gds/leiden/WeightedModularityComputerTest.java +++ b/algo/src/test/java/org/neo4j/gds/leiden/WeightedModularityComputerTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.schema.Direction; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -84,7 +84,7 @@ void shouldCalculateModularityCorrectly() { 1.0 / (4.0 * graph.relationshipCount()), 1.0 / (4.0 * graph.relationshipCount()), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); assertThat(modularity).isCloseTo(0.4230, Offset.offset(1e-3)); @@ -103,7 +103,7 @@ void shouldCalculateModularityInSummaryGraph() { Direction.UNDIRECTED, localCommunities, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, 1, TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER @@ -117,7 +117,7 @@ void shouldCalculateModularityInSummaryGraph() { 1.0 / (4 * graph.relationshipCount()), 1.0 / (4 * graph.relationshipCount()), 4, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.EmptyProgressTracker.NULL_TRACKER ); assertThat(modularity).isCloseTo(0.4230, Offset.offset(1e-3)); diff --git a/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java b/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java index 65f52d8f258..db34cff670a 100644 --- a/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java +++ b/algo/src/test/java/org/neo4j/gds/louvain/LouvainTest.java @@ -36,7 +36,7 @@ import org.neo4j.gds.core.Aggregation; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.mem.MemoryRange; @@ -155,7 +155,7 @@ void testUnweighted() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -204,7 +204,7 @@ void testWeighted() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -253,7 +253,7 @@ void testSeeded() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -304,7 +304,7 @@ void testTolerance() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -340,7 +340,7 @@ void testMaxLevels() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -457,7 +457,7 @@ void testCanBeInterruptedByTxCancellation() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); louvain.setTerminationFlag(terminationFlag); @@ -494,7 +494,7 @@ void testLogging() { config.tolerance(), config.concurrency(), progressTracker, - Pools.DEFAULT + DefaultPool.INSTANCE ); @@ -522,7 +522,7 @@ void shouldThrowOnNegativeSeed() { config.tolerance(), config.concurrency(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); algorithm.setTerminationFlag(TerminationFlag.RUNNING_TRUE); @@ -554,7 +554,7 @@ void shouldGiveSameResultWithCalculator() { TOLERANCE_DEFAULT, 4, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var result = louvain.compute(); diff --git a/algo/src/test/java/org/neo4j/gds/modularityoptimization/FootballTest.java b/algo/src/test/java/org/neo4j/gds/modularityoptimization/FootballTest.java index dfb8f26d47c..458b1b3bd09 100644 --- a/algo/src/test/java/org/neo4j/gds/modularityoptimization/FootballTest.java +++ b/algo/src/test/java/org/neo4j/gds/modularityoptimization/FootballTest.java @@ -28,7 +28,7 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.compat.Neo4jProxy; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; @@ -127,7 +127,7 @@ private ModularityOptimizationResult compute( properties, concurrency, minBatchSize, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ).compute(); } diff --git a/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationTest.java b/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationTest.java index 482a520b223..96f2f5c0043 100644 --- a/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationTest.java +++ b/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationTest.java @@ -35,7 +35,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryTree; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.extension.GdlExtension; @@ -243,7 +243,7 @@ private ModularityOptimizationResult compute( properties, concurrency, minBatchSize, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ).compute(); } diff --git a/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationWithoutOrientationTest.java b/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationWithoutOrientationTest.java index 312d3ce0d26..db0ef84da0f 100644 --- a/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationWithoutOrientationTest.java +++ b/algo/src/test/java/org/neo4j/gds/modularityoptimization/ModularityOptimizationWithoutOrientationTest.java @@ -34,7 +34,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryTree; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.extension.GdlExtension; @@ -252,7 +252,7 @@ private ModularityOptimizationResult compute( properties, concurrency, minBatchSize, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ).compute(); } diff --git a/algo/src/test/java/org/neo4j/gds/msbfs/MultiSourceBFSAccessMethodsTest.java b/algo/src/test/java/org/neo4j/gds/msbfs/MultiSourceBFSAccessMethodsTest.java index 88a176bbf84..f0b4fd9a4a6 100644 --- a/algo/src/test/java/org/neo4j/gds/msbfs/MultiSourceBFSAccessMethodsTest.java +++ b/algo/src/test/java/org/neo4j/gds/msbfs/MultiSourceBFSAccessMethodsTest.java @@ -31,7 +31,7 @@ import org.neo4j.gds.api.RelationshipIterator; import org.neo4j.gds.api.RelationshipWithPropertyConsumer; import org.neo4j.gds.config.ConcurrencyConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.graphbuilder.DefaultBuilder; import org.neo4j.gds.graphbuilder.GraphBuilder; @@ -85,7 +85,7 @@ void testWithPredecessor() { new long[]{0, 1} ); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); verify(bfsConsumerMock).accept(1, 0, toList(1)); verify(bfsConsumerMock).accept(2, 0, toList(2)); @@ -126,7 +126,7 @@ void testWithANP() { new long[]{0, 1} ); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); verify(mock).accept(3, 1, toList(1, 2)); verify(mock).accept(4, 1, toList(1, 2)); @@ -148,7 +148,7 @@ void testPredecessorWithAllSources() { (i, p, d, s) -> mock.accept(i + 1, p + 1, d, toList(s, x -> x + 1)) ); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); verify(mock).accept(1, 3, 1, toList(3)); verify(mock).accept(1, 4, 1, toList(4)); @@ -199,7 +199,7 @@ void testANPWithAllSources() { (i, d, s) -> mock.accept(i + 1, d, toList(s, x -> x + 1)) ); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); verify(mock).accept(1, 1, toList(3, 4)); verify(mock).accept(2, 1, toList(3, 4)); @@ -270,7 +270,7 @@ void testParallel() { } } ); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); }); for (int i = 0; i < maxNodes; i++) { @@ -382,7 +382,7 @@ public Stream streamRelationships(long nodeId, double fallba } }, sources); - msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, Pools.DEFAULT); + msbfs.run(ConcurrencyConfig.DEFAULT_CONCURRENCY, DefaultPool.INSTANCE); for (int i = 0; i < seen.length; i++) { final int[] nodeSeen = seen[i]; diff --git a/algo/src/test/java/org/neo4j/gds/paths/delta/DeltaSteppingTest.java b/algo/src/test/java/org/neo4j/gds/paths/delta/DeltaSteppingTest.java index e20bd89e0d1..bf6470e3644 100644 --- a/algo/src/test/java/org/neo4j/gds/paths/delta/DeltaSteppingTest.java +++ b/algo/src/test/java/org/neo4j/gds/paths/delta/DeltaSteppingTest.java @@ -36,7 +36,7 @@ import org.neo4j.gds.beta.generator.RelationshipDistribution; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.GraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -142,7 +142,7 @@ void singleSource(double delta, int concurrency, long idOffset) { .build(); var paths = DeltaStepping - .of(graph, config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER) + .of(graph, config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER) .compute() .pathSet(); @@ -172,7 +172,7 @@ void singleSourceFromDisconnectedNode(double delta, int concurrency, long idOffs .build(); var paths = DeltaStepping - .of(graph, config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER) + .of(graph, config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER) .compute() .pathSet(); @@ -191,7 +191,7 @@ void shouldLogProgress() { var testLog = Neo4jProxy.testLog(); var progressTracker = new TestProgressTracker(progressTask, testLog, 1, EmptyTaskRegistryFactory.INSTANCE); - DeltaStepping.of(graph, config, Pools.DEFAULT, progressTracker) + DeltaStepping.of(graph, config, DefaultPool.INSTANCE, progressTracker) .compute() .pathSet(); @@ -279,7 +279,7 @@ void singleSource(double delta, int concurrency, long idOffset) { .build(); var paths = DeltaStepping - .of(graph, config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER) + .of(graph, config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER) .compute() .pathSet(); @@ -335,7 +335,7 @@ void singleSource(double delta, int concurrency, long idOffset) { .build(); var paths = DeltaStepping - .of(graph, config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER) + .of(graph, config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER) .compute() .pathSet(); @@ -369,7 +369,7 @@ void shouldGiveSameResultsAsDijkstra() { var deltaStepping = DeltaStepping.of( newGraph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); diff --git a/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesMissingPropsTest.java b/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesMissingPropsTest.java index 0ff42febad6..222f31e5be6 100644 --- a/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesMissingPropsTest.java +++ b/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesMissingPropsTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -55,7 +55,7 @@ void partialArrays() { .nodeProperties(List.of("arrayOn4", "arrayOn1")) .scaler(Max.buildFrom(CypherMapWrapper.empty())) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var result = algo.compute(); var resultProperties = result.scaledProperties().toArray(); @@ -73,7 +73,7 @@ void testMissingScalar() { .nodeProperties(List.of("a", "b", "c")) .scaler(StdScore.buildFrom(CypherMapWrapper.empty())) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var result = algo.compute(); var resultProperties = result.scaledProperties().toArray(); diff --git a/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesTest.java b/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesTest.java index 057477e127b..026fa49575f 100644 --- a/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesTest.java +++ b/algo/src/test/java/org/neo4j/gds/scaleproperties/ScalePropertiesTest.java @@ -31,7 +31,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.CypherMapWrapper; import org.neo4j.gds.core.GraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -79,7 +79,7 @@ void scaleSingleProperty() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .concurrency(1) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var result = algo.compute(); var resultProperties = result.scaledProperties().toArray(); @@ -98,7 +98,7 @@ void scaleMultipleProperties() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .concurrency(1) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var result = algo.compute(); var resultProperties = result.scaledProperties().toArray(); @@ -130,14 +130,14 @@ void parallelScale() { bigGraph, config.concurrency(4).build(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute().scaledProperties(); var expected = new ScaleProperties( bigGraph, config.concurrency(1).build(), ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute().scaledProperties(); IntStream.range(0, nodeCount).forEach(id -> assertEquals(expected.get(id)[0], parallelResult.get(id)[0])); @@ -150,7 +150,7 @@ void scaleArrayProperty() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .build(); - var actual = new ScaleProperties(graph, arrayConfig, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var actual = new ScaleProperties(graph, arrayConfig, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); @@ -159,7 +159,7 @@ void scaleArrayProperty() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .build(); - var expected = new ScaleProperties(graph, singlePropConfig, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var expected = new ScaleProperties(graph, singlePropConfig, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); @@ -175,13 +175,13 @@ void supportLongAndFloatArrays(String scaler) { var longArrayBConfig = baseConfigBuilder.nodeProperties(List.of("longArrayB")).build(); var doubleArrayBConfig = baseConfigBuilder.nodeProperties(List.of("floatArrayB")).build(); - var expected = new ScaleProperties(graph, bConfig, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var expected = new ScaleProperties(graph, bConfig, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); - var actualLong = new ScaleProperties(graph, longArrayBConfig, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var actualLong = new ScaleProperties(graph, longArrayBConfig, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); - var actualDouble = new ScaleProperties(graph, doubleArrayBConfig, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var actualDouble = new ScaleProperties(graph, doubleArrayBConfig, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); @@ -197,7 +197,7 @@ void supportDoubleArrays() { var config = baseConfigBuilder.nodeProperties(List.of("doubleArray")).build(); var expected = new double[][]{new double[]{0.0}, new double[]{0.2499999722444236}, new double[]{.5}, new double[]{0.7500000277555764}, new double[]{1.0}}; - var actual = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT) + var actual = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE) .compute() .scaledProperties(); @@ -211,7 +211,7 @@ void failOnArrayPropertyWithUnequalLength() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var error = assertThrows(IllegalArgumentException.class, algo::compute); assertThat(error.getMessage(), containsString( @@ -226,7 +226,7 @@ void failOnNonExistentProperty() { .scaler(MinMax.buildFrom(CypherMapWrapper.empty())) .build(); - var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, Pools.DEFAULT); + var algo = new ScaleProperties(graph, config, ProgressTracker.NULL_TRACKER, DefaultPool.INSTANCE); var error = assertThrows(IllegalArgumentException.class, algo::compute); assertThat(error.getMessage(), containsString("Node property `IMAGINARY_PROP` not found in graph")); diff --git a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTerminationTest.java b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTerminationTest.java index d3ae7902e0c..599fc2d1348 100644 --- a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTerminationTest.java +++ b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTerminationTest.java @@ -23,7 +23,7 @@ import org.neo4j.gds.BaseTest; import org.neo4j.gds.beta.generator.RandomGraphGenerator; import org.neo4j.gds.beta.generator.RelationshipDistribution; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import static org.neo4j.gds.graphbuilder.TransactionTerminationTestUtils.assertTerminates; @@ -44,7 +44,7 @@ void shouldTerminate() { var nodeSimilarity = NodeSimilarity.create( graph, NodeSimilarityTest.configBuilder().concurrency(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); nodeSimilarity.setTerminationFlag(terminationFlag); diff --git a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java index 17d10622ca4..4e8a2448643 100644 --- a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java +++ b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityTest.java @@ -32,7 +32,7 @@ import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.mem.MemoryEstimations; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.mem.MemoryTree; @@ -291,7 +291,7 @@ void shouldComputeWeightedForSupportedDirections(Orientation orientation, int co NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().relationshipWeightProperty("prop").concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -311,7 +311,7 @@ void shouldComputeForSupportedDirections(Orientation orientation, int concurrenc NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -331,7 +331,7 @@ void shouldComputeTopNForSupportedDirections(Orientation orientation, int concur NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).topN(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -351,7 +351,7 @@ void shouldComputeNegativeTopNForSupportedDirections(Orientation orientation, in NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).bottomN(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -373,7 +373,7 @@ void shouldComputeTopKForSupportedDirections(Orientation orientation, int concur NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().topK(1).concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -397,7 +397,7 @@ void shouldComputeNegativeTopKForSupportedDirections(Orientation orientation, in .topK(10) .bottomK(1) .build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -427,7 +427,7 @@ void shouldComputeWithSimilarityCutoffForSupportedDirections(Orientation orienta NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).similarityCutoff(0.1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -450,7 +450,7 @@ void shouldComputeWithDegreeCutoffForSupportedDirections(Orientation orientation NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().degreeCutoff(2).concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -471,7 +471,7 @@ void shouldComputeForUndirectedGraphs(int concurrency) { NodeSimilarity nodeSimilarity = NodeSimilarity.create( undirectedGraph, configBuilder().concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); Set result = nodeSimilarity.computeToStream().collect(Collectors.toSet()); @@ -483,7 +483,7 @@ void shouldComputeForUnionGraphs() { NodeSimilarity nodeSimilarity = NodeSimilarity.create( naturalGraph, configBuilder().concurrency(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); var result1 = nodeSimilarity.computeToStream().collect(Collectors.toSet()); @@ -491,7 +491,7 @@ void shouldComputeForUnionGraphs() { nodeSimilarity = NodeSimilarity.create( naturalUnionGraph, configBuilder().concurrency(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); var result2 = nodeSimilarity.computeToStream().collect(Collectors.toSet()); @@ -507,7 +507,7 @@ void shouldComputeSimilarityGraphInAllSupportedDirections(Orientation orientatio NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -558,7 +558,7 @@ void shouldComputeToGraphWithUnusedNodesInInputGraph(Orientation orientation, in .topK(100) .topN(1) .build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -596,7 +596,7 @@ void shouldIgnoreLoops(Orientation orientation, int concurrency) { NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).topN(1).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -623,7 +623,7 @@ void shouldIgnoreParallelEdges(Orientation orientation, int concurrency) { NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(concurrency).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -840,7 +840,7 @@ void shouldLogProgress(int concurrency) { NodeSimilarity.create( graph, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ).compute().streamResult().count(); @@ -880,7 +880,7 @@ void shouldGiveCorrectResultsWithOverlap() { NodeSimilarity nodeSimilarity = NodeSimilarity.create( graph, configBuilder().concurrency(1).similarityMetric(MetricSimilarityComputer.parse("ovErLaP")).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -898,7 +898,7 @@ void shouldGiveCorrectResultsWithOverlap() { .concurrency(1) .similarityMetric(MetricSimilarityComputer.parse("ovErLaP")) .build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -934,7 +934,7 @@ void shouldWorkForAllDegreeBoundsCombinations(int lowBound, int upperBound, Stri NodeSimilarity nodeSimilarity = NodeSimilarity.create( naturalGraph, configBuilder().upperDegreeCutoff(upperBound).degreeCutoff(lowBound).build(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/SimilarityGraphBuilderTest.java b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/SimilarityGraphBuilderTest.java index d71a5bb42ba..858524a05f0 100644 --- a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/SimilarityGraphBuilderTest.java +++ b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/SimilarityGraphBuilderTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.NodeLabel; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.huge.UnionGraph; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -73,7 +73,7 @@ void testConstructionFromHugeGraph() { SimilarityGraphBuilder similarityGraphBuilder = new SimilarityGraphBuilder( unlabelledGraph, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, TerminationFlag.RUNNING_TRUE ); @@ -96,7 +96,7 @@ void testConstructionFromUnionGraph() { SimilarityGraphBuilder similarityGraphBuilder = new SimilarityGraphBuilder( graph, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, TerminationFlag.RUNNING_TRUE ); @@ -131,7 +131,7 @@ void testConstructFromFilteredGraph() { SimilarityGraphBuilder similarityGraphBuilder = new SimilarityGraphBuilder( filteredIdMap, 1, - Pools.DEFAULT, + DefaultPool.INSTANCE, TerminationFlag.RUNNING_TRUE ); diff --git a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/UnionGraphWeightedNodeSimilarityTest.java b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/UnionGraphWeightedNodeSimilarityTest.java index 0c4ab250cad..b7c371db0d7 100644 --- a/algo/src/test/java/org/neo4j/gds/similarity/nodesim/UnionGraphWeightedNodeSimilarityTest.java +++ b/algo/src/test/java/org/neo4j/gds/similarity/nodesim/UnionGraphWeightedNodeSimilarityTest.java @@ -22,7 +22,7 @@ import org.assertj.core.data.Offset; import org.junit.jupiter.api.Test; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -58,7 +58,7 @@ void shouldWorkWithUnionGraph(){ .topN(1) .build(); - var nodeSimilarity = NodeSimilarity.create(graph, config, Pools.DEFAULT, ProgressTracker.NULL_TRACKER); + var nodeSimilarity = NodeSimilarity.create(graph, config, DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER); var result = nodeSimilarity.compute().streamResult().findFirst().get(); //input should be (0 + 10 + 0)/ (5 + 10 + 8) = 10/23 diff --git a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathSteinerAlgorithmExtendedTest.java b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathSteinerAlgorithmExtendedTest.java index 5d21acddb47..b826bccc72a 100644 --- a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathSteinerAlgorithmExtendedTest.java +++ b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathSteinerAlgorithmExtendedTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.Orientation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -155,7 +155,7 @@ void shouldWorkCorrectly(double delta, int binSizeThreshold) { false, binSizeThreshold, //setting custom threshold for such a small graph allows to not examine everything in a single iteration - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); @@ -175,7 +175,7 @@ void shouldWorkCorrectlyWithLineGraph() { 2.0, 1, false, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ) .compute(); @@ -203,7 +203,7 @@ void deltaSteppingShouldWorkCorrectly() { isTerminal, 1, SteinerBasedDeltaStepping.BIN_SIZE_THRESHOLD, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); var result = deltaSteiner.compute().pathSet(); @@ -229,7 +229,7 @@ void shouldWorkIfRevisitsVertices() { 2.0, 1, false, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); @@ -258,7 +258,7 @@ void shouldWorkOnTriangle() { 2.0, 1, false, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); diff --git a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java index 4e97db509ab..688070202ad 100644 --- a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java +++ b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmReroutingTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.TestProgressTracker; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.core.utils.progress.tasks.Task; @@ -189,7 +189,7 @@ void shouldPruneUnusedIfRerouting() { 2.0, 1, false, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResult.totalCost()).isEqualTo(7.0); @@ -203,7 +203,7 @@ void shouldPruneUnusedIfRerouting() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(4.0); @@ -223,7 +223,7 @@ void shouldPruneUnusedIfReroutingOnInvertedIndex() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(4.0); @@ -242,7 +242,7 @@ void rerouteShouldNotCreateLoops() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); var parent = steinerResult.parentArray().toArray(); @@ -267,7 +267,7 @@ void rerouteShouldNotCreateLoopsOnInvertedIndex() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); var parent = steinerResult.parentArray().toArray(); @@ -294,7 +294,7 @@ void shouldWorkForUnreachableAndReachableTerminals() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerTreeResult.effectiveTargetNodesCount()).isEqualTo(2); @@ -315,7 +315,7 @@ void shouldWorkIfNoReachableTerminals() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerTreeResult.effectiveTargetNodesCount()).isEqualTo(0); @@ -473,7 +473,7 @@ void shouldNotGetOptimalWithoutBetterRerouting() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(25.0); @@ -498,7 +498,7 @@ void shouldHandleMultiplePruningsOnSameTreeAndGetBetter() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(22.0); @@ -522,7 +522,7 @@ void shouldNotPruneUnprunableNodes() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(170.0 - 19); @@ -546,7 +546,7 @@ void shouldTakeAdvantageOfNewSingleParents() { 2.0, 1, true, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); assertThat(steinerResultWithReroute.totalCost()).isEqualTo(20); @@ -554,5 +554,3 @@ void shouldTakeAdvantageOfNewSingleParents() { } } - - diff --git a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmTest.java b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmTest.java index 9abd7b58c0c..d057bcb99e7 100644 --- a/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmTest.java +++ b/algo/src/test/java/org/neo4j/gds/steiner/ShortestPathsSteinerAlgorithmTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -75,7 +75,7 @@ void shouldWorkCorrectly() { 2.0, 1, false, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).compute(); var pruned = ShortestPathsSteinerAlgorithm.PRUNED; diff --git a/algo/src/test/java/org/neo4j/gds/traversal/RandomWalkTest.java b/algo/src/test/java/org/neo4j/gds/traversal/RandomWalkTest.java index f1dde921af3..689a1b8186a 100644 --- a/algo/src/test/java/org/neo4j/gds/traversal/RandomWalkTest.java +++ b/algo/src/test/java/org/neo4j/gds/traversal/RandomWalkTest.java @@ -34,7 +34,7 @@ import org.neo4j.gds.beta.generator.RelationshipDistribution; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.GlobalTaskStore; import org.neo4j.gds.core.utils.progress.TaskRegistryFactory; @@ -95,7 +95,7 @@ void testWithDefaultConfig() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); List result = randomWalk.compute().collect(Collectors.toList()); @@ -136,7 +136,7 @@ private List runRandomWalkSeeded(Node2VecStreamConfig config, Graph grap graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); return randomWalk.compute().collect(Collectors.toList()); @@ -149,7 +149,7 @@ void testSampleFromMultipleRelationshipTypes() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); int expectedNumberOfWalks = config.walksPerNode() * 3; @@ -190,7 +190,7 @@ void returnFactorShouldMakeWalksIncludeStartNodeMoreOften() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var nodeCounter = new HashMap(); @@ -250,7 +250,7 @@ void largeInOutFactorShouldMakeTheWalkKeepTheSameDistance() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var nodeCounter = new HashMap(); @@ -299,7 +299,7 @@ void shouldRespectRelationshipWeights() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var nodeCounter = new HashMap(); @@ -336,7 +336,7 @@ void failOnInvalidRelationshipWeights(double invalidWeight) { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ) ).isInstanceOf(RuntimeException.class) .hasMessage( @@ -371,7 +371,7 @@ void parallelWeighted() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(randomWalk.compute().collect(Collectors.toList())) @@ -400,7 +400,7 @@ void testWithConfiguredOffsetStartNodes() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); assertThat(randomWalk.compute().collect(Collectors.toList())) @@ -423,7 +423,7 @@ void testSetTerminationFlagAndMultipleRuns() { graph, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ); var stream = randomWalk.compute(); diff --git a/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountFilteredGraphTest.java b/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountFilteredGraphTest.java index 9df195441eb..7a146f23688 100644 --- a/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountFilteredGraphTest.java +++ b/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountFilteredGraphTest.java @@ -29,7 +29,7 @@ import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.extension.Neo4jGraph; import java.util.Collections; @@ -78,7 +78,7 @@ void testUnionGraphWithNodeFilter() { Optional.empty() ); var config = ImmutableTriangleCountBaseConfig.builder().build(); - var triangleCount = IntersectingTriangleCount.create(graph, config, Pools.DEFAULT); + var triangleCount = IntersectingTriangleCount.create(graph, config, DefaultPool.INSTANCE); var triangleCountResult = triangleCount.compute(); assertThat(triangleCountResult.globalTriangles()).isEqualTo(1); var triangles = triangleCountResult.localTriangles(); diff --git a/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountTest.java b/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountTest.java index 5d189682de5..a3403f05824 100644 --- a/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountTest.java +++ b/algo/src/test/java/org/neo4j/gds/triangle/IntersectingTriangleCountTest.java @@ -27,7 +27,7 @@ import org.neo4j.gds.Orientation; import org.neo4j.gds.TestSupport; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import java.util.stream.Stream; @@ -531,7 +531,7 @@ private TriangleCountResult compute(Graph graph) { } private TriangleCountResult compute(Graph graph, TriangleCountBaseConfig config) { - return IntersectingTriangleCount.create(graph, config, Pools.DEFAULT).compute(); + return IntersectingTriangleCount.create(graph, config, DefaultPool.INSTANCE).compute(); } private static Graph fromGdl(String gdl) { diff --git a/algo/src/test/java/org/neo4j/gds/triangle/LargeIntersectingTriangleCountTest.java b/algo/src/test/java/org/neo4j/gds/triangle/LargeIntersectingTriangleCountTest.java index 3e7722bb1c3..23f5eea35f7 100644 --- a/algo/src/test/java/org/neo4j/gds/triangle/LargeIntersectingTriangleCountTest.java +++ b/algo/src/test/java/org/neo4j/gds/triangle/LargeIntersectingTriangleCountTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.Orientation; import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.PagedAtomicIntegerArray; import org.neo4j.gds.graphbuilder.DefaultBuilder; import org.neo4j.gds.graphbuilder.GraphBuilder; @@ -71,7 +71,7 @@ void testQueue() { var result = IntersectingTriangleCount.create( graph, defaultConfigBuilder().build(), - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); assertEquals(TRIANGLE_COUNT, result.globalTriangles()); assertTriangles(result.globalTriangles()); @@ -83,7 +83,7 @@ void testQueueParallel() { var result = IntersectingTriangleCount.create( graph, defaultConfigBuilder().concurrency(4).build(), - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); assertEquals(TRIANGLE_COUNT, result.globalTriangles()); assertTriangles(result.globalTriangles()); diff --git a/algo/src/test/java/org/neo4j/gds/triangle/TriangleStreamTest.java b/algo/src/test/java/org/neo4j/gds/triangle/TriangleStreamTest.java index 665b2b15981..6a29c4ca063 100644 --- a/algo/src/test/java/org/neo4j/gds/triangle/TriangleStreamTest.java +++ b/algo/src/test/java/org/neo4j/gds/triangle/TriangleStreamTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.Orientation; import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.graphbuilder.DefaultBuilder; import org.neo4j.gds.graphbuilder.GraphBuilder; import org.neo4j.graphdb.Node; @@ -73,7 +73,7 @@ void setupGraphDb() { void testSequential() { TripleConsumer mock = mock(TripleConsumer.class); - TriangleStream.create(graph, Pools.DEFAULT, 1) + TriangleStream.create(graph, DefaultPool.INSTANCE, 1) .compute() .forEach(r -> mock.consume(r.nodeA, r.nodeB, r.nodeC)); @@ -84,7 +84,7 @@ void testSequential() { void testParallel() { TripleConsumer mock = mock(TripleConsumer.class); - TriangleStream.create(graph, Pools.DEFAULT, 8) + TriangleStream.create(graph, DefaultPool.INSTANCE, 8) .compute() .forEach(r -> mock.consume(r.nodeA, r.nodeB, r.nodeC)); diff --git a/algo/src/test/java/org/neo4j/gds/triangle/UnionGraphTriangleCountingTest.java b/algo/src/test/java/org/neo4j/gds/triangle/UnionGraphTriangleCountingTest.java index 06ce5d92332..1e71af7ac17 100644 --- a/algo/src/test/java/org/neo4j/gds/triangle/UnionGraphTriangleCountingTest.java +++ b/algo/src/test/java/org/neo4j/gds/triangle/UnionGraphTriangleCountingTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; import org.neo4j.gds.extension.Inject; @@ -96,7 +96,7 @@ class UnionGraphTriangleCountingTest { @Test void shouldWorkWithUnionGraphs() { var config=TriangleCountStreamConfigImpl.builder().concurrency(1).build(); - var a=IntersectingTriangleCount.create(graph,config, Pools.DEFAULT); + var a=IntersectingTriangleCount.create(graph,config, DefaultPool.INSTANCE); var result=a.compute(); assertThat(result.globalTriangles()).isEqualTo(0); } diff --git a/algo/src/test/java/org/neo4j/gds/undirected/ToUndirectedTest.java b/algo/src/test/java/org/neo4j/gds/undirected/ToUndirectedTest.java index b09420ea94e..94ecc433dbc 100644 --- a/algo/src/test/java/org/neo4j/gds/undirected/ToUndirectedTest.java +++ b/algo/src/test/java/org/neo4j/gds/undirected/ToUndirectedTest.java @@ -28,7 +28,7 @@ import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.SingleTypeRelationships; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -82,7 +82,7 @@ void shouldCreateUndirectedRelationships(int concurrency) { directedGraphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); directedGraphStore.addRelationshipType(undirectedRelationships); @@ -129,7 +129,7 @@ void shouldCreateUndirectedRelationshipsWithSingleRelationshipProperty(int concu singleDirectedGraphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); singleDirectedGraphStore.addRelationshipType(undirectedRelationships); @@ -175,7 +175,7 @@ void shouldCreateUndirectedRelationshipsWithNoRelationshipProperty(int concurren noPropertyDirectedGraphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); noPropertyDirectedGraphStore.addRelationshipType(undirectedRelationships); @@ -207,7 +207,7 @@ void shouldAggregateWithoutProperties() { inputGraphStore, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); inputGraphStore.addRelationshipType(undirectedRels); @@ -240,7 +240,7 @@ void shouldAggregateWithPropertiesAndGlobalAggregation() { input, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); input.addRelationshipType(aggregatedUndirectedRelationships); @@ -281,7 +281,7 @@ void shouldAggregateWithPropertiesAndLocalAggregation() { input, config, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); input.addRelationshipType(aggregatedUndirectedRelationships); diff --git a/algo/src/test/java/org/neo4j/gds/walking/CollapseMultiPathsTest.java b/algo/src/test/java/org/neo4j/gds/walking/CollapseMultiPathsTest.java index d5d3dfc3647..08fb482dda8 100644 --- a/algo/src/test/java/org/neo4j/gds/walking/CollapseMultiPathsTest.java +++ b/algo/src/test/java/org/neo4j/gds/walking/CollapseMultiPathsTest.java @@ -26,7 +26,7 @@ import org.neo4j.gds.api.AdjacencyList; import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; import org.neo4j.gds.extension.IdFunction; @@ -112,7 +112,7 @@ void shouldFollowRoutesFromMovies() { false, RelationshipType.of("REL"), 2, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); @@ -174,7 +174,7 @@ void shouldTurnEveryRouteIntoRelationship() { false, RelationshipType.of("REL"), 2, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); diff --git a/algo/src/test/java/org/neo4j/gds/walking/CollapsePathTest.java b/algo/src/test/java/org/neo4j/gds/walking/CollapsePathTest.java index 933e43901d7..02a83910f84 100644 --- a/algo/src/test/java/org/neo4j/gds/walking/CollapsePathTest.java +++ b/algo/src/test/java/org/neo4j/gds/walking/CollapsePathTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.RelationshipType; import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.GraphStore; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.SingleTypeRelationships; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -123,7 +123,7 @@ void testCreatingRelationships() { false, RelationshipType.of("SAME_DRUG"), 2, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); @@ -139,7 +139,7 @@ void testAllowCreatingSelfLoops() { true, RelationshipType.of("SAME_DRUG"), 2, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); @@ -153,7 +153,7 @@ void runWithDifferentRelationshipTypes() { false, RelationshipType.of("SAME_DRUG"), 2, - Pools.DEFAULT + DefaultPool.INSTANCE ).compute(); assertResultGraph(tookGraphStore, relationships, EXPECTED_WITHOUT_LOOPS); diff --git a/algo/src/test/java/org/neo4j/gds/wcc/IncrementalWccTest.java b/algo/src/test/java/org/neo4j/gds/wcc/IncrementalWccTest.java index 9ced3d34b69..65bd6e58e79 100644 --- a/algo/src/test/java/org/neo4j/gds/wcc/IncrementalWccTest.java +++ b/algo/src/test/java/org/neo4j/gds/wcc/IncrementalWccTest.java @@ -24,7 +24,7 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.api.IdMap; import org.neo4j.gds.config.ConcurrencyConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.dss.DisjointSetStruct; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -125,7 +125,7 @@ void shouldAssignMinimumCommunityIdOnMerge() { private DisjointSetStruct run(Graph graph, WccBaseConfig config) { return new Wcc( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, COMMUNITY_SIZE / ConcurrencyConfig.DEFAULT_CONCURRENCY, config, ProgressTracker.NULL_TRACKER diff --git a/algo/src/test/java/org/neo4j/gds/wcc/WccTest.java b/algo/src/test/java/org/neo4j/gds/wcc/WccTest.java index 88cbde8ba0e..9c2402ee096 100644 --- a/algo/src/test/java/org/neo4j/gds/wcc/WccTest.java +++ b/algo/src/test/java/org/neo4j/gds/wcc/WccTest.java @@ -35,7 +35,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.dss.DisjointSetStruct; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -280,7 +280,7 @@ DisjointSetStruct run(Graph graph, WccBaseConfig config) { DisjointSetStruct run(Graph graph, WccBaseConfig config, int concurrency) { return new Wcc( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, communitySize() / concurrency, config, ProgressTracker.NULL_TRACKER diff --git a/algo/src/test/java/org/neo4j/gds/wcc/WccThresholdTest.java b/algo/src/test/java/org/neo4j/gds/wcc/WccThresholdTest.java index 228b1ab852f..7b05ab90234 100644 --- a/algo/src/test/java/org/neo4j/gds/wcc/WccThresholdTest.java +++ b/algo/src/test/java/org/neo4j/gds/wcc/WccThresholdTest.java @@ -23,7 +23,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.CommunityHelper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.dss.DisjointSetStruct; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -110,7 +110,7 @@ private void assertResults(double threshold, TestGraph graph, String[][] expecte DisjointSetStruct dss = new Wcc( graph, - Pools.DEFAULT, + DefaultPool.INSTANCE, DEFAULT_BATCH_SIZE, wccConfig, ProgressTracker.NULL_TRACKER diff --git a/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/HitsTest.java b/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/HitsTest.java index 5dcd1057599..a68d12abb9d 100644 --- a/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/HitsTest.java +++ b/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/HitsTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -65,7 +65,7 @@ void testHits() { graph, config, new Hits(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/SpeakerListenerLPATest.java b/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/SpeakerListenerLPATest.java index 30b5e70d348..4752a25b2a6 100644 --- a/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/SpeakerListenerLPATest.java +++ b/alpha/alpha-proc/src/test/java/org/neo4j/gds/pregel/SpeakerListenerLPATest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -75,7 +75,7 @@ void testWithoutPruning() { graph, config, new SpeakerListenerLPA(42), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -122,7 +122,7 @@ void prunesAwayAfterManyIterations() { graph, config, new SpeakerListenerLPA(42), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -164,7 +164,7 @@ void closesThreadLocal() { graph, config, computation, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).run(); diff --git a/concurrency-validation-api/src/main/java/org/neo4j/gds/concurrency/PoolSizesService.java b/concurrency-validation-api/src/main/java/org/neo4j/gds/concurrency/PoolSizesService.java index 4f731fbd55c..43744b9adf5 100644 --- a/concurrency-validation-api/src/main/java/org/neo4j/gds/concurrency/PoolSizesService.java +++ b/concurrency-validation-api/src/main/java/org/neo4j/gds/concurrency/PoolSizesService.java @@ -19,6 +19,8 @@ */ package org.neo4j.gds.concurrency; +import java.util.Objects; + public final class PoolSizesService { private static PoolSizes instance = new OpenGdsPoolSizes(); @@ -31,6 +33,6 @@ public static void poolSizes(PoolSizes poolSizes) { } public static PoolSizes poolSizes() { - return instance; + return Objects.requireNonNull(instance); } } diff --git a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipExporter.java b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipExporter.java index cb56c735589..42f9d1b62f5 100644 --- a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipExporter.java +++ b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipExporter.java @@ -26,7 +26,7 @@ import org.neo4j.gds.api.RelationshipIterator; import org.neo4j.gds.api.RelationshipWithPropertyConsumer; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.partition.Partition; import org.neo4j.gds.core.utils.partition.PartitionUtils; @@ -91,7 +91,7 @@ public static RelationshipExporterBuilder builder( this.propertyTranslator = propertyTranslator; this.terminationFlag = terminationFlag; this.progressTracker = progressTracker; - this.executorService = Pools.DEFAULT_SINGLE_THREAD_POOL; + this.executorService = ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL; } @Override diff --git a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterBuilder.java b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterBuilder.java index f1ebf2099ba..0eb0fae9475 100644 --- a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterBuilder.java +++ b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterBuilder.java @@ -19,7 +19,7 @@ */ package org.neo4j.gds.core.write; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.transaction.TransactionContext; public class NativeRelationshipPropertiesExporterBuilder extends RelationshipPropertiesExporterBuilder { @@ -37,7 +37,7 @@ public RelationshipPropertiesExporter build() { graphStore, propertyTranslator, progressTracker, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, terminationFlag ); } diff --git a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipStreamExporter.java b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipStreamExporter.java index 45b14543428..53cc05e72fe 100644 --- a/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipStreamExporter.java +++ b/core-write/src/main/java/org/neo4j/gds/core/write/NativeRelationshipStreamExporter.java @@ -21,7 +21,7 @@ import org.neo4j.gds.api.IdMap; import org.neo4j.gds.api.nodeproperties.ValueType; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.transaction.TransactionContext; @@ -97,7 +97,7 @@ public long write(String relationshipType, List propertyKeys, List(bufferPool.poll()); diff --git a/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodeLabelExporterTest.java b/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodeLabelExporterTest.java index 21eeaa48489..366743f2112 100644 --- a/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodeLabelExporterTest.java +++ b/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodeLabelExporterTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.TestSupport; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.Neo4jGraph; @@ -58,7 +58,7 @@ void exportLabel(int concurrency) { TerminationFlag.RUNNING_TRUE, ProgressTracker.NULL_TRACKER, concurrency, - Pools.DEFAULT + DefaultPool.INSTANCE ); exporter.write("GeneratedLabel"); diff --git a/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodePropertyExporterTest.java b/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodePropertyExporterTest.java index 0adb0f7c5d2..740e9d6d2d5 100644 --- a/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodePropertyExporterTest.java +++ b/core-write/src/test/java/org/neo4j/gds/core/write/NativeNodePropertyExporterTest.java @@ -31,7 +31,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.DirectIdMap; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; @@ -149,7 +149,7 @@ void stopsExportingWhenTransactionHasBeenTerminated() { @Test void stopsParallelExportingWhenTransactionHasBeenTerminated() { - transactionTerminationTest(Pools.DEFAULT); + transactionTerminationTest(DefaultPool.INSTANCE); } @ParameterizedTest @@ -172,7 +172,7 @@ void progressLogging(boolean parallel) { .builder(TestSupport.fullAccessTransaction(db), graph, TerminationFlag.RUNNING_TRUE) .withProgressTracker(progressTracker); if (parallel) { - exporterBuilder = exporterBuilder.parallel(Pools.DEFAULT, writeConcurrency); + exporterBuilder = exporterBuilder.parallel(DefaultPool.INSTANCE, writeConcurrency); } var exporter = exporterBuilder.build(); diff --git a/core-write/src/test/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterTest.java b/core-write/src/test/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterTest.java index 2b98050c580..34899c4ab48 100644 --- a/core-write/src/test/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterTest.java +++ b/core-write/src/test/java/org/neo4j/gds/core/write/NativeRelationshipPropertiesExporterTest.java @@ -29,7 +29,7 @@ import org.neo4j.gds.api.DefaultValue; import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.values.storable.Values; @@ -79,7 +79,7 @@ void shouldWriteRelationshipsWithMultipleProperties() { graphStore, Values::doubleValue, ProgressTracker.NULL_TRACKER, - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, TerminationFlag.RUNNING_TRUE ); diff --git a/core/src/main/java/org/neo4j/gds/api/GraphLoaderContext.java b/core/src/main/java/org/neo4j/gds/api/GraphLoaderContext.java index 020496d3ca4..c0bdda5442a 100644 --- a/core/src/main/java/org/neo4j/gds/api/GraphLoaderContext.java +++ b/core/src/main/java/org/neo4j/gds/api/GraphLoaderContext.java @@ -22,7 +22,7 @@ import org.immutables.value.Value; import org.neo4j.common.DependencyResolver; import org.neo4j.gds.annotation.ValueClass; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.TaskRegistryFactory; @@ -47,7 +47,7 @@ public interface GraphLoaderContext { @Value.Default default ExecutorService executor() { - return Pools.DEFAULT; + return DefaultPool.INSTANCE; } @Value.Default diff --git a/core/src/main/java/org/neo4j/gds/core/concurrency/DefaultPool.java b/core/src/main/java/org/neo4j/gds/core/concurrency/DefaultPool.java new file mode 100644 index 00000000000..1ba55b09b2e --- /dev/null +++ b/core/src/main/java/org/neo4j/gds/core/concurrency/DefaultPool.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) "Neo4j" + * Neo4j Sweden AB [http://neo4j.com] + * + * This file is part of Neo4j. + * + * Neo4j is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.neo4j.gds.core.concurrency; + +import org.neo4j.gds.concurrency.PoolSizes; +import org.neo4j.gds.concurrency.PoolSizesService; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public final class DefaultPool { + + public static final ExecutorService INSTANCE = createDefaultPool(PoolSizesService.poolSizes()); + + private static ExecutorService createDefaultPool(PoolSizes poolSizes) { + return new ThreadPoolExecutor( + poolSizes.corePoolSize(), + poolSizes.maxPoolSize(), + 30L, + TimeUnit.SECONDS, + new ArrayBlockingQueue<>(poolSizes.corePoolSize() * 50), + ExecutorServiceUtil.DEFAULT_THREAD_FACTORY, + new ExecutorServiceUtil.CallerBlocksPolicy() + ); + } + + private DefaultPool() {} +} diff --git a/core/src/main/java/org/neo4j/gds/core/concurrency/Pools.java b/core/src/main/java/org/neo4j/gds/core/concurrency/ExecutorServiceUtil.java similarity index 83% rename from core/src/main/java/org/neo4j/gds/core/concurrency/Pools.java rename to core/src/main/java/org/neo4j/gds/core/concurrency/ExecutorServiceUtil.java index a08703dfb77..111de7433e5 100644 --- a/core/src/main/java/org/neo4j/gds/core/concurrency/Pools.java +++ b/core/src/main/java/org/neo4j/gds/core/concurrency/ExecutorServiceUtil.java @@ -19,10 +19,8 @@ */ package org.neo4j.gds.core.concurrency; -import org.neo4j.gds.concurrency.PoolSizesService; import org.neo4j.internal.helpers.NamedThreadFactory; -import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -35,31 +33,17 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -public final class Pools { +public final class ExecutorServiceUtil { private static final String THREAD_NAME_PREFIX = "gds"; public static final ThreadFactory DEFAULT_THREAD_FACTORY = NamedThreadFactory.daemon(THREAD_NAME_PREFIX); - public static final ExecutorService DEFAULT = createDefaultPool(); public static final ExecutorService DEFAULT_SINGLE_THREAD_POOL = createSingleThreadPool("algo"); - private Pools() { + private ExecutorServiceUtil() { throw new UnsupportedOperationException(); } - public static ExecutorService createDefaultPool() { - var poolSizes = PoolSizesService.poolSizes(); - return new ThreadPoolExecutor( - poolSizes.corePoolSize(), - poolSizes.maxPoolSize(), - 30L, - TimeUnit.SECONDS, - new ArrayBlockingQueue<>(poolSizes.corePoolSize() * 50), - DEFAULT_THREAD_FACTORY, - new CallerBlocksPolicy() - ); - } - public static ExecutorService createSingleThreadPool(String threadPrefix) { return Executors.newSingleThreadExecutor(NamedThreadFactory.daemon(threadPrefix)); } @@ -103,7 +87,7 @@ public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { private static final ForkJoinPool.ForkJoinWorkerThreadFactory FJ_WORKER_THREAD_FACTORY = pool -> { var worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); - worker.setName(Pools.THREAD_NAME_PREFIX + "-forkjoin-" + worker.getPoolIndex()); + worker.setName(ExecutorServiceUtil.THREAD_NAME_PREFIX + "-forkjoin-" + worker.getPoolIndex()); return worker; }; } diff --git a/core/src/main/java/org/neo4j/gds/core/concurrency/ParallelUtil.java b/core/src/main/java/org/neo4j/gds/core/concurrency/ParallelUtil.java index 2f57d486a68..9e0bf799e82 100644 --- a/core/src/main/java/org/neo4j/gds/core/concurrency/ParallelUtil.java +++ b/core/src/main/java/org/neo4j/gds/core/concurrency/ParallelUtil.java @@ -70,7 +70,7 @@ private ParallelUtil() {} * The concurrency value is assumed to already be validated towards the edition limitation. */ public static , R> R parallelStream(T data, int concurrency, Function fn) { - ForkJoinPool pool = Pools.createForkJoinPool(concurrency); + ForkJoinPool pool = ExecutorServiceUtil.createForkJoinPool(concurrency); try { return pool.submit(() -> fn.apply(data.parallel())).get(); } catch (InterruptedException e) { diff --git a/core/src/main/java/org/neo4j/gds/core/concurrency/RunWithConcurrency.java b/core/src/main/java/org/neo4j/gds/core/concurrency/RunWithConcurrency.java index 5d4506fc42c..0928ce08ec6 100644 --- a/core/src/main/java/org/neo4j/gds/core/concurrency/RunWithConcurrency.java +++ b/core/src/main/java/org/neo4j/gds/core/concurrency/RunWithConcurrency.java @@ -186,11 +186,11 @@ default boolean mayInterruptIfRunning() { * If {@link #forceUsageOfExecutor()} is {@code true} however, an {@link java.lang.IllegalArgumentException} * is thrown when this object is constructed. *

- * The default executor is {@link org.neo4j.gds.core.concurrency.Pools#DEFAULT}. + * The default executor is {@link DefaultPool#INSTANCE}. */ @Value.Default default @Nullable ExecutorService executor() { - return Pools.DEFAULT; + return DefaultPool.INSTANCE; } /** diff --git a/core/src/main/java/org/neo4j/gds/core/loading/ArrayIdMapBuilderOps.java b/core/src/main/java/org/neo4j/gds/core/loading/ArrayIdMapBuilderOps.java index d414d5938e5..b1723d17310 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/ArrayIdMapBuilderOps.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/ArrayIdMapBuilderOps.java @@ -23,8 +23,8 @@ import org.neo4j.gds.api.IdMap; import org.neo4j.gds.collections.HugeSparseLongArray; import org.neo4j.gds.collections.cursor.HugeCursor; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.loading.construction.NodesBuilder; import org.neo4j.gds.core.utils.paged.HugeLongArray; @@ -75,7 +75,7 @@ static HugeSparseLongArray buildSparseIdMap( ParallelUtil.readParallel( concurrency, nodeCount, - Pools.DEFAULT, + DefaultPool.INSTANCE, (start, end) -> addNodes(graphIds, idMapBuilder, start, end) ); return idMapBuilder.build(); diff --git a/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java b/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java index 35bf2d06aa6..3ba8858e931 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/construction/GraphFactory.java @@ -40,7 +40,7 @@ import org.neo4j.gds.api.schema.NodeSchema; import org.neo4j.gds.core.Aggregation; import org.neo4j.gds.core.IdMapBehaviorServiceProvider; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.huge.HugeGraphBuilder; import org.neo4j.gds.core.loading.HighLimitIdMap; @@ -295,7 +295,7 @@ static RelationshipsBuilder relationshipsBuilder( .isMultiGraph(isMultiGraph) .loadRelationshipProperty(loadRelationshipProperties) .direction(Direction.fromOrientation(actualOrientation)) - .executorService(executorService.orElse(Pools.DEFAULT)) + .executorService(executorService.orElse(DefaultPool.INSTANCE)) .concurrency(finalConcurrency); if (indexInverse.orElse(false)) { diff --git a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleArrayNodePropertiesBuilder.java b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleArrayNodePropertiesBuilder.java index 1bb7ac3fbbb..d7db8d37e18 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleArrayNodePropertiesBuilder.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleArrayNodePropertiesBuilder.java @@ -24,8 +24,8 @@ import org.neo4j.gds.api.PartialIdMap; import org.neo4j.gds.api.properties.nodes.DoubleArrayNodePropertyValues; import org.neo4j.gds.collections.HugeSparseDoubleArrayArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.utils.Neo4jValueConversion; import org.neo4j.values.storable.Value; @@ -91,7 +91,7 @@ public DoubleArrayNodePropertyValues build(long size, PartialIdMap idMap, long h } } }).collect(Collectors.toList()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var propertyValues = propertiesByMappedIdsBuilder.build(); diff --git a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleNodePropertiesBuilder.java b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleNodePropertiesBuilder.java index e5b45a1e484..f7b112e8a90 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleNodePropertiesBuilder.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/DoubleNodePropertiesBuilder.java @@ -24,8 +24,8 @@ import org.neo4j.gds.api.PartialIdMap; import org.neo4j.gds.api.properties.nodes.DoubleNodePropertyValues; import org.neo4j.gds.collections.HugeSparseDoubleArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.utils.Neo4jValueConversion; import org.neo4j.values.storable.Value; @@ -116,7 +116,7 @@ public DoubleNodePropertyValues build(long size, PartialIdMap idMap, long highes } }).collect(Collectors.toList()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var propertyValues = propertiesByMappedIdsBuilder.build(); diff --git a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/FloatArrayNodePropertiesBuilder.java b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/FloatArrayNodePropertiesBuilder.java index 86633552e96..8b5563b678e 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/FloatArrayNodePropertiesBuilder.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/FloatArrayNodePropertiesBuilder.java @@ -24,8 +24,8 @@ import org.neo4j.gds.api.PartialIdMap; import org.neo4j.gds.api.properties.nodes.FloatArrayNodePropertyValues; import org.neo4j.gds.collections.HugeSparseFloatArrayArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.utils.Neo4jValueConversion; import org.neo4j.values.storable.Value; @@ -90,7 +90,7 @@ public FloatArrayNodePropertyValues build(long size, PartialIdMap idMap, long hi } }).collect(Collectors.toList()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var propertyValues = propertiesByMappedIdsBuilder.build(); return new FloatArrayStoreNodePropertyValues(propertyValues, size); diff --git a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongArrayNodePropertiesBuilder.java b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongArrayNodePropertiesBuilder.java index 6c3616b641a..ddfbb31ef22 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongArrayNodePropertiesBuilder.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongArrayNodePropertiesBuilder.java @@ -24,8 +24,8 @@ import org.neo4j.gds.api.PartialIdMap; import org.neo4j.gds.api.properties.nodes.LongArrayNodePropertyValues; import org.neo4j.gds.collections.HugeSparseLongArrayArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.utils.Neo4jValueConversion; import org.neo4j.values.storable.Value; @@ -94,7 +94,7 @@ public LongArrayNodePropertyValues build(long size, PartialIdMap idMap, long hig } }).collect(Collectors.toList()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var propertyValues = propertiesByMappedIdsBuilder.build(); diff --git a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongNodePropertiesBuilder.java b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongNodePropertiesBuilder.java index e743d718d13..7e3752cbcbf 100644 --- a/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongNodePropertiesBuilder.java +++ b/core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/LongNodePropertiesBuilder.java @@ -25,8 +25,8 @@ import org.neo4j.gds.api.properties.nodes.LongNodePropertyValues; import org.neo4j.gds.api.properties.nodes.NodePropertyValues; import org.neo4j.gds.collections.HugeSparseLongArray; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.utils.Neo4jValueConversion; import org.neo4j.values.storable.Value; @@ -124,7 +124,7 @@ public NodePropertyValues build(long size, PartialIdMap idMap, long highestOrigi } }).collect(Collectors.toList()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var propertyValues = propertiesByMappedIdsBuilder.build(); diff --git a/core/src/main/java/org/neo4j/gds/core/utils/paged/HugeMergeSort.java b/core/src/main/java/org/neo4j/gds/core/utils/paged/HugeMergeSort.java index 20a3dc05aec..27760cc1de5 100644 --- a/core/src/main/java/org/neo4j/gds/core/utils/paged/HugeMergeSort.java +++ b/core/src/main/java/org/neo4j/gds/core/utils/paged/HugeMergeSort.java @@ -20,7 +20,7 @@ package org.neo4j.gds.core.utils.paged; import org.jetbrains.annotations.Nullable; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import java.util.concurrent.CountedCompleter; @@ -30,7 +30,7 @@ public final class HugeMergeSort { public static void sort(HugeLongArray array, int concurrency) { var temp = HugeLongArray.newArray(array.size()); - var forkJoinPool = Pools.createForkJoinPool(concurrency); + var forkJoinPool = ExecutorServiceUtil.createForkJoinPool(concurrency); try { forkJoinPool.invoke(new MergeSortTask(null, array, temp, 0, array.size() - 1)); } finally { diff --git a/core/src/test/java/org/neo4j/gds/TerminationTest.java b/core/src/test/java/org/neo4j/gds/TerminationTest.java index 0a176c4714f..26ac0b67165 100644 --- a/core/src/test/java/org/neo4j/gds/TerminationTest.java +++ b/core/src/test/java/org/neo4j/gds/TerminationTest.java @@ -22,8 +22,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.neo4j.gds.compat.Neo4jProxy; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.graphdb.TransactionFailureException; import org.neo4j.kernel.api.exceptions.Status; import org.neo4j.kernel.api.query.ExecutingQuery; @@ -103,7 +103,7 @@ private void executeAndKill() { }); // submit - ParallelUtil.run(runnables, Pools.DEFAULT); + ParallelUtil.run(runnables, DefaultPool.INSTANCE); } @Test diff --git a/core/src/test/java/org/neo4j/gds/core/LoadingTest.java b/core/src/test/java/org/neo4j/gds/core/LoadingTest.java index ab9df441ebe..e81e505edb6 100644 --- a/core/src/test/java/org/neo4j/gds/core/LoadingTest.java +++ b/core/src/test/java/org/neo4j/gds/core/LoadingTest.java @@ -25,7 +25,7 @@ import org.neo4j.gds.BaseTest; import org.neo4j.gds.StoreLoaderBuilder; import org.neo4j.gds.api.Graph; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import java.util.Arrays; @@ -59,7 +59,7 @@ void setupGraphDb() { void testBasicLoading() { Graph graph = new StoreLoaderBuilder() .databaseService(db) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .addNodeLabel("Node") .addRelationshipType("TYPE") .build() diff --git a/core/src/test/java/org/neo4j/gds/core/compression/varlong/TransientCsrListTest.java b/core/src/test/java/org/neo4j/gds/core/compression/varlong/TransientCsrListTest.java index 70d0248b2da..d7fb8ab1200 100644 --- a/core/src/test/java/org/neo4j/gds/core/compression/varlong/TransientCsrListTest.java +++ b/core/src/test/java/org/neo4j/gds/core/compression/varlong/TransientCsrListTest.java @@ -31,7 +31,7 @@ import org.neo4j.gds.api.IdMap; import org.neo4j.gds.core.TestMethodRunner; import org.neo4j.gds.core.compression.packed.PackedAdjacencyList; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.construction.GraphFactory; import java.util.Arrays; @@ -438,7 +438,7 @@ static AdjacencyList adjacencyListFromTargets(IdMap idMap, long[] targets) { .nodes(idMap) .relationshipType(RelationshipType.of("REL")) .concurrency(1) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); Arrays.stream(targets).forEach(target -> relationshipsBuilder.add(sourceNodeId, target)); diff --git a/core/src/test/java/org/neo4j/gds/core/concurrency/ParallelUtilTest.java b/core/src/test/java/org/neo4j/gds/core/concurrency/ParallelUtilTest.java index cc73aa2be24..a385bafdf33 100644 --- a/core/src/test/java/org/neo4j/gds/core/concurrency/ParallelUtilTest.java +++ b/core/src/test/java/org/neo4j/gds/core/concurrency/ParallelUtilTest.java @@ -358,7 +358,7 @@ void shouldBailOnTermination() { AtomicReference thrownException = new AtomicReference<>(); AtomicBoolean running = new AtomicBoolean(true); TerminationFlag isRunning = running::get; - var thread = Pools.newThread(() -> tasks.run(t -> + var thread = ExecutorServiceUtil.newThread(() -> tasks.run(t -> RunWithConcurrency.builder() .concurrency(2) .tasks(t) diff --git a/core/src/test/java/org/neo4j/gds/core/concurrency/PoolsTest.java b/core/src/test/java/org/neo4j/gds/core/concurrency/PoolSizesServiceTest.java similarity index 69% rename from core/src/test/java/org/neo4j/gds/core/concurrency/PoolsTest.java rename to core/src/test/java/org/neo4j/gds/core/concurrency/PoolSizesServiceTest.java index 3e88180c7ac..635f2ed63b4 100644 --- a/core/src/test/java/org/neo4j/gds/core/concurrency/PoolsTest.java +++ b/core/src/test/java/org/neo4j/gds/core/concurrency/PoolSizesServiceTest.java @@ -20,19 +20,18 @@ package org.neo4j.gds.core.concurrency; import org.junit.jupiter.api.Test; +import org.neo4j.gds.concurrency.PoolSizesService; -import java.util.concurrent.ThreadPoolExecutor; +import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; - -class PoolsTest { +class PoolSizesServiceTest { @Test - void shouldGetLimitedPool() { - ThreadPoolExecutor defaultPool = (ThreadPoolExecutor) Pools.createDefaultPool(); + void openGdsPoolSizesByDefault() { + var poolSizes = PoolSizesService.poolSizes(); - assertEquals(4, defaultPool.getCorePoolSize()); - assertEquals(4, defaultPool.getMaximumPoolSize()); + assertThat(poolSizes.corePoolSize()).isEqualTo(4); + assertThat(poolSizes.maxPoolSize()).isEqualTo(4); } } diff --git a/core/src/test/java/org/neo4j/gds/core/loading/LazyIdMapBuilderTest.java b/core/src/test/java/org/neo4j/gds/core/loading/LazyIdMapBuilderTest.java index 2aa39412604..d5d078c26df 100644 --- a/core/src/test/java/org/neo4j/gds/core/loading/LazyIdMapBuilderTest.java +++ b/core/src/test/java/org/neo4j/gds/core/loading/LazyIdMapBuilderTest.java @@ -22,8 +22,8 @@ import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; import org.neo4j.gds.api.PropertyState; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.loading.construction.NodeLabelTokens; import org.neo4j.gds.core.utils.partition.PartitionUtils; @@ -66,7 +66,7 @@ void parallelAddDuplicateNodes() { }, Optional.empty()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var highLimitIdMap = lazyIdMapBuilder.build().idMap(); diff --git a/core/src/test/java/org/neo4j/gds/core/loading/ScanningRelationshipsImporterTest.java b/core/src/test/java/org/neo4j/gds/core/loading/ScanningRelationshipsImporterTest.java index a310f2078a0..54340a1ddb2 100644 --- a/core/src/test/java/org/neo4j/gds/core/loading/ScanningRelationshipsImporterTest.java +++ b/core/src/test/java/org/neo4j/gds/core/loading/ScanningRelationshipsImporterTest.java @@ -37,7 +37,7 @@ import org.neo4j.gds.config.ImmutableGraphProjectFromStoreConfig; import org.neo4j.gds.core.GraphDimensions; import org.neo4j.gds.core.GraphDimensionsStoreReader; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.DirectIdMap; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.TaskRegistryFactory; @@ -152,7 +152,7 @@ private long[] nodeIds(String... nodeVariables) { private GraphLoaderContext graphLoaderContext() { return ImmutableGraphLoaderContext.builder() - .executor(Pools.DEFAULT) + .executor(DefaultPool.INSTANCE) .log(NullLog.getInstance()) .terminationFlag(TerminationFlag.RUNNING_TRUE) .transactionContext(DatabaseTransactionContext.of(db, db.beginTx())) diff --git a/core/src/test/java/org/neo4j/gds/core/utils/paged/HugeAtomicGrowingBitSetTest.java b/core/src/test/java/org/neo4j/gds/core/utils/paged/HugeAtomicGrowingBitSetTest.java index faa8cc0e289..5e06652895f 100644 --- a/core/src/test/java/org/neo4j/gds/core/utils/paged/HugeAtomicGrowingBitSetTest.java +++ b/core/src/test/java/org/neo4j/gds/core/utils/paged/HugeAtomicGrowingBitSetTest.java @@ -22,8 +22,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.partition.PartitionUtils; import java.util.HashSet; @@ -142,7 +142,7 @@ void testSetParallel(HugeAtomicGrowingBitSet bitSet) { } }, Optional.empty()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); assertThat(bitSet.cardinality()).isEqualTo(nodeCount); } diff --git a/core/src/test/java/org/neo4j/gds/core/utils/paged/ShardedLongLongMapTest.java b/core/src/test/java/org/neo4j/gds/core/utils/paged/ShardedLongLongMapTest.java index 2393f1a7a27..e6bbed21816 100644 --- a/core/src/test/java/org/neo4j/gds/core/utils/paged/ShardedLongLongMapTest.java +++ b/core/src/test/java/org/neo4j/gds/core/utils/paged/ShardedLongLongMapTest.java @@ -27,8 +27,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.utils.partition.PartitionUtils; import java.util.Arrays; @@ -184,7 +184,7 @@ void testAddingMultipleNodesInParallel(@ForAll("fixedSizeIds") long[] originalId Optional.of(100) ); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var map = builder.build(); diff --git a/etc/forbidden-apis b/etc/forbidden-apis index 87ef4e5d7c6..97d13d3492e 100644 --- a/etc/forbidden-apis +++ b/etc/forbidden-apis @@ -1,6 +1,6 @@ org.neo4j.internal.helpers.collection.MapUtil @ Use the GDS MapUtil instead. -java.lang.Thread.Thread(java.lang.Runnable) @ Use org.neo4j.gds.core.concurrency.Pools.newThread to make sure that the new thread is properly named -java.lang.Thread.Thread(java.lang.ThreadGroup, java.lang.Runnable) @ Use org.neo4j.gds.core.concurrency.Pools.newThread to make sure that the new thread is properly named +java.lang.Thread.Thread(java.lang.Runnable) @ Use org.neo4j.gds.core.concurrency.ExecutorServiceUtil.newThread to make sure that the new thread is properly named +java.lang.Thread.Thread(java.lang.ThreadGroup, java.lang.Runnable) @ Use org.neo4j.gds.core.concurrency.ExecutorServiceUtil.newThread to make sure that the new thread is properly named org.neo4j.internal.batchimport.staging.ExecutionMonitor.Adapter @ Implement CompatExecutionMonitor and call Neo4jProxy.executionMonitor org.neo4j.logging.internal.LogService#getUserLogProvider() @ Pass the logService through and use Neo4jProxy at the end. diff --git a/examples/pregel-bootstrap/src/test/java/gds/example/ExamplePregelComputationAlgoTest.java b/examples/pregel-bootstrap/src/test/java/gds/example/ExamplePregelComputationAlgoTest.java index 26f51bb3952..7ce2e5b753f 100644 --- a/examples/pregel-bootstrap/src/test/java/gds/example/ExamplePregelComputationAlgoTest.java +++ b/examples/pregel-bootstrap/src/test/java/gds/example/ExamplePregelComputationAlgoTest.java @@ -64,7 +64,7 @@ void runExamplePregelComputation() { graph, config, new ExamplePregelComputation(), - Pools.DEFAULT, + ExecutorServices.DEFAULT, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/bfs/BFSPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/bfs/BFSPregelAlgoTest.java index 5acceeec466..af7d71fbe7d 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/bfs/BFSPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/bfs/BFSPregelAlgoTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.TestSupport; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -111,7 +111,7 @@ void levelBfs() { graph, config, new BFSLevelPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -147,7 +147,7 @@ void parentBfs() { graph, config, new BFSParentPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -183,7 +183,7 @@ void parentBugTest() { parentGraph, config, new BFSParentPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/cc/ConnectedComponentsPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/cc/ConnectedComponentsPregelAlgoTest.java index c8f0c96109c..856755c1f9d 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/cc/ConnectedComponentsPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/cc/ConnectedComponentsPregelAlgoTest.java @@ -23,7 +23,7 @@ import org.neo4j.gds.Orientation; import org.neo4j.gds.TestSupport; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -85,7 +85,7 @@ void wcc() { graph, config, new ConnectedComponentsPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/lp/LabelPropagationPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/lp/LabelPropagationPregelAlgoTest.java index e9ebb5a069d..4a6611a9f43 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/lp/LabelPropagationPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/lp/LabelPropagationPregelAlgoTest.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.Orientation; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -73,7 +73,7 @@ void runLP() { graph, config, new LabelPropagationPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -111,7 +111,7 @@ public double applyRelationshipWeight(double nodeValue, double relationshipWeigh graph, config, weightedLabelPropagation, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/PageRankPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/PageRankPregelAlgoTest.java index febe951e386..86b211d519e 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/PageRankPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/PageRankPregelAlgoTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -88,7 +88,7 @@ void runPR() { graph, config, new PageRankPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/WeightedPageRankPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/WeightedPageRankPregelAlgoTest.java index 42fa414694e..c0e44d4f749 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/WeightedPageRankPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/pr/WeightedPageRankPregelAlgoTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -130,7 +130,7 @@ static void assertResult(TestGraph graph, Map expected) { graph, config, new PageRankPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/sssp/SingleSourceShortestPathPregelAlgoTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/sssp/SingleSourceShortestPathPregelAlgoTest.java index da597122bec..48566f62d83 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/sssp/SingleSourceShortestPathPregelAlgoTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/sssp/SingleSourceShortestPathPregelAlgoTest.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.Test; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; @@ -83,7 +83,7 @@ void runSSSP() { graph, config, new SingleSourceShortestPathPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/triangleCount/TriangleCountPregelTest.java b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/triangleCount/TriangleCountPregelTest.java index fd3e4d30988..5582660c6e2 100644 --- a/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/triangleCount/TriangleCountPregelTest.java +++ b/examples/pregel-example/src/test/java/org/neo4j/gds/beta/pregel/triangleCount/TriangleCountPregelTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.neo4j.gds.api.Graph; import org.neo4j.gds.beta.pregel.Pregel; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.paged.HugeLongArray; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -332,7 +332,7 @@ HugeLongArray nodeWiseTriangles(Graph graph) { graph, config, new TriangleCountPregel(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/graph-sampling/src/main/java/org/neo4j/gds/graphsampling/GraphSampleConstructor.java b/graph-sampling/src/main/java/org/neo4j/gds/graphsampling/GraphSampleConstructor.java index 00ed2f9cc66..c7836c479df 100644 --- a/graph-sampling/src/main/java/org/neo4j/gds/graphsampling/GraphSampleConstructor.java +++ b/graph-sampling/src/main/java/org/neo4j/gds/graphsampling/GraphSampleConstructor.java @@ -30,7 +30,7 @@ import org.neo4j.gds.beta.filter.expression.EvaluationContext; import org.neo4j.gds.beta.filter.expression.Expression; import org.neo4j.gds.config.GraphSampleAlgoConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.RunWithConcurrency; import org.neo4j.gds.core.loading.GraphStoreBuilder; import org.neo4j.gds.core.loading.ImmutableNodes; @@ -108,7 +108,7 @@ public double evaluate(EvaluationContext context) { idMap, config.concurrency(), Map.of(), - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); diff --git a/io/core/src/main/java/org/neo4j/gds/core/io/file/FileToGraphStoreImporter.java b/io/core/src/main/java/org/neo4j/gds/core/io/file/FileToGraphStoreImporter.java index 961d36b1d60..e33c3119a69 100644 --- a/io/core/src/main/java/org/neo4j/gds/core/io/file/FileToGraphStoreImporter.java +++ b/io/core/src/main/java/org/neo4j/gds/core/io/file/FileToGraphStoreImporter.java @@ -28,8 +28,8 @@ import org.neo4j.gds.api.Topology; import org.neo4j.gds.api.schema.ImmutableMutableGraphSchema; import org.neo4j.gds.api.schema.MutableNodeSchema; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.io.GraphStoreGraphPropertyVisitor; import org.neo4j.gds.core.io.GraphStoreRelationshipVisitor; import org.neo4j.gds.core.loading.Capabilities.WriteMode; @@ -175,7 +175,7 @@ private Nodes importNodes(FileInput fileInput) { (index) -> new ElementImportRunner<>(nodeVisitorBuilder.build(), nodesIterator, progressTracker) ); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var nodes = nodesBuilder.build(); @@ -206,7 +206,7 @@ private void importRelationships(FileInput fileInput, IdMap nodes) { (index) -> new ElementImportRunner<>(relationshipVisitorBuilder.build(), relationshipsIterator, progressTracker) ); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var relationshipImportResult = relationshipImportResult(relationshipBuildersByType); @@ -235,7 +235,7 @@ private void importGraphProperties(FileInput fileInput) { progressTracker ) ); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); graphStoreGraphPropertyVisitor.close(); graphStoreBuilder.graphProperties(GraphPropertyStoreFromVisitorHelper.fromGraphPropertyVisitor( diff --git a/ml/ml-algo/src/main/java/org/neo4j/gds/ml/splitting/EdgeSplitter.java b/ml/ml-algo/src/main/java/org/neo4j/gds/ml/splitting/EdgeSplitter.java index 769b63caf6b..d5982ac9513 100644 --- a/ml/ml-algo/src/main/java/org/neo4j/gds/ml/splitting/EdgeSplitter.java +++ b/ml/ml-algo/src/main/java/org/neo4j/gds/ml/splitting/EdgeSplitter.java @@ -30,7 +30,7 @@ import org.neo4j.gds.api.RelationshipWithPropertyConsumer; import org.neo4j.gds.api.schema.Direction; import org.neo4j.gds.core.Aggregation; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.construction.GraphFactory; import org.neo4j.gds.core.loading.construction.RelationshipsBuilder; @@ -170,7 +170,7 @@ private static RelationshipsBuilder newRelationshipsBuilder( .map(key -> List.of(GraphFactory.PropertyConfig.of(key, Aggregation.SINGLE, DefaultValue.forDouble()))) .orElse(List.of())) .concurrency(1) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); } diff --git a/pregel-proc-generator/src/main/java/org/neo4j/gds/pregel/generator/AlgorithmGenerator.java b/pregel-proc-generator/src/main/java/org/neo4j/gds/pregel/generator/AlgorithmGenerator.java index 1b767603d90..35e73d4348c 100644 --- a/pregel-proc-generator/src/main/java/org/neo4j/gds/pregel/generator/AlgorithmGenerator.java +++ b/pregel-proc-generator/src/main/java/org/neo4j/gds/pregel/generator/AlgorithmGenerator.java @@ -29,7 +29,7 @@ import org.neo4j.gds.api.Graph; import org.neo4j.gds.beta.pregel.Pregel; import org.neo4j.gds.beta.pregel.PregelResult; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -88,9 +88,9 @@ MethodSpec constructor() { .addStatement("super(progressTracker)") .addStatement("var computation = new $T()", typeNames.computation()) .addStatement( - "this.pregelJob = $T.create(graph, configuration, computation, $T.DEFAULT, progressTracker)", + "this.pregelJob = $T.create(graph, configuration, computation, $T.INSTANCE, progressTracker)", Pregel.class, - Pools.class + DefaultPool.class ).build(); } diff --git a/pregel-proc-generator/src/test/java/org/neo4j/gds/pregel/generator/AlgorithmGeneratorTest.java b/pregel-proc-generator/src/test/java/org/neo4j/gds/pregel/generator/AlgorithmGeneratorTest.java index 381a9936b03..d04e6312928 100644 --- a/pregel-proc-generator/src/test/java/org/neo4j/gds/pregel/generator/AlgorithmGeneratorTest.java +++ b/pregel-proc-generator/src/test/java/org/neo4j/gds/pregel/generator/AlgorithmGeneratorTest.java @@ -61,7 +61,7 @@ void shouldGenerateConstructor() { " org.neo4j.gds.core.utils.progress.tasks.ProgressTracker progressTracker) {" + NL + " super(progressTracker);" + NL + " var computation = new a.b.C();" + NL + - " this.pregelJob = org.neo4j.gds.beta.pregel.Pregel.create(graph, configuration, computation, org.neo4j.gds.core.concurrency.Pools.DEFAULT, progressTracker);" + NL + + " this.pregelJob = org.neo4j.gds.beta.pregel.Pregel.create(graph, configuration, computation, org.neo4j.gds.core.concurrency.DefaultPool.INSTANCE, progressTracker);" + NL + "}" + NL ); } diff --git a/pregel-proc-generator/src/test/resources/expected/BidirectionalComputationAlgorithm.java b/pregel-proc-generator/src/test/resources/expected/BidirectionalComputationAlgorithm.java index a42fa3e1a19..d682a26ab71 100644 --- a/pregel-proc-generator/src/test/resources/expected/BidirectionalComputationAlgorithm.java +++ b/pregel-proc-generator/src/test/resources/expected/BidirectionalComputationAlgorithm.java @@ -25,7 +25,7 @@ import org.neo4j.gds.beta.pregel.Pregel; import org.neo4j.gds.beta.pregel.PregelProcedureConfig; import org.neo4j.gds.beta.pregel.PregelResult; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -37,7 +37,7 @@ public final class BidirectionalComputationAlgorithm extends Algorithm { ProgressTracker progressTracker) { super(progressTracker); var computation = new Computation(); - this.pregelJob = Pregel.create(graph, configuration, computation, Pools.DEFAULT, progressTracker); + this.pregelJob = Pregel.create(graph, configuration, computation, DefaultPool.INSTANCE, progressTracker); } @Override diff --git a/pregel/src/main/java/org/neo4j/gds/beta/pregel/Pregel.java b/pregel/src/main/java/org/neo4j/gds/beta/pregel/Pregel.java index 56ce22a56cd..8c8a788f7b2 100644 --- a/pregel/src/main/java/org/neo4j/gds/beta/pregel/Pregel.java +++ b/pregel/src/main/java/org/neo4j/gds/beta/pregel/Pregel.java @@ -22,7 +22,7 @@ import org.immutables.value.Value; import org.neo4j.gds.api.Graph; import org.neo4j.gds.beta.pregel.context.MasterComputeContext; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.mem.MemoryEstimation; import org.neo4j.gds.core.utils.mem.MemoryEstimations; @@ -159,7 +159,7 @@ private Pregel( .messenger(messenger) .voteBits(HugeAtomicBitSet.create(graph.nodeCount())) .executorService(config.useForkJoin() - ? Pools.createForkJoinPool(config.concurrency()) + ? ExecutorServiceUtil.createForkJoinPool(config.concurrency()) : executor) .progressTracker(progressTracker) .build(); diff --git a/pregel/src/test/java/org/neo4j/gds/beta/pregel/PregelTest.java b/pregel/src/test/java/org/neo4j/gds/beta/pregel/PregelTest.java index 8dc1deac7ca..d65e7879a08 100644 --- a/pregel/src/test/java/org/neo4j/gds/beta/pregel/PregelTest.java +++ b/pregel/src/test/java/org/neo4j/gds/beta/pregel/PregelTest.java @@ -44,7 +44,7 @@ import org.neo4j.gds.compat.Neo4jProxy; import org.neo4j.gds.compat.TestLog; import org.neo4j.gds.core.ImmutableGraphDimensions; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.mem.MemoryRange; import org.neo4j.gds.core.utils.paged.HugeDoubleArray; @@ -109,7 +109,7 @@ void sendsMessages( graph, config, computation, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -127,7 +127,7 @@ void stopsEarlyWhenTransactionHasBeenTerminated() { graph, config, new TestPregelComputation(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); pregelJob.setTerminationFlag(terminationFlag); @@ -163,7 +163,7 @@ void logProgress(Partitioning partitioning) { graph, config, computation, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ).run(); @@ -225,7 +225,7 @@ void cleanupProgressLogging() { graph, config, computation, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); @@ -280,7 +280,7 @@ private HugeDoubleArray run(Graph graph, PregelConfig config, PregelComputation< graph, config, computation, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -300,7 +300,7 @@ void sendMessageToSpecificTarget(Partitioning partitioning) { graph, config, new TestSendTo(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -325,7 +325,7 @@ void compositeNodeValueTest(Partitioning partitioning) { graph, config, new CompositeTestComputation(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -363,7 +363,7 @@ void testMasterComputeStep(Partitioning partitioning) { graph, ImmutablePregelConfig.builder().maxIterations(4).partitioning(partitioning).build(), new TestMasterCompute(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -378,7 +378,7 @@ void testMasterComputeStepWithConvergence(Partitioning partitioning) { graph, ImmutablePregelConfig.builder().maxIterations(4).partitioning(partitioning).build(), new TestMasterCompute(2), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -515,7 +515,7 @@ public boolean masterCompute(MasterComputeContext context) { return true; } }, - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ).run(); @@ -603,7 +603,7 @@ void preventIllegalConcurrencyConfiguration(Partitioning partitioning) { graph, config, new TestSendTo(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER )); } @@ -626,7 +626,7 @@ void messagesInInitialSuperStepShouldBeEmpty(Partitioning partitioning, boolean graph, config, new TestEmptyMessageInInitialSuperstep(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -825,7 +825,7 @@ void throwIfBidirectionalWithoutInverseIndex() { graph, ImmutablePregelConfig.builder().maxIterations(4).build(), new Bidirectional(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphProjectProc.java b/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphProjectProc.java index c73c97037d9..d3144ba9095 100644 --- a/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphProjectProc.java +++ b/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphProjectProc.java @@ -30,7 +30,7 @@ import org.neo4j.gds.config.GraphProjectFromGraphConfig; import org.neo4j.gds.config.GraphProjectFromStoreConfig; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.GraphStoreCatalog; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.core.utils.mem.MemoryTree; @@ -232,7 +232,7 @@ private GraphProjectSubgraphResult projectGraphFromGraphStore( var graphStore = GraphStoreFilter.filter( fromGraphStore, config, - Pools.DEFAULT, + DefaultPool.INSTANCE, progressTracker ); diff --git a/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphWriteNodeLabelProc.java b/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphWriteNodeLabelProc.java index 7cf025dab39..d05279ca8a0 100644 --- a/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphWriteNodeLabelProc.java +++ b/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphWriteNodeLabelProc.java @@ -21,7 +21,7 @@ import org.neo4j.gds.beta.filter.NodesFilter; import org.neo4j.gds.config.WriteLabelConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -66,7 +66,7 @@ public Stream write( nodeFilter, procedureConfig.concurrency(), Map.of(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); @@ -74,7 +74,7 @@ public Stream write( .withIdMap(filteredNodes.idMap()) .withTerminationFlag(TerminationFlag.wrap(executionContext().terminationMonitor())) .withArrowConnectionInfo(procedureConfig.arrowConnectionInfo(), graphStore.databaseId().databaseName()) - .parallel(Pools.DEFAULT, procedureConfig.concurrency()) + .parallel(DefaultPool.INSTANCE, procedureConfig.concurrency()) .build(); runWithExceptionLogging( diff --git a/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodeLabelMutator.java b/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodeLabelMutator.java index 7e6de0142c8..f660e7fa6d4 100644 --- a/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodeLabelMutator.java +++ b/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodeLabelMutator.java @@ -22,7 +22,7 @@ import org.neo4j.gds.NodeLabel; import org.neo4j.gds.beta.filter.NodesFilter; import org.neo4j.gds.config.MutateLabelConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.GraphStoreCatalog; import org.neo4j.gds.core.loading.GraphStoreWithConfig; import org.neo4j.gds.core.loading.ImmutableCatalogRequest; @@ -52,7 +52,7 @@ static Stream mutateNodeLabel(String graphName, String nodeLa nodeFilter, procedureConfig.concurrency(), Map.of(), - Pools.DEFAULT, + DefaultPool.INSTANCE, ProgressTracker.NULL_TRACKER ); diff --git a/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodePropertiesWriter.java b/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodePropertiesWriter.java index 4f23f0e456e..7a338f2c15b 100644 --- a/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodePropertiesWriter.java +++ b/proc/catalog/src/main/java/org/neo4j/gds/catalog/NodePropertiesWriter.java @@ -27,7 +27,7 @@ import org.neo4j.gds.config.GraphWriteNodePropertiesConfig; import org.neo4j.gds.core.CypherMapAccess; import org.neo4j.gds.core.CypherMapWrapper; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.GraphStoreWithConfig; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.core.utils.TerminationFlag; @@ -147,7 +147,7 @@ private static long writeNodeProperties( var exporter = nodePropertyExporterBuilder .withIdMap(subGraph) .withTerminationFlag(TerminationFlag.wrap(executionContext.terminationMonitor())) - .parallel(Pools.DEFAULT, config.writeConcurrency()) + .parallel(DefaultPool.INSTANCE, config.writeConcurrency()) .withProgressTracker(progressTracker) .withArrowConnectionInfo(config.arrowConnectionInfo(), graphStore.databaseId().databaseName()) .build(); diff --git a/proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphProjectProcTest.java b/proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphProjectProcTest.java index 040467e68e9..22feadcb189 100644 --- a/proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphProjectProcTest.java +++ b/proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphProjectProcTest.java @@ -47,9 +47,9 @@ import org.neo4j.gds.config.GraphProjectFromCypherConfig; import org.neo4j.gds.config.GraphProjectFromStoreConfig; import org.neo4j.gds.core.Aggregation; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.CypherMapWrapper; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.loading.GraphStoreCatalog; import org.neo4j.gds.core.utils.progress.GlobalTaskStore; import org.neo4j.gds.core.utils.progress.TaskRegistry; @@ -895,7 +895,7 @@ void loadGraphWithSaturatedThreadPool() { // block all available threads for (int i = 0; i < ConcurrencyConfig.DEFAULT_CONCURRENCY; i++) { futures.add( - Pools.DEFAULT.submit(() -> LockSupport.parkNanos(Duration.ofSeconds(1).toNanos())) + DefaultPool.INSTANCE.submit(() -> LockSupport.parkNanos(Duration.ofSeconds(1).toNanos())) ); } diff --git a/proc/common/src/main/java/org/neo4j/gds/CommunityProcCompanion.java b/proc/common/src/main/java/org/neo4j/gds/CommunityProcCompanion.java index 66587161d4b..0a5eb7ff168 100644 --- a/proc/common/src/main/java/org/neo4j/gds/CommunityProcCompanion.java +++ b/proc/common/src/main/java/org/neo4j/gds/CommunityProcCompanion.java @@ -27,7 +27,7 @@ import org.neo4j.gds.config.ConcurrencyConfig; import org.neo4j.gds.config.ConsecutiveIdsConfig; import org.neo4j.gds.config.SeedConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.nodeproperties.ConsecutiveLongNodePropertyValues; import org.neo4j.gds.nodeproperties.LongIfChangedNodePropertyValues; import org.neo4j.gds.result.CommunityStatistics; @@ -122,7 +122,7 @@ private static LongNodePropertyValues applySizeFilter( var communitySizes = CommunityStatistics.communitySizes( nodeProperties.nodeCount(), nodeProperties::longValue, - Pools.DEFAULT, + DefaultPool.INSTANCE, concurrency ); return new CommunitySizeFilter(nodeProperties, communitySizes, size); diff --git a/proc/common/src/main/java/org/neo4j/gds/WriteNodePropertiesComputationResultConsumer.java b/proc/common/src/main/java/org/neo4j/gds/WriteNodePropertiesComputationResultConsumer.java index ffcb462c93c..1fb2c06ab91 100644 --- a/proc/common/src/main/java/org/neo4j/gds/WriteNodePropertiesComputationResultConsumer.java +++ b/proc/common/src/main/java/org/neo4j/gds/WriteNodePropertiesComputationResultConsumer.java @@ -23,7 +23,7 @@ import org.neo4j.gds.api.schema.PropertySchema; import org.neo4j.gds.config.AlgoBaseConfig; import org.neo4j.gds.config.WritePropertyConfig; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.loading.Capabilities.WriteMode; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; @@ -111,7 +111,7 @@ void writeToNeo( .withTerminationFlag(computationResult.algorithm().terminationFlag) .withProgressTracker(progressTracker) .withArrowConnectionInfo(config.arrowConnectionInfo(), computationResult.graphStore().databaseId().databaseName()) - .parallel(Pools.DEFAULT, config.writeConcurrency()) + .parallel(DefaultPool.INSTANCE, config.writeConcurrency()) .build(); try { diff --git a/proc/community/src/main/java/org/neo4j/gds/kmeans/KmeansWriteSpec.java b/proc/community/src/main/java/org/neo4j/gds/kmeans/KmeansWriteSpec.java index aeaa8bcb396..c81841e9275 100644 --- a/proc/community/src/main/java/org/neo4j/gds/kmeans/KmeansWriteSpec.java +++ b/proc/community/src/main/java/org/neo4j/gds/kmeans/KmeansWriteSpec.java @@ -21,7 +21,7 @@ import org.neo4j.gds.api.properties.nodes.EmptyLongNodePropertyValues; import org.neo4j.gds.api.properties.nodes.LongNodePropertyValues; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.ProgressTimer; import org.neo4j.gds.core.write.NodePropertyExporter; import org.neo4j.gds.executor.AlgorithmSpec; @@ -101,7 +101,7 @@ public ComputationResultConsumer context, Messages mess context.setNodeValue(LONG_ARRAY_KEY, new long[]{1, 3, 3, 7}); context.setNodeValue(DOUBLE_ARRAY_KEY, new double[]{1, 9, 8, 4}); } - }, Pools.DEFAULT, progressTracker); + }, DefaultPool.INSTANCE, progressTracker); } @Override diff --git a/proc/similarity/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityMutateSpec.java b/proc/similarity/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityMutateSpec.java index 607df985cfb..c99b33a85b7 100644 --- a/proc/similarity/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityMutateSpec.java +++ b/proc/similarity/src/main/java/org/neo4j/gds/similarity/filterednodesim/FilteredNodeSimilarityMutateSpec.java @@ -27,7 +27,7 @@ import org.neo4j.gds.api.ProcedureReturnColumns; import org.neo4j.gds.api.nodeproperties.ValueType; import org.neo4j.gds.api.schema.RelationshipPropertySchema; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.loading.SingleTypeRelationships; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -145,7 +145,7 @@ private SingleTypeRelationships getRelationships( .orientation(Orientation.NATURAL) .addPropertyConfig(GraphFactory.PropertyConfig.of(relationshipPropertyKey)) .concurrency(1) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); IdMap idMap = computationResult.graph(); diff --git a/proc/similarity/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityMutateSpecification.java b/proc/similarity/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityMutateSpecification.java index 752d0e22245..ed48632baf6 100644 --- a/proc/similarity/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityMutateSpecification.java +++ b/proc/similarity/src/main/java/org/neo4j/gds/similarity/nodesim/NodeSimilarityMutateSpecification.java @@ -26,7 +26,7 @@ import org.neo4j.gds.api.ProcedureReturnColumns; import org.neo4j.gds.api.nodeproperties.ValueType; import org.neo4j.gds.api.schema.RelationshipPropertySchema; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.huge.HugeGraph; import org.neo4j.gds.core.loading.SingleTypeRelationships; import org.neo4j.gds.core.loading.construction.GraphFactory; @@ -134,7 +134,7 @@ private SingleTypeRelationships getRelationships( .orientation(Orientation.NATURAL) .addPropertyConfig(GraphFactory.PropertyConfig.of(relationshipPropertyKey)) .concurrency(1) - .executorService(Pools.DEFAULT) + .executorService(DefaultPool.INSTANCE) .build(); IdMap idMap = computationResult.graph(); diff --git a/subgraph-filtering/src/test/java/org/neo4j/gds/beta/filter/NodesFilterTest.java b/subgraph-filtering/src/test/java/org/neo4j/gds/beta/filter/NodesFilterTest.java index ce8a9d31cbd..e269fb13bbc 100644 --- a/subgraph-filtering/src/test/java/org/neo4j/gds/beta/filter/NodesFilterTest.java +++ b/subgraph-filtering/src/test/java/org/neo4j/gds/beta/filter/NodesFilterTest.java @@ -23,7 +23,7 @@ import org.neo4j.gds.NodeLabel; import org.neo4j.gds.api.GraphStore; import org.neo4j.gds.beta.filter.expression.ExpressionParser; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.ExecutorServiceUtil; import org.neo4j.gds.core.utils.progress.tasks.ProgressTracker; import org.neo4j.gds.extension.GdlExtension; import org.neo4j.gds.extension.GdlGraph; @@ -60,7 +60,7 @@ void basicFiltering() throws ParseException { ExpressionParser.parse("n:A AND n.p > 1.0", Map.of()), 1, Map.of(), - Pools.DEFAULT_SINGLE_THREAD_POOL, + ExecutorServiceUtil.DEFAULT_SINGLE_THREAD_POOL, ProgressTracker.NULL_TRACKER ); diff --git a/test-utils/src/main/java/org/neo4j/gds/GraphLoaderBuilders.java b/test-utils/src/main/java/org/neo4j/gds/GraphLoaderBuilders.java index a9484fc9801..b1e151f913e 100644 --- a/test-utils/src/main/java/org/neo4j/gds/GraphLoaderBuilders.java +++ b/test-utils/src/main/java/org/neo4j/gds/GraphLoaderBuilders.java @@ -31,7 +31,7 @@ import org.neo4j.gds.core.Aggregation; import org.neo4j.gds.core.GraphLoader; import org.neo4j.gds.core.ImmutableGraphLoader; -import org.neo4j.gds.core.concurrency.Pools; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.utils.TerminationFlag; import org.neo4j.gds.core.utils.progress.EmptyTaskRegistryFactory; import org.neo4j.gds.core.utils.progress.JobId; @@ -194,7 +194,7 @@ public static GraphLoader createGraphLoader( .databaseId(DatabaseId.of(databaseService)) .dependencyResolver(GraphDatabaseApiProxy.dependencyResolver(databaseService)) .transactionContext(transactionContext.orElseGet(() -> TestSupport.fullAccessTransaction(databaseService))) - .executor(executorService.orElse(Pools.DEFAULT)) + .executor(executorService.orElse(DefaultPool.INSTANCE)) .terminationFlag(terminationFlag.orElse(TerminationFlag.RUNNING_TRUE)) .taskRegistryFactory(EmptyTaskRegistryFactory.INSTANCE) .userLogRegistryFactory(EmptyUserLogRegistryFactory.INSTANCE) diff --git a/test-utils/src/main/java/org/neo4j/gds/core/idmap/IdMapBuilderTest.java b/test-utils/src/main/java/org/neo4j/gds/core/idmap/IdMapBuilderTest.java index a7b57421276..e0c114266f2 100644 --- a/test-utils/src/main/java/org/neo4j/gds/core/idmap/IdMapBuilderTest.java +++ b/test-utils/src/main/java/org/neo4j/gds/core/idmap/IdMapBuilderTest.java @@ -28,8 +28,8 @@ import org.neo4j.gds.NodeLabel; import org.neo4j.gds.annotation.ValueClass; import org.neo4j.gds.api.IdMap; +import org.neo4j.gds.core.concurrency.DefaultPool; import org.neo4j.gds.core.concurrency.ParallelUtil; -import org.neo4j.gds.core.concurrency.Pools; import org.neo4j.gds.core.loading.IdMapBuilder; import org.neo4j.gds.core.loading.LabelInformationBuilders; import org.neo4j.gds.core.utils.partition.PartitionUtils; @@ -241,7 +241,7 @@ void testBuildParallel( } }, Optional.empty()); - ParallelUtil.run(tasks, Pools.DEFAULT); + ParallelUtil.run(tasks, DefaultPool.INSTANCE); var idMap = idMapBuilder.build(LabelInformationBuilders.allNodes(), highestOriginalId, concurrency);