Пример #1
0
  @Override
  public void close() {
    for (R2Store store : this.rawStoreList) {
      store.close();
    }
    // shutdown the transportclient in the case when no r2store is created
    if (this.transportClient != null) {
      final FutureCallback<None> clientShutdownCallback = new FutureCallback<None>();
      this.transportClient.shutdown(clientShutdownCallback);
      try {
        clientShutdownCallback.get();
      } catch (InterruptedException e) {
        logger.error("Interrupted while shutting down the TransportClient: " + e.getMessage(), e);
      } catch (ExecutionException e) {
        logger.error(
            "Execution exception occurred while shutting down the TransportClient: "
                + e.getMessage(),
            e);
      }
    }

    final FutureCallback<None> factoryShutdownCallback = new FutureCallback<None>();
    this._clientFactory.shutdown(factoryShutdownCallback);
    try {
      factoryShutdownCallback.get();
    } catch (InterruptedException e) {
      logger.error("Interrupted while shutting down the HttpClientFactory: " + e.getMessage(), e);
    } catch (ExecutionException e) {
      logger.error(
          "Execution exception occurred while shutting down the HttpClientFactory: "
              + e.getMessage(),
          e);
    }
  }