Skip to content

Commit

Permalink
Rename impl VertxBuilder -> VertxBootstrapImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Aug 11, 2024
1 parent b3690c7 commit b71f090
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 32 deletions.
1 change: 0 additions & 1 deletion vertx-core/src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import io.vertx.core.http.*;
import io.vertx.core.impl.VertxImpl;
import io.vertx.core.internal.ContextInternal;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.dns.impl.DnsAddressResolverProvider;
import io.vertx.core.internal.VertxBootstrap;
import io.vertx.core.metrics.Measured;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
import java.util.List;

/**
* Vertx builder for creating vertx instances with SPI overrides.
* Bootstrap implementation.
*
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
*/
public class VertxBuilder implements VertxBootstrap {
public class VertxBootstrapImpl implements VertxBootstrap {

private static final Logger log = LoggerFactory.getLogger(VertxBuilder.class);
private static final Logger log = LoggerFactory.getLogger(VertxBootstrapImpl.class);

private VertxOptions options;
private JsonObject config;
Expand All @@ -60,16 +60,16 @@ public class VertxBuilder implements VertxBootstrap {
private VertxMetrics metrics;
private FileResolver fileResolver;

public VertxBuilder(JsonObject config) {
public VertxBootstrapImpl(JsonObject config) {
this(new VertxOptions(config));
this.config = config;
}

public VertxBuilder(VertxOptions options) {
public VertxBootstrapImpl(VertxOptions options) {
this.options = options;
}

public VertxBuilder() {
public VertxBootstrapImpl() {
this(new VertxOptions());
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public Transport transport() {
* @param transport the transport
* @return this builder instance
*/
public VertxBuilder transport(Transport transport) {
public VertxBootstrapImpl transport(Transport transport) {
this.transport = transport;
return this;
}
Expand All @@ -111,7 +111,7 @@ public ClusterManager clusterManager() {
return clusterManager;
}

public VertxBuilder clusterManager(ClusterManager clusterManager) {
public VertxBootstrapImpl clusterManager(ClusterManager clusterManager) {
this.clusterManager = clusterManager;
return this;
}
Expand All @@ -121,7 +121,7 @@ public VertxMetricsFactory metricsFactory() {
return metricsFactory;
}

public VertxBuilder metricsFactory(VertxMetricsFactory factory) {
public VertxBootstrapImpl metricsFactory(VertxMetricsFactory factory) {
this.metricsFactory = factory;
return this;
}
Expand All @@ -130,7 +130,7 @@ public NodeSelector clusterNodeSelector() {
return clusterNodeSelector;
}

public VertxBuilder clusterNodeSelector(NodeSelector selector) {
public VertxBootstrapImpl clusterNodeSelector(NodeSelector selector) {
this.clusterNodeSelector = selector;
return this;
}
Expand All @@ -140,7 +140,7 @@ public VertxTracerFactory tracerFactory() {
return tracerFactory;
}

public VertxBuilder tracerFactory(VertxTracerFactory factory) {
public VertxBootstrapImpl tracerFactory(VertxTracerFactory factory) {
this.tracerFactory = factory;
return this;
}
Expand All @@ -149,7 +149,7 @@ public VertxTracer tracer() {
return tracer;
}

public VertxBuilder tracer(VertxTracer tracer) {
public VertxBootstrapImpl tracer(VertxTracer tracer) {
this.tracer = tracer;
return this;
}
Expand All @@ -158,7 +158,7 @@ public VertxMetrics metrics() {
return metrics;
}

public VertxBuilder metrics(VertxMetrics metrics) {
public VertxBootstrapImpl metrics(VertxMetrics metrics) {
this.metrics = metrics;
return this;
}
Expand All @@ -175,7 +175,7 @@ public FileResolver fileResolver() {
* @param resolver the file resolver
* @return this builder instance
*/
public VertxBuilder fileResolver(FileResolver resolver) {
public VertxBootstrapImpl fileResolver(FileResolver resolver) {
this.fileResolver = resolver;
return this;
}
Expand All @@ -184,7 +184,7 @@ public VertxThreadFactory threadFactory() {
return threadFactory;
}

public VertxBuilder threadFactory(VertxThreadFactory factory) {
public VertxBootstrapImpl threadFactory(VertxThreadFactory factory) {
this.threadFactory = factory;
return this;
}
Expand All @@ -193,7 +193,7 @@ public ExecutorServiceFactory executorServiceFactory() {
return executorServiceFactory;
}

public VertxBuilder executorServiceFactory(ExecutorServiceFactory factory) {
public VertxBootstrapImpl executorServiceFactory(ExecutorServiceFactory factory) {
this.executorServiceFactory = factory;
return this;
}
Expand Down Expand Up @@ -241,7 +241,7 @@ public Future<Vertx> clusteredVertx() {
* Initialize the service providers.
* @return this builder instance
*/
public VertxBuilder init() {
public VertxBootstrapImpl init() {
initTransport();
initMetrics();
initTracing();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.spi.ExecutorServiceFactory;
import io.vertx.core.spi.VertxMetricsFactory;
import io.vertx.core.spi.VertxThreadFactory;
import io.vertx.core.spi.VertxTracerFactory;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.core.spi.cluster.NodeSelector;
import io.vertx.core.spi.file.FileResolver;
import io.vertx.core.spi.transport.Transport;

/**
* Vertx bootstrap for creating vertx instances with SPI overrides.
*
* @author <a href="mailto:julien@julienviet.com">Julien Viet</a>
*/
public interface VertxBootstrap {

/**
* @return a new fresh to use bootstrap
*/
static VertxBootstrap create() {
return new VertxBuilder();
return new VertxBootstrapImpl();
}

/**
Expand Down Expand Up @@ -117,7 +124,7 @@ static VertxBootstrap create() {
* @param transport the transport
* @return this builder instance
*/
VertxBuilder transport(Transport transport);
VertxBootstrapImpl transport(Transport transport);

/**
* @return the cluster manager to use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
package io.vertx.core.spi;

import io.vertx.core.VertxOptions;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.internal.VertxBootstrap;
import io.vertx.core.json.JsonObject;
import io.vertx.core.metrics.MetricsOptions;
Expand All @@ -27,7 +27,7 @@ public interface VertxMetricsFactory extends VertxServiceProvider {

@Override
default void init(VertxBootstrap bootstrap) {
VertxBuilder builder = (VertxBuilder) bootstrap;
VertxBootstrapImpl builder = (VertxBootstrapImpl) bootstrap;
if (builder.metrics() == null) {
VertxOptions vertxOptions = builder.options();
builder.metrics(metrics(vertxOptions));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

package io.vertx.core.spi;

import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.internal.VertxBootstrap;
import io.vertx.core.json.JsonObject;
import io.vertx.core.spi.tracing.VertxTracer;
Expand All @@ -32,7 +32,7 @@ public interface VertxTracerFactory extends VertxServiceProvider {

@Override
default void init(VertxBootstrap bootstrap) {
VertxBuilder builder = (VertxBuilder) bootstrap;
VertxBootstrapImpl builder = (VertxBootstrapImpl) bootstrap;
if (builder.tracer() == null) {
TracingOptions tracingOptions = builder.options().getTracingOptions();
if (tracingOptions == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import io.vertx.core.*;
import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.internal.VertxBootstrap;
import io.vertx.core.json.JsonObject;
import io.vertx.core.spi.cluster.ClusterManager;
Expand Down Expand Up @@ -46,7 +46,7 @@ public void test() throws Exception {
return vertxOptions;
})
.map(options -> {
VertxBootstrap factory = ((VertxBuilder)VertxBootstrap.create().options(options).init()).clusterNodeSelector(new CustomNodeSelector());
VertxBootstrap factory = ((VertxBootstrapImpl)VertxBootstrap.create().options(options).init()).clusterNodeSelector(new CustomNodeSelector());
return factory.clusteredVertx();
})
.collect(collectingAndThen(toList(), Future::all));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import io.vertx.core.*;
import io.vertx.core.eventbus.impl.clustered.Serializer;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.core.spi.cluster.NodeSelector;
import io.vertx.core.spi.cluster.RegistrationUpdateEvent;
Expand All @@ -38,7 +38,7 @@ public class MessageQueueOnWorkerThreadTest extends VertxTestBase {
public void setUp() throws Exception {
super.setUp();
CustomNodeSelector selector = new CustomNodeSelector();
VertxBuilder factory = new VertxBuilder().init().clusterNodeSelector(selector);
VertxBootstrapImpl factory = new VertxBootstrapImpl().init().clusterNodeSelector(selector);
Future<Vertx> fut = factory.clusteredVertx();
vertx = fut.toCompletionStage().toCompletableFuture().get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.eventbus.MessageProducer;
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxBootstrapImpl;
import io.vertx.core.internal.VertxBootstrap;
import io.vertx.core.spi.cluster.NodeSelector;
import io.vertx.core.spi.cluster.impl.DefaultNodeSelector;
Expand Down Expand Up @@ -49,7 +49,7 @@ public void selectForPublish(String address, Promise<Iterable<String>> promise)
promise.fail("Not implemented");
}
};
((VertxBuilder)VertxBootstrap.create().options(options).init()).clusterNodeSelector(nodeSelector).clusteredVertx().onComplete(onSuccess(node -> {
((VertxBootstrapImpl)VertxBootstrap.create().options(options).init()).clusterNodeSelector(nodeSelector).clusteredVertx().onComplete(onSuccess(node -> {
vertx = node;
MessageProducer<String> sender = vertx.eventBus().sender("foo");
sender.write("the_string").onComplete(onFailure(err -> {
Expand Down

0 comments on commit b71f090

Please sign in to comment.