public synchronized void close()

in adb3client/src/main/java/com/alibaba/cloud/analyticdb/adb3client/impl/ExecutionPool.java [237:279]


	public synchronized void close() {
		if (started.compareAndSet(true, false)) {
			closeStack = new Tuple<>(LocalDateTime.now().toString(),
				new AdbClientException(ExceptionCode.ALREADY_CLOSE, "close caused by"));
			if (clientMap.size() > 0) {
				LOGGER.warn("AdbClient ExecutionPool[{}] close, current client size {}", name, clientMap.size());
			} else {
				LOGGER.info("AdbClient ExecutionPool[{}] close", name);
			}
			if (shutdownHandler != null) {
				try {
					Runtime.getRuntime().removeShutdownHook(shutdownHandler);
				} catch (Exception e) {
					LOGGER.warn("", e);
				}
			}
			try {
				backgroundExecutorService.shutdownNow();
				while (!backgroundExecutorService.awaitTermination(500L, TimeUnit.MILLISECONDS)) {
					LOGGER.info("wait background executorService termination[{}]", name);
				}
				backgroundExecutorService = null;
			} catch (InterruptedException ignore) {
			}
			workerStated.set(false);
			try {
				workerExecutorService.shutdown();
				while (!workerExecutorService.awaitTermination(500L, TimeUnit.MILLISECONDS)) {
					LOGGER.info("wait worker executorService termination[{}]", name);
				}
				workerExecutorService = null;
				backgroundExecutorService = null;
			} catch (InterruptedException ignore) {
			}
			this.writeSemaphore = null;
			this.readSemaphore = null;
			this.dataSource.close();

			synchronized (POOL_MAP) {
				POOL_MAP.remove(name);
			}
		}
	}