Examples of VertxInternal


Examples of io.vertx.core.impl.VertxInternal

    return vertxRef.get();
  }


  protected void checkDeploymentExists(int pos, String verticleName, DeploymentOptions options) {
    VertxInternal vi = (VertxInternal)vertices[pos];
    for (String deploymentID: vi.deployments()) {
      Deployment dep = vi.getDeployment(deploymentID);
      if (verticleName.equals(dep.verticleIdentifier()) && options.equals(dep.deploymentOptions())) {
        return;
      }
    }
    fail("Can't find deployment for verticleName: " + verticleName + " on node " + pos);
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

    }
    fail("Can't find deployment for verticleName: " + verticleName + " on node " + pos);
  }

  protected void kill(int pos) {
    VertxInternal v = (VertxInternal)vertices[pos];
    v.executeBlocking(() -> {
      v.simulateKill();
      return null;
    }, ar -> {
      assertTrue(ar.succeeded());
    });
  }
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

    }
  }

  protected void takeDeploymentSnapshots() {
    for (int i = 0; i < vertices.length; i++) {
      VertxInternal v = (VertxInternal)vertices[i];
      if (!v.isKilled()) {
        deploymentSnapshots[i] = takeDeploymentSnapshot(i);
      }
    }
  }
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

    }
  }

  protected Set<Deployment> takeDeploymentSnapshot(int pos) {
    Set<Deployment> snapshot = new ConcurrentHashSet<>();
    VertxInternal v = (VertxInternal)vertices[pos];
    for (String depID: v.deployments()) {
      snapshot.add(v.getDeployment(depID));
    }
    return snapshot;
  }
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

  }

  protected void kill(int pos) {
    // Save the deployments first
    takeDeploymentSnapshots();
    VertxInternal v = (VertxInternal)vertices[pos];
    killedNode = pos;
    v.executeBlocking(() -> {
      v.simulateKill();
      return null;
    }, ar -> {
      assertTrue(ar.succeeded());
    });
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

  }

  protected void checkDeployments() {
    int totalDeployed = 0;
    for (int i = 0; i < vertices.length; i++) {
      VertxInternal v = (VertxInternal)vertices[i];
      if (!v.isKilled()) {
        totalDeployed += checkHasDeployments(i, i);
      }
    }
    assertEquals(totDeployed, totalDeployed);
  }
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

    await();
  }

  @Test
  public void testCacheDirDeletedOnVertxClose() {
    VertxInternal vertx2 = (VertxInternal)Vertx.vertx();
    File file = vertx2.resolveFile(fileName1);
    assertTrue(file.exists());
    File cacheDir = file.getParentFile().getParentFile();
    assertTrue(cacheDir.exists());
    vertx2.close(onSuccess(v -> {
      assertFalse(cacheDir.exists());
      testComplete();
    }));
    await();
  }
View Full Code Here

Examples of io.vertx.core.impl.VertxInternal

  // Make sure connection times out correctly on no pong
  @Test
  public void testConnectionTimesOutNoPong() throws Exception {
    // Set an unreasonably quick reply time so it's bound to timeout
    startNodes(2, new VertxOptions().setClusterPingInterval(1).setClusterPingReplyInterval(1));
    VertxInternal vertxI = (VertxInternal)vertices[0];
    vertxI.simulateEventBusUnresponsive();
    AtomicBoolean sending = new AtomicBoolean();
    MessageConsumer<String> consumer = vertices[0].eventBus().<String>consumer("foobar").handler(msg -> {
      if (!sending.get()) {
        sending.set(true);
        vertx.setTimer(2000, id -> {
View Full Code Here

Examples of org.vertx.java.core.impl.VertxInternal

   *
   * @param vertx The current Vert.x instance.
   * @return The Vert.x Hazelcast instance if Vert.x is clustered.
   */
  static HazelcastInstance getHazelcastInstance(Vertx vertx) {
    VertxInternal vertxInternal = (VertxInternal) vertx;
    ClusterManager clusterManager = vertxInternal.clusterManager();
    if (clusterManager != null) {
      Class<?> clazz = clusterManager.getClass();
      Field field;
      try {
        field = clazz.getDeclaredField("hazelcast");
View Full Code Here

Examples of org.vertx.java.core.impl.VertxInternal

    }

    protected void register(Vertx vertx, Container container, MetricRegistry registry) {

        if (vertx instanceof VertxInternal) {
            VertxInternal vertxInternal = (VertxInternal) vertx;
            int count = 0;

            for (EventExecutor ee : vertxInternal.getEventLoopGroup()) {
                if (ee instanceof SingleThreadEventExecutor) {
                    final SingleThreadEventExecutor executor = (SingleThreadEventExecutor) ee;
                    try {
                        registry.register(
                                name(Utils.DEFAULT_METRIC_PREFIX, this.getClass().getSimpleName(), "executor-" + count++, "pendingTasks"),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.