Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/main/java/io/vertx/core/Vertx.java b/src/main/java/io/vertx/core/Vertx.java
- index af83f3a..521968b 100644
- --- a/src/main/java/io/vertx/core/Vertx.java
- +++ b/src/main/java/io/vertx/core/Vertx.java
- @@ -441,6 +441,13 @@ public interface Vertx extends Measured {
- */
- boolean isClustered();
- + /**
- + * The number of verticle instances associated to a deployment id
- + *
- + * @return the number of verticles associated to a deployment id or -1 if there are none
- + */
- + int getInstanceCount(String deploymentId);
- +
- /**
- * Safely execute some blocking code.
- * <p>
- diff --git a/src/main/java/io/vertx/core/impl/VertxImpl.java b/src/main/java/io/vertx/core/impl/VertxImpl.java
- index 67f089b..1f7f749 100644
- --- a/src/main/java/io/vertx/core/impl/VertxImpl.java
- +++ b/src/main/java/io/vertx/core/impl/VertxImpl.java
- @@ -137,6 +137,7 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
- this.deploymentManager = new DeploymentManager(this);
- this.metrics = initialiseMetrics(options);
- this.haEnabled = options.isClustered() && options.isHAEnabled();
- +
- if (options.isClustered()) {
- this.clusterManager = getClusterManager(options);
- this.clusterManager.setVertx(this);
- @@ -202,6 +203,16 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
- }
- }
- + @Override
- + public int getInstanceCount(String deploymentId) {
- + Deployment deployment = deploymentManager.getDeployment(deploymentId);
- + if (deployment != null) {
- + return deployment.deploymentOptions().getInstances();
- + }
- +
- + return -1;
- + }
- +
- /**
- * @return The FileSystem implementation for the OS
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement