Advertisement
Guest User

Untitled

a guest
May 28th, 2015
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. diff --git a/src/main/java/io/vertx/core/Vertx.java b/src/main/java/io/vertx/core/Vertx.java
  2. index af83f3a..521968b 100644
  3. --- a/src/main/java/io/vertx/core/Vertx.java
  4. +++ b/src/main/java/io/vertx/core/Vertx.java
  5. @@ -441,6 +441,13 @@ public interface Vertx extends Measured {
  6. */
  7. boolean isClustered();
  8.  
  9. + /**
  10. + * The number of verticle instances associated to a deployment id
  11. + *
  12. + * @return the number of verticles associated to a deployment id or -1 if there are none
  13. + */
  14. + int getInstanceCount(String deploymentId);
  15. +
  16. /**
  17. * Safely execute some blocking code.
  18. * <p>
  19. diff --git a/src/main/java/io/vertx/core/impl/VertxImpl.java b/src/main/java/io/vertx/core/impl/VertxImpl.java
  20. index 67f089b..1f7f749 100644
  21. --- a/src/main/java/io/vertx/core/impl/VertxImpl.java
  22. +++ b/src/main/java/io/vertx/core/impl/VertxImpl.java
  23. @@ -137,6 +137,7 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
  24. this.deploymentManager = new DeploymentManager(this);
  25. this.metrics = initialiseMetrics(options);
  26. this.haEnabled = options.isClustered() && options.isHAEnabled();
  27. +
  28. if (options.isClustered()) {
  29. this.clusterManager = getClusterManager(options);
  30. this.clusterManager.setVertx(this);
  31. @@ -202,6 +203,16 @@ public class VertxImpl implements VertxInternal, MetricsProvider {
  32. }
  33. }
  34.  
  35. + @Override
  36. + public int getInstanceCount(String deploymentId) {
  37. + Deployment deployment = deploymentManager.getDeployment(deploymentId);
  38. + if (deployment != null) {
  39. + return deployment.deploymentOptions().getInstances();
  40. + }
  41. +
  42. + return -1;
  43. + }
  44. +
  45. /**
  46. * @return The FileSystem implementation for the OS
  47. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement