@Override public CloseFuture closeAsync() { CloseFuture future = closeFuture.get(); if (future != null) return future; isClosing = true; cluster.manager.removeSession(this); List<CloseFuture> futures = new ArrayList<CloseFuture>(pools.size()); for (HostConnectionPool pool : pools.values()) futures.add(pool.closeAsync()); future = new CloseFuture.Forwarding(futures); return closeFuture.compareAndSet(null, future) ? future : closeFuture.get(); // We raced, it's ok, return the future that was actually set }
@Override public CloseFuture closeAsync() { CloseFuture future = closeFuture.get(); if (future != null) return future; isClosing = true; cluster.manager.removeSession(this); List<CloseFuture> futures = new ArrayList<CloseFuture>(pools.size()); for (HostConnectionPool pool : pools.values()) futures.add(pool.closeAsync()); future = new CloseFuture.Forwarding(futures); return closeFuture.compareAndSet(null, future) ? future : closeFuture.get(); // We raced, it's ok, return the future that was actually set }
@Override public CloseFuture closeAsync() { CloseFuture future = closeFuture.get(); if (future != null) return future; isClosing = true; cluster.manager.removeSession(this); List<CloseFuture> futures = new ArrayList<CloseFuture>(pools.size()); for (HostConnectionPool pool : pools.values()) futures.add(pool.closeAsync()); future = new CloseFuture.Forwarding(futures); return closeFuture.compareAndSet(null, future) ? future : closeFuture.get(); // We raced, it's ok, return the future that was actually set }
@Override public CloseFuture closeAsync() { CloseFuture future = closeFuture.get(); if (future != null) return future; isClosing = true; cluster.manager.removeSession(this); List<CloseFuture> futures = new ArrayList<CloseFuture>(pools.size()); for (HostConnectionPool pool : pools.values()) futures.add(pool.closeAsync()); future = new CloseFuture.Forwarding(futures); return closeFuture.compareAndSet(null, future) ? future : closeFuture.get(); // We raced, it's ok, return the future that was actually set }