synchronized CompletableFuture<Void> close() {
            // this method is exposed publicly in both blocking and non-blocking forms.
            if (closeFuture.get() != null)
                return closeFuture.get();

            final List<CompletableFuture<Void>> clientCloseFutures = new ArrayList<>(openedClients.size());
            for (WeakReference<Client> openedClient : openedClients) {
                final Client client = openedClient.get();
                if (client != null) {
                    // best to call close() even if the Client is already closing so that we can be sure that
                    // any background client closing operations are included in this shutdown future
                    clientCloseFutures.add(client.closeAsync());
                }
            }

            // when all the clients are fully closed then shutdown the netty event loop. not sure why this needs to
            // block here, but if it doesn't then factory.shutdown() below doesn't seem to want to ever complete.
            // ideally, this should all be async, but i guess it wasn't before this change so just going to leave it
            // for now as this really isn't the focus on this change
            CompletableFuture.allOf(clientCloseFutures.toArray(new CompletableFuture[0])).join();

            final CompletableFuture<Void> closeIt = new CompletableFuture<>();
            // shutdown the event loop. that shutdown can trigger some final jobs to get scheduled so add a listener
            // to the termination event to shutdown remaining thread pools
            factory.shutdown().awaitUninterruptibly().addListener(f -> {
                executor.shutdown();
                hostScheduler.shutdown();
                connectionScheduler.shutdown();
                closeIt.complete(null);
            });

            closeFuture.set(closeIt);

            return closeIt;
        }
Thread pool for background work related to the {@link Connection} and {@link ConnectionPool}.
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java