Example #1
0
 void replace(final Connection connection) {
   connections.remove(connection);
   connection.closeAsync();
   session
       .blockingExecutor()
       .submit(
           new Runnable() {
             @Override
             public void run() {
               addConnectionIfUnderMaximum();
             }
           });
 }
Example #2
0
  private List<CloseFuture> discardAvailableConnections() {

    List<CloseFuture> futures = new ArrayList<CloseFuture>(connections.size());
    for (Connection connection : connections) {
      CloseFuture future = connection.closeAsync();
      future.addListener(
          new Runnable() {
            public void run() {
              open.decrementAndGet();
            }
          },
          MoreExecutors.sameThreadExecutor());
      futures.add(future);
    }
    return futures;
  }
Example #3
0
 private void close(final Connection connection) {
   connection.closeAsync();
 }