HHH-8407 Missing synchronization in DriverManagerConnectionProviderImpl#stop
This commit is contained in:
parent
59d2bff81b
commit
4f1c8a4ba6
|
@ -67,6 +67,7 @@ public class DriverManagerConnectionProviderImpl
|
|||
private int poolSize;
|
||||
private boolean autocommit;
|
||||
|
||||
//Access guarded by synchronization on the pool instance
|
||||
private final ArrayList<Connection> pool = new ArrayList<Connection>();
|
||||
private final AtomicInteger checkedOut = new AtomicInteger();
|
||||
|
||||
|
@ -166,15 +167,17 @@ public class DriverManagerConnectionProviderImpl
|
|||
public void stop() {
|
||||
LOG.cleaningUpConnectionPool( url );
|
||||
|
||||
for ( Connection connection : pool ) {
|
||||
try {
|
||||
connection.close();
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
LOG.unableToClosePooledConnection( sqle );
|
||||
synchronized ( pool ) {
|
||||
for ( Connection connection : pool ) {
|
||||
try {
|
||||
connection.close();
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
LOG.unableToClosePooledConnection( sqle );
|
||||
}
|
||||
}
|
||||
pool.clear();
|
||||
}
|
||||
pool.clear();
|
||||
stopped = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue