@@ -0,0 +1,1391 @@
+package com.zaxxer.hikari.pool;%0A%0Aimport com.zaxxer.hikari.HikariConfig;%0Aimport org.junit.Test;%0A%0Aimport com.zaxxer.hikari.HikariDataSource;%0Aimport java.sql.Connection;%0Aimport java.sql.PreparedStatement;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.concurrent.Callable;%0Aimport java.util.concurrent.ExecutorService;%0Aimport java.util.concurrent.Executors;%0Aimport java.util.concurrent.Future;%0A%0A/**%0A * @author Matthew Tambara (matthew.tambara@liferay.com)%0A */%0Apublic class ConcurrentCloseConnectionTest%0A%7B%0A   @Test%0A   public void testConcurrentClose() throws Exception%0A   %7B%0A%09  HikariConfig config = new HikariConfig();%0A      config.setDataSourceClassName(%22com.zaxxer.hikari.mocks.StubDataSource%22);%0A%0A%09  try (HikariDataSource ds = new HikariDataSource(config);%0A%09      final Connection connection = ds.getConnection()) %7B%0A%0A%09%09  ExecutorService executorService = Executors.newFixedThreadPool(10);%0A%0A%09%09  List%3CFuture%3E futures = new ArrayList%3C%3E();%0A%0A%09%09  for (int i = 0; i %3C 500; i++) %7B%0A%09%09%09  final PreparedStatement preparedStatement =%0A%09%09%09%09  connection.prepareStatement(%22%22);%0A%0A%09%09%09  futures.add(executorService.submit(new Callable%3CVoid%3E() %7B%0A%0A%09%09%09%09  @Override%0A%09%09%09%09  public Void call() throws Exception %7B%0A%09%09%09%09%09  preparedStatement.close();%0A%0A%09%09%09%09%09  return null;%0A%09%09%09%09  %7D%0A%0A%09%09%09  %7D));%0A%09%09  %7D%0A%0A%09%09  executorService.shutdown();%0A%0A%09%09  for (Future future : futures) %7B%0A%09%09%09  future.get();%0A%09%09  %7D%0A%09  %7D%0A   %7D%0A%7D%0A

Add test to demonstrate concurrency problem