private ListenableFuture<?> resizeUpInternal(int delta) {
    // 1) Cancel the kills if any, to avoid killing the returned sessions.
    //    Also sets the count for the async initialization.
    int oldVal;
    do {
      oldVal = deltaRemaining.get();
    } while (!deltaRemaining.compareAndSet(oldVal, oldVal + delta));
    int toStart = oldVal + delta;
    if (toStart <= 0) return createDummyFuture();
    LOG.info("Resizing the pool; adding {} sessions", toStart);

    return createSessions(toStart);
  }
Resizes the pool asynchronously.
@param delta A number of threads to add or remove.
@param toClose An output list to which newly-unneeded sessions, to be closed by the caller.
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionPool.java