mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 08:05:05 +00:00
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 @@ else if ( serviceRegistry != null ) {
|
||||
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…
x
Reference in New Issue
Block a user