Skip to content

Commit

Permalink
Remove vertx.cluster.managerClass system property
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Feb 6, 2024
1 parent 048356d commit 0101f33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/vertx/core/ServiceHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public static <T> T loadFactoryOrNull(Class<T> clazz) {
}


public static <T> Collection<T> loadFactories(Class<T> clazz) {
public static <T> List<T> loadFactories(Class<T> clazz) {
return loadFactories(clazz, null);
}

public static <T> Collection<T> loadFactories(Class<T> clazz, ClassLoader classLoader) {
public static <T> List<T> loadFactories(Class<T> clazz, ClassLoader classLoader) {
List<T> list = new ArrayList<>();
ServiceLoader<T> factories;
if (classLoader != null) {
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/io/vertx/core/impl/SysProps.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

public enum SysProps {

/**
* Cluster manager to use class FQN.
*
* It does not seem tested, it is not documented, but we can find evidence of it on the web (mailing list).
*/
CLUSTER_MANAGER_CLASS("vertx.cluster.managerClass"),

/**
* Duplicate of {@link io.vertx.core.http.HttpHeaders#DISABLE_HTTP_HEADERS_VALIDATION}
*/
Expand Down
20 changes: 2 additions & 18 deletions src/main/java/io/vertx/core/impl/VertxBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import io.vertx.core.spi.metrics.VertxMetrics;
import io.vertx.core.spi.tracing.VertxTracer;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

/**
* Vertx builder for creating vertx instances with SPI overrides.
Expand Down Expand Up @@ -279,9 +279,7 @@ public VertxBuilder init() {
initTransport();
initMetrics();
initTracing();
Collection<VertxServiceProvider> providers = new ArrayList<>();
initClusterManager(providers);
providers.addAll(ServiceHelper.loadFactories(VertxServiceProvider.class));
List<VertxServiceProvider> providers = ServiceHelper.loadFactories(VertxServiceProvider.class);
initProviders(providers);
initThreadFactory();
initExecutorServiceFactory();
Expand Down Expand Up @@ -314,20 +312,6 @@ private void initTracing() {
}
}

private static void initClusterManager(Collection<VertxServiceProvider> providers) {
String clusterManagerClassName = SysProps.CLUSTER_MANAGER_CLASS.get();
if (clusterManagerClassName != null) {
// We allow specify a sys prop for the cluster manager factory which overrides ServiceLoader
try {
Class<?> clazz = Class.forName(clusterManagerClassName);
ClusterManager clusterManager = (ClusterManager) clazz.getDeclaredConstructor().newInstance();
providers.add(clusterManager);
} catch (Exception e) {
throw new IllegalStateException("Failed to instantiate " + clusterManagerClassName, e);
}
}
}

private void initTransport() {
if (transport != null) {
return;
Expand Down

0 comments on commit 0101f33

Please sign in to comment.