summaryrefslogtreecommitdiff
path: root/benchmarks
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2016-08-17 15:48:12 -0700
committerRyan Ernst <ryan@iernst.net>2016-08-17 15:55:31 -0700
commit1ff348ed7f5bab9726765a1e60e8a43ec93bcf71 (patch)
treedd18c871e18707eb72c2d6e1b492ce6fb4ae3f2c /benchmarks
parentd4dec26aa00ced5ead648881301a035272210288 (diff)
Plugins: Make custom allocation deciders use pull based extensions
This change converts AllocationDecider registration from push based on ClusterModule to implementing with a new ClusterPlugin interface. AllocationDecider instances are allowed to use only Settings and ClusterSettings.
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java20
1 files changed, 6 insertions, 14 deletions
diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java
index 9b1cfaabf9..ad06f75074 100644
--- a/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java
+++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/routing/allocation/Allocators.java
@@ -38,6 +38,8 @@ import org.elasticsearch.gateway.GatewayAllocator;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -72,7 +74,7 @@ public final class Allocators {
public static AllocationService createAllocationService(Settings settings) throws NoSuchMethodException, InstantiationException,
IllegalAccessException, InvocationTargetException {
- return createAllocationService(settings, new ClusterSettings(Settings.Builder.EMPTY_SETTINGS, ClusterSettings
+ return createAllocationService(settings, new ClusterSettings(Settings.EMPTY, ClusterSettings
.BUILT_IN_CLUSTER_SETTINGS));
}
@@ -85,19 +87,9 @@ public final class Allocators {
public static AllocationDeciders defaultAllocationDeciders(Settings settings, ClusterSettings clusterSettings) throws
IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
- List<AllocationDecider> list = new ArrayList<>();
- // Keep a deterministic order of allocation deciders for the benchmark
- for (Class<? extends AllocationDecider> deciderClass : ClusterModule.DEFAULT_ALLOCATION_DECIDERS) {
- try {
- Constructor<? extends AllocationDecider> constructor = deciderClass.getConstructor(Settings.class, ClusterSettings
- .class);
- list.add(constructor.newInstance(settings, clusterSettings));
- } catch (NoSuchMethodException e) {
- Constructor<? extends AllocationDecider> constructor = deciderClass.getConstructor(Settings.class);
- list.add(constructor.newInstance(settings));
- }
- }
- return new AllocationDeciders(settings, list.toArray(new AllocationDecider[0]));
+ Collection<AllocationDecider> deciders =
+ ClusterModule.createAllocationDeciders(settings, clusterSettings, Collections.emptyList());
+ return new AllocationDeciders(settings, deciders);
}