HHH-15656 use privileged action when invoking ScheduledExecutorService.shutdown
Signed-off-by: Scott Marlow <smarlow@redhat.com>
This commit is contained in:
parent
8f2325ed4a
commit
a40fea29c0
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine.jdbc.connections.internal;
|
package org.hibernate.engine.jdbc.connections.internal;
|
||||||
|
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.Driver;
|
import java.sql.Driver;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
|
@ -28,6 +30,7 @@ import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.dialect.Database;
|
import org.hibernate.dialect.Database;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||||
|
import org.hibernate.internal.util.securitymanager.SystemSecurityManager;
|
||||||
import org.hibernate.service.UnknownUnwrapTypeException;
|
import org.hibernate.service.UnknownUnwrapTypeException;
|
||||||
import org.hibernate.service.spi.Configurable;
|
import org.hibernate.service.spi.Configurable;
|
||||||
import org.hibernate.service.spi.ServiceException;
|
import org.hibernate.service.spi.ServiceException;
|
||||||
|
@ -605,7 +608,22 @@ public class DriverManagerConnectionProviderImpl
|
||||||
CONNECTIONS_MESSAGE_LOGGER.cleaningUpConnectionPool( pool.getUrl() );
|
CONNECTIONS_MESSAGE_LOGGER.cleaningUpConnectionPool( pool.getUrl() );
|
||||||
active = false;
|
active = false;
|
||||||
if ( executorService != null ) {
|
if ( executorService != null ) {
|
||||||
executorService.shutdown();
|
PrivilegedAction delegateToPrivilegedAction =
|
||||||
|
new PrivilegedAction() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object run() {
|
||||||
|
executorService.shutdown();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if ( SystemSecurityManager.isSecurityManagerEnabled() ) {
|
||||||
|
AccessController.doPrivileged(
|
||||||
|
delegateToPrivilegedAction );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
delegateToPrivilegedAction.run();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
executorService = null;
|
executorService = null;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue