コード例 #1
0
  /**
   * Closes all opened connections.
   *
   * @param waitCompletion If {@code true} waits for all pending requests to be proceeded.
   */
  @SuppressWarnings("TooBroadScope")
  @Override
  public void stop(boolean waitCompletion) {
    Collection<GridClientConnection> closeConns;

    if (closed) return;

    // Mark manager as closed.
    closed = true;

    // Remove all connections from cache.
    closeConns = new ArrayList<>(conns.values());

    conns.clear();

    nodeConns.clear();

    // Close old connection outside the writer lock.
    for (GridClientConnection conn : closeConns) conn.close(CLIENT_CLOSED, waitCompletion);

    if (pingExecutor != null)
      GridClientUtils.shutdownNow(GridClientConnectionManager.class, pingExecutor, log);

    GridClientUtils.shutdownNow(GridClientConnectionManager.class, executor, log);

    if (srv != null) srv.stop();
  }
コード例 #2
0
  /**
   * Stops the server.
   *
   * @throws IgniteCheckedException
   */
  public void stop() throws IgniteCheckedException {
    // Stop TCP server.
    if (nioSrvr != null) nioSrvr.stop();

    U.cancel(shmemAcceptWorker);
    U.join(shmemAcceptWorker, log);

    U.cancel(shmemWorkers);
    U.join(shmemWorkers, log);

    shmemWorkers.clear();

    // Force closing on stop (safety).
    for (HadoopCommunicationClient client : clients.values()) client.forceClose();

    // Clear resources.
    nioSrvr = null;

    boundTcpPort = -1;
  }