HHH-18902 completely remove Proxool

it has not been updated in 20 years!
This commit is contained in:
Gavin King 2024-11-30 17:26:48 +01:00
parent 724212bd5d
commit 90ff5e712a
23 changed files with 7 additions and 781 deletions

View File

@ -52,7 +52,6 @@ configurations {
agroal
c3p0
hikaricp
proxool
vibur
jcache
@ -72,7 +71,6 @@ configurations {
extendsFrom agroal
extendsFrom c3p0
extendsFrom hikaricp
extendsFrom proxool
extendsFrom vibur
extendsFrom jcache
extendsFrom jpamodelgen
@ -133,7 +131,6 @@ dependencies {
reportAggregation project(':hibernate-hikaricp')
reportAggregation project(':hibernate-jcache')
reportAggregation project(':hibernate-micrometer')
reportAggregation project(':hibernate-proxool')
reportAggregation project(':hibernate-spatial')
reportAggregation project(':hibernate-vibur')
reportAggregation project(':hibernate-ant')
@ -163,9 +160,6 @@ dependencies {
hikaricp project( ':hibernate-hikaricp' )
javadocSources project( path: ':hibernate-hikaricp', configuration: 'javadocSources' )
proxool project( ':hibernate-proxool' )
javadocSources project( path: ':hibernate-proxool', configuration: 'javadocSources' )
vibur project( ':hibernate-vibur' )
javadocSources project( path: ':hibernate-vibur', configuration: 'javadocSources' )
@ -565,12 +559,6 @@ settingsDocumentation {
description = "Settings related to integrating with the C3P0 Connection pool"
settingsClassName "org.hibernate.cfg.C3p0Settings"
}
proxool {
explicitPosition = 5
summary = "Proxool Connection Pool Settings"
description = "Settings related to integrating with the Proxool Connection pool"
settingsClassName "org.hibernate.cfg.ProxoolSettings"
}
transaction {
explicitPosition = 6
summary = "Transaction Environment Settings"

View File

@ -53,7 +53,6 @@ transitive dependencies based on the features being used or not.
|hibernate-c3p0| Support for https://www.mchange.com/projects/c3p0/[C3P0] connection pooling
|hibernate-hikaricp| Support for https://github.com/brettwooldridge/HikariCP/[HikariCP] connection pooling
|hibernate-vibur| Support for https://www.vibur.org/[Vibur DBCP] connection pooling
|hibernate-proxool| Support for https://proxool.sourceforge.net/[Proxool] connection pooling
|hibernate-ucp| Support for https://docs.oracle.com/en/database/oracle/oracle-database/23/jjucp/intro.html[Universal Connection Pool] connection pooling
|hibernate-jcache| Integration with https://jcp.org/en/jsr/detail?id=107$$[JCache], allowing any compliant implementation as a second-level cache provider
|hibernate-graalvm| Experimental extension to make it easier to compile applications as a https://www.graalvm.org/[GraalVM] native image

View File

@ -16,13 +16,12 @@ Hibernate will internally determine which `ConnectionProvider` to use based on t
1. If `hibernate.connection.provider_class` is set, it takes precedence
2. else if `hibernate.connection.datasource` is set -> <<database-connectionprovider-datasource>>
3. else if any setting prefixed by `hibernate.c3p0.` is set -> <<database-connectionprovider-c3p0>>
4. else if any setting prefixed by `hibernate.proxool.` is set -> <<database-connectionprovider-proxool>>
5. else if any setting prefixed by `hibernate.hikari.` is set -> <<database-connectionprovider-hikari>>
6. else if any setting prefixed by `hibernate.vibur.` is set -> <<database-connectionprovider-vibur>>
7. else if any setting prefixed by `hibernate.agroal.` is set -> <<database-connectionprovider-agroal>>
8. else if any setting prefixed by `hibernate.oracleucp.` is set -> <<database-connectionprovider-ucp>>
9. else if `hibernate.connection.url` is set -> <<database-connectionprovider-drivermanager>>
10. else -> <<database-connectionprovider-provided>>
4. else if any setting prefixed by `hibernate.hikari.` is set -> <<database-connectionprovider-hikari>>
5. else if any setting prefixed by `hibernate.vibur.` is set -> <<database-connectionprovider-vibur>>
6. else if any setting prefixed by `hibernate.agroal.` is set -> <<database-connectionprovider-agroal>>
7. else if any setting prefixed by `hibernate.oracleucp.` is set -> <<database-connectionprovider-ucp>>
8. else if `hibernate.connection.url` is set -> <<database-connectionprovider-drivermanager>>
9. else -> <<database-connectionprovider-provided>>
[[database-connectionprovider-datasource]]
=== Using DataSources
@ -72,38 +71,6 @@ Transaction isolation of the Connections is managed by the `ConnectionProvider`
Any other settings prefixed with `hibernate.c3p0.`:: Will have the `hibernate.` portion stripped and be passed to c3p0.
Any other settings prefixed with `c3p0.`:: Get passed to c3p0 as is. See https://www.mchange.com/projects/c3p0/#configuration[c3p0 configuration]
[[database-connectionprovider-proxool]]
=== Using Proxool
[IMPORTANT]
====
To use the Proxool integration, the application must include the `hibernate-proxool` module jar (as well as its dependencies) on the classpath.
====
Hibernate also provides support for applications to use https://proxool.sourceforge.net/[Proxool] connection pooling.
Transaction isolation of the Connections is managed by the `ConnectionProvider` itself. See <<database-connectionprovider-isolation>>.
[[database-connectionprovider-proxool-existing]]
==== Using existing Proxool pools
Controlled by the `hibernate.proxool.existing_pool` setting.
If set to true, this ConnectionProvider will use an already existing Proxool pool by alias as indicated by the `hibernate.proxool.pool_alias` setting.
[[database-connectionprovider-proxool-jaxp]]
==== Configuring Proxool via XML
The `hibernate.proxool.xml` setting names a Proxool configuration XML file to be loaded as a classpath resource and loaded by Proxool's JAXPConfigurator.
See https://proxool.sourceforge.net/configure.html[proxool configuration].
`hibernate.proxool.pool_alias` must be set to indicate which pool to use.
[[database-connectionprovider-proxool-properties]]
==== Configuring Proxool via Properties
The `hibernate.proxool.properties` setting names a Proxool configuration properties file to be loaded as a classpath resource and loaded by Proxool's `PropertyConfigurator`.
See https://proxool.sourceforge.net/configure.html[proxool configuration].
`hibernate.proxool.pool_alias` must be set to indicate which pool to use.
[[database-connectionprovider-hikari]]
=== Using HikariCP

View File

@ -217,22 +217,6 @@ hibernate.connection.pool_size 1
##############################
### Proxool Connection Pool###
##############################
## Properties for external configuration of Proxool
hibernate.proxool.pool_alias pool1
## Only need one of the following
#hibernate.proxool.existing_pool true
#hibernate.proxool.xml proxool.xml
#hibernate.proxool.properties proxool.properties
#################################
### Plugin ConnectionProvider ###
#################################
@ -242,7 +226,6 @@ hibernate.proxool.pool_alias pool1
#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider

View File

@ -191,22 +191,6 @@ hibernate.connection.pool_size 1
##############################
### Proxool Connection Pool###
##############################
## Properties for external configuration of Proxool
hibernate.proxool.pool_alias pool1
## Only need one of the following
#hibernate.proxool.existing_pool true
#hibernate.proxool.xml proxool.xml
#hibernate.proxool.properties proxool.properties
#################################
### Plugin ConnectionProvider ###
#################################
@ -217,7 +201,6 @@ hibernate.proxool.pool_alias pool1
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider

View File

@ -19,7 +19,7 @@ import org.hibernate.sql.ast.spi.ParameterMarkerStrategy;
*
* @author Steve Ebersole
*/
public interface JdbcSettings extends C3p0Settings, ProxoolSettings, AgroalSettings, HikariCPSettings {
public interface JdbcSettings extends C3p0Settings, AgroalSettings, HikariCPSettings {
/**
* Specifies a JTA {@link javax.sql.DataSource} to use for Connections.

View File

@ -1,40 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.cfg;
/**
* @author Steve Ebersole
*/
public interface ProxoolSettings {
/**
* A setting prefix used to indicate settings that target the hibernate-proxool integration
*/
String PROXOOL_CONFIG_PREFIX = "hibernate.proxool";
/**
* Proxool property to configure the Proxool provider using an XML ({@code /path/to/file.xml})
*/
String PROXOOL_XML = "hibernate.proxool.xml";
/**
* Proxool property to configure the Proxool provider using a properties file
* ({@code /path/to/proxool.properties})
*/
String PROXOOL_PROPERTIES = "hibernate.proxool.properties";
/**
* Proxool property to configure the Proxool Provider from an already existing pool
* ({@code true} / {@code false})
*/
String PROXOOL_EXISTING_POOL = "hibernate.proxool.existing_pool";
/**
* Proxool property with the Proxool pool alias to use
* (Required for {@link #PROXOOL_EXISTING_POOL}, {@link #PROXOOL_PROPERTIES}, or
* {@link #PROXOOL_XML})
*/
String PROXOOL_POOL_ALIAS = "hibernate.proxool.pool_alias";
}

View File

@ -41,7 +41,6 @@ import static org.hibernate.cfg.JdbcSettings.ISOLATION;
import static org.hibernate.cfg.JdbcSettings.POOL_SIZE;
import static org.hibernate.cfg.JdbcSettings.URL;
import static org.hibernate.cfg.JdbcSettings.USER;
import static org.hibernate.cfg.ProxoolSettings.PROXOOL_CONFIG_PREFIX;
import static org.hibernate.cfg.SchemaToolingSettings.ENABLE_SYNONYMS;
import static org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.isMultiTenancyEnabled;
import static org.hibernate.internal.util.StringHelper.nullIfEmpty;
@ -66,11 +65,6 @@ public class ConnectionProviderInitiator implements StandardServiceInitiator<Con
*/
public static final String C3P0_STRATEGY = "c3p0";
/**
* The strategy for proxool connection pooling
*/
public static final String PROXOOL_STRATEGY = "proxool";
/**
* The strategy for hikari connection pooling
*/
@ -162,9 +156,6 @@ public class ConnectionProviderInitiator implements StandardServiceInitiator<Con
else if ( hasConfiguration( configurationValues, C3P0_CONFIG_PREFIX ) ) {
return instantiateProvider( strategySelector, C3P0_STRATEGY );
}
else if (hasConfiguration( configurationValues, PROXOOL_CONFIG_PREFIX )) {
return instantiateProvider( strategySelector, PROXOOL_STRATEGY );
}
else if ( hasConfiguration( configurationValues, HIKARI_CONFIG_PREFIX ) ) {
return instantiateProvider( strategySelector, HIKARI_STRATEGY );
}

View File

@ -23,7 +23,6 @@ dependencies {
api project( ":hibernate-agroal" )
api project( ":hibernate-c3p0" )
api project( ":hibernate-hikaricp" )
api project( ":hibernate-proxool" )
api project( ":hibernate-vibur" )
api project( ":hibernate-jcache" )
@ -59,7 +58,6 @@ dependencies {
runtime libs.agroalPool
runtime libs.c3p0
runtime libs.hikaricp
runtime libs.proxool
runtime libs.vibur
runtime libs.jcache

View File

@ -1,28 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
description = 'Integration for Proxool Connection pooling into Hibernate O/RM'
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )
dependencies {
implementation project( ':hibernate-core' )
implementation libs.proxool
testImplementation project( ':hibernate-testing' )
}
test {
// Proxool needs this to define classes for some reason. Stack trace:
// at org.logicalcobwebs.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:372)
// at org.logicalcobwebs.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:193)
// at org.logicalcobwebs.cglib.core.KeyFactory$Generator.create(KeyFactory.java:177)
// at org.logicalcobwebs.cglib.core.KeyFactory.create(KeyFactory.java:149)
// at org.logicalcobwebs.cglib.proxy.Enhancer.<clinit>(Enhancer.java:96)
jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] )
}

View File

@ -1,271 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.proxool.internal;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
import java.util.Properties;
import org.hibernate.HibernateException;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.cfg.JdbcSettings;
import org.hibernate.cfg.ProxoolSettings;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator;
import org.hibernate.engine.jdbc.connections.internal.DatabaseConnectionInfoImpl;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.DatabaseConnectionInfo;
import org.hibernate.internal.log.ConnectionInfoLogger;
import org.hibernate.service.UnknownUnwrapTypeException;
import org.hibernate.service.spi.Configurable;
import org.hibernate.service.spi.ServiceRegistryAwareService;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.Stoppable;
import org.logicalcobwebs.proxool.ConnectionPoolDefinitionIF;
import org.logicalcobwebs.proxool.ProxoolException;
import org.logicalcobwebs.proxool.ProxoolFacade;
import org.logicalcobwebs.proxool.configuration.JAXPConfigurator;
import org.logicalcobwebs.proxool.configuration.PropertyConfigurator;
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
import static org.hibernate.internal.util.config.ConfigurationHelper.getBoolean;
import static org.hibernate.proxool.internal.ProxoolMessageLogger.PROXOOL_MESSAGE_LOGGER;
/**
* A connection provider that uses a Proxool connection pool. Hibernate will use this by
* default if the {@code hibernate.proxool.*} properties are set.
*
* @see ConnectionProvider
*/
public class ProxoolConnectionProvider
implements ConnectionProvider, Configurable, Stoppable, ServiceRegistryAwareService {
private static final String PROXOOL_JDBC_STEM = "proxool.";
private String proxoolPoolAlias;
private String proxoolAlias;
// TRUE if the pool is borrowed from the outside, FALSE if we used to create it
private boolean existingPool;
// Not null if the Isolation level has been specified in the configuration file.
// Otherwise, it is left to the Driver's default value.
private Integer isolation;
private boolean autocommit;
private ClassLoaderService classLoaderService;
@Override
public Connection getConnection() throws SQLException {
// get a connection from the pool (through DriverManager, cfr. Proxool doc)
final Connection connection = DriverManager.getConnection( proxoolAlias );
// set the Transaction Isolation if defined
if ( isolation != null ) {
connection.setTransactionIsolation( isolation );
}
// toggle autoCommit to false if set
if ( connection.getAutoCommit() != autocommit ) {
connection.setAutoCommit( autocommit );
}
// return the connection
return connection;
}
@Override
public boolean isUnwrappableAs(Class<?> unwrapType) {
return ConnectionProvider.class.equals( unwrapType )
|| ProxoolConnectionProvider.class.isAssignableFrom( unwrapType );
}
@Override
@SuppressWarnings("unchecked")
public <T> T unwrap(Class<T> unwrapType) {
if ( ConnectionProvider.class.equals( unwrapType )
|| ProxoolConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
return (T) this;
}
else {
throw new UnknownUnwrapTypeException( unwrapType );
}
}
@Override
public void closeConnection(Connection connection) throws SQLException {
connection.close();
}
@Override
public void injectServices(ServiceRegistryImplementor serviceRegistry) {
classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
}
@Override
public void configure(Map<String, Object> props) {
ConnectionInfoLogger.INSTANCE.configureConnectionPool( "Proxool" );
// Get the configurator files (if available)
final String jaxpFile = (String) props.get( ProxoolSettings.PROXOOL_XML );
final String propFile = (String) props.get( ProxoolSettings.PROXOOL_PROPERTIES );
final String externalConfig = (String) props.get( ProxoolSettings.PROXOOL_EXISTING_POOL );
// Default the Proxool alias setting
proxoolAlias = proxoolPoolAlias = (String) props.get( ProxoolSettings.PROXOOL_POOL_ALIAS );
// Configured outside of Hibernate (i.e. Servlet container, or Java Bean Container
// already has Proxool pools running, and this provider is to just borrow one of these
if ( "true".equals( externalConfig ) ) {
// Validate that an alias name was provided to determine which pool to use
if ( !isNotEmpty( proxoolAlias ) ) {
final String msg = "Cannot configure Proxool Provider to use an existing in memory pool without the " +
ProxoolSettings.PROXOOL_POOL_ALIAS + " property set.";
throw new HibernateException( msg );
}
// Append the stem to the proxool pool alias
proxoolAlias = PROXOOL_JDBC_STEM + proxoolAlias;
// Set the existing pool flag to true
existingPool = true;
PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingExistingPool( proxoolAlias );
// Configured using the JAXP Configurator
}
else if ( isNotEmpty( jaxpFile ) ) {
PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingJaxpConfigurator( jaxpFile );
// Validate that an alias name was provided to determine which pool to use
if ( !isNotEmpty( proxoolAlias ) ) {
final String msg = "Cannot configure Proxool Provider to use JAXP without the " + ProxoolSettings.PROXOOL_POOL_ALIAS + " property set.";
throw new HibernateException( msg );
}
try {
JAXPConfigurator.configure( getConfigStreamReader( jaxpFile ), false );
}
catch (ProxoolException e) {
final String msg = "Proxool Provider unable to load JAXP configurator file: " + jaxpFile;
throw new HibernateException( msg, e );
}
// Append the stem to the proxool pool alias
proxoolAlias = PROXOOL_JDBC_STEM + proxoolAlias;
PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderToUsePoolAlias( proxoolAlias );
// Configured using the Properties File Configurator
}
else if ( isNotEmpty( propFile ) ) {
PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderUsingPropertiesFile( propFile );
// Validate that an alias name was provided to determine which pool to use
if ( !isNotEmpty( proxoolAlias ) ) {
final String msg = "Cannot configure Proxool Provider to use Properties File without the " + ProxoolSettings.PROXOOL_POOL_ALIAS + " property set.";
throw new HibernateException( msg );
}
try {
PropertyConfigurator.configure( getConfigProperties( propFile ) );
}
catch (ProxoolException e) {
final String msg = "Proxool Provider unable to load Property configurator file: " + propFile;
throw new HibernateException( msg, e );
}
// Append the stem to the proxool pool alias
proxoolAlias = PROXOOL_JDBC_STEM + proxoolAlias;
PROXOOL_MESSAGE_LOGGER.configuringProxoolProviderToUsePoolAlias( proxoolAlias );
}
// Remember Isolation level
isolation = ConnectionProviderInitiator.extractIsolation( props );
autocommit = getBoolean( JdbcSettings.AUTOCOMMIT, props );
}
private Reader getConfigStreamReader(String resource) {
return new InputStreamReader( classLoaderService.locateResourceStream( resource ) );
}
private Properties getConfigProperties(String resource) {
try {
Properties properties = new Properties();
properties.load( classLoaderService.locateResourceStream( resource ) );
return properties;
}
catch (IOException e) {
throw new HibernateException( "Unable to load properties from specified config file: " + resource, e );
}
}
@Override
public boolean supportsAggressiveRelease() {
return false;
}
@Override
public void stop() {
// If the provider was leeching off an existing pool don't close it
if ( existingPool ) {
return;
}
// We have created the pool ourselves, so shut it down
ConnectionInfoLogger.INSTANCE.cleaningUpConnectionPool( "proxool" );
try {
if ( ProxoolFacade.getAliases().length == 1 ) {
ProxoolFacade.shutdown( 0 );
}
else {
ProxoolFacade.removeConnectionPool( proxoolAlias.substring( PROXOOL_JDBC_STEM.length() ) );
}
}
catch (Exception e) {
// If you're closing down the ConnectionProvider chances are an
// is not a real big deal, just warn
ConnectionInfoLogger.INSTANCE.unableToDestroyConnectionPool( e );
}
}
@Override
public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect) {
try {
final ConnectionPoolDefinitionIF cpd = ProxoolFacade.getConnectionPoolDefinition( proxoolPoolAlias );
return new DatabaseConnectionInfoImpl(
cpd.getUrl(),
cpd.getDriver(),
dialect.getVersion(),
ConnectionProviderInitiator.toIsolationNiceName( isolation ),
Boolean.toString( autocommit ),
cpd.getMinimumConnectionCount(),
cpd.getMaximumConnectionCount()
);
}
catch (ProxoolException e) {
PROXOOL_MESSAGE_LOGGER.warn( "Error while obtaining the database pool information", e );
return new DatabaseConnectionInfoImpl( dialect );
}
}
/**
* Release all resources held by this provider.
*
* @throws HibernateException Indicates a problem closing the underlying pool or releasing resources
*
* @deprecated Use {@link #stop} instead
*/
@Deprecated
public void close() throws HibernateException {
stop();
}
}

View File

@ -1,72 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.proxool.internal;
import org.hibernate.internal.log.ConnectionInfoLogger;
import org.hibernate.internal.log.SubSystemLogging;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.jboss.logging.annotations.ValidIdRange;
import java.lang.invoke.MethodHandles;
import static org.jboss.logging.Logger.Level.DEBUG;
/**
* The jboss-logging {@link MessageLogger} for the hibernate-proxool module. It reserves message ids ranging from
* 30001 to 35000 inclusively.
* <p>
* New messages must be added after the last message defined to ensure message codes are unique.
*/
@MessageLogger(projectCode = "HHH")
@ValidIdRange( min = 30001, max = 35000 )
@SubSystemLogging(
name = ProxoolMessageLogger.LOGGER_NAME,
description = "Logs details related to Proxool connection pooling"
)
public interface ProxoolMessageLogger extends ConnectionInfoLogger {
String LOGGER_NAME = ConnectionInfoLogger.LOGGER_NAME + ".proxool";
ProxoolMessageLogger PROXOOL_MESSAGE_LOGGER = Logger.getMessageLogger( MethodHandles.lookup(), ProxoolMessageLogger.class, LOGGER_NAME );
/**
* Logs the name of a named pool to be used for configuration information
*
* @param proxoolAlias The name (alias) of the proxool pool
*/
@LogMessage(level = DEBUG)
@Message(value = "Configuring Proxool to use pool alias: %s", id = 30002)
void configuringProxoolProviderToUsePoolAlias(String proxoolAlias);
/**
* Logs the name of a named existing pool in memory to be used
*
* @param proxoolAlias The name (alias) of the proxool pool
*/
@LogMessage(level = DEBUG)
@Message(value = "Configuring Proxool using existing pool in memory: %s", id = 30003)
void configuringProxoolProviderUsingExistingPool(String proxoolAlias);
/**
* Logs a message that the proxool pool will be built using its JAXP (XML) configuration mechanism
*
* @param jaxpFile The XML configuration file to use
*/
@LogMessage(level = DEBUG)
@Message(value = "Configuring Proxool using JAXPConfigurator: %s", id = 30004)
void configuringProxoolProviderUsingJaxpConfigurator(String jaxpFile);
/**
* Logs a message that the proxool pool will be built using a properties file
*
* @param propFile The properties file to use
*/
@LogMessage(level = DEBUG)
@Message(value = "Configuring Proxool using properties file: %s", id = 30005)
void configuringProxoolProviderUsingPropertiesFile(String propFile);
}

View File

@ -1,37 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.proxool.internal;
import java.util.Collections;
import org.hibernate.boot.registry.selector.SimpleStrategyRegistrationImpl;
import org.hibernate.boot.registry.selector.StrategyRegistration;
import org.hibernate.boot.registry.selector.StrategyRegistrationProvider;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
/**
* Provides the {@link ProxoolConnectionProvider} to the
* {@link org.hibernate.boot.registry.selector.spi.StrategySelector} service.
*
* @author Brett Meyer
*/
public final class StrategyRegistrationProviderImpl implements StrategyRegistrationProvider {
@Override
@SuppressWarnings("unchecked")
public Iterable<StrategyRegistration> getStrategyRegistrations() {
return Collections.singletonList(
new SimpleStrategyRegistrationImpl<ConnectionProvider>(
ConnectionProvider.class,
ProxoolConnectionProvider.class,
"proxool",
ProxoolConnectionProvider.class.getSimpleName(),
// legacy
"org.hibernate.connection.ProxoolConnectionProvider",
// legacy
"org.hibernate.service.jdbc.connections.internal.ProxoolConnectionProvider"
) );
}
}

View File

@ -1,11 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
/**
* Implementation of ConnectionProvider using the proxool Connection pool.
*/
package org.hibernate.proxool.internal;

View File

@ -1,13 +0,0 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
org.hibernate.proxool.internal.StrategyRegistrationProviderImpl

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate, Relational Persistence for Idiomatic Java
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later.
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
-->
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>
<bean id="strategyRegistrationProvider" class="org.hibernate.proxool.internal.StrategyRegistrationProviderImpl"/>
<service ref="strategyRegistrationProvider" interface="org.hibernate.boot.registry.selector.StrategyRegistrationProvider"/>
</blueprint>

View File

@ -1,66 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.test.proxool;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.logicalcobwebs.proxool.ProxoolFacade;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Environment;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.proxool.internal.ProxoolConnectionProvider;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* Test to verify connection pools are closed, and that only the managed one is closed.
*
* @author Sanne Grinovero
*/
public class ProxoolConnectionProviderTest extends BaseUnitTestCase {
@Test
public void testPoolsClosed() {
assertDefinedPools(); // zero-length-vararg used as parameter
StandardServiceRegistry serviceRegistry = buildServiceRegistry( "pool-one" );
ConnectionProvider providerOne = serviceRegistry.getService( ConnectionProvider.class );
assertDefinedPools( "pool-one" );
StandardServiceRegistry serviceRegistryTwo = buildServiceRegistry( "pool-two" );
ConnectionProvider providerTwo = serviceRegistryTwo.getService( ConnectionProvider.class );
assertDefinedPools( "pool-one", "pool-two" );
StandardServiceRegistryBuilder.destroy( serviceRegistry );
assertDefinedPools( "pool-two" );
StandardServiceRegistryBuilder.destroy( serviceRegistryTwo );
assertDefinedPools();
}
private void assertDefinedPools(String... expectedPoolNames) {
List<String> aliases = Arrays.asList( ProxoolFacade.getAliases() );
assertEquals( expectedPoolNames.length, aliases.size() );
for (String poolName : expectedPoolNames) {
assertTrue( "pool named " + poolName + " missing", aliases.contains( poolName ) );
}
}
private StandardServiceRegistry buildServiceRegistry(String poolName){
return new StandardServiceRegistryBuilder( )
.applySetting( Environment.PROXOOL_POOL_ALIAS, poolName )
.applySetting( Environment.PROXOOL_PROPERTIES, poolName + ".properties" )
.applySetting( Environment.CONNECTION_PROVIDER, ProxoolConnectionProvider.class.getName() )
.build();
}
}

View File

@ -1,57 +0,0 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.test.proxool;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.TiDBDialect;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.proxool.internal.ProxoolConnectionProvider;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.common.connections.BaseTransactionIsolationConfigTest;
import org.junit.Before;
/**
* @author Steve Ebersole
*/
@SkipForDialect(value = TiDBDialect.class, comment = "Doesn't support SERIALIZABLE isolation")
public class ProxoolTransactionIsolationConfigTest extends BaseTransactionIsolationConfigTest {
private Map<String,Object> properties;
private StandardServiceRegistry ssr;
@Before
public void setUp() {
String poolName = "pool-one";
properties = new HashMap<>();
properties.put( AvailableSettings.PROXOOL_POOL_ALIAS, poolName );
properties.put( AvailableSettings.PROXOOL_PROPERTIES, poolName + ".properties" );
ssr = new StandardServiceRegistryBuilder()
.applySettings( properties )
.build();
}
@Override
protected ConnectionProvider getConnectionProviderUnderTest() {
ProxoolConnectionProvider provider = new ProxoolConnectionProvider();
provider.injectServices( (ServiceRegistryImplementor) ssr );
return provider;
}
@Override
protected void augmentConfigurationSettings(Properties properties) {
super.augmentConfigurationSettings( properties );
properties.putAll( this.properties );
}
}

View File

@ -1,24 +0,0 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
hibernate.dialect @db.dialect@
hibernate.connection.driver_class @jdbc.driver@
hibernate.connection.url @jdbc.url@
hibernate.connection.username @jdbc.user@
hibernate.connection.password @jdbc.pass@
hibernate.connection.init_sql @connection.init_sql@
hibernate.connection.pool_size 1
hibernate.jdbc.batch_size 10
hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
hibernate.proxool.properties pool-one.properties
hibernate.show_sql false
hibernate.max_fetch_depth 5
hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory

View File

@ -1,19 +0,0 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
appender.stdout.type=Console
appender.stdout.name=STDOUT
appender.stdout.layout.type=PatternLayout
appender.stdout.layout.pattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
logger.hbm2ddl.name=org.hibernate.tool.hbm2ddl
logger.hbm2ddl.level=debug
logger.testing-cache.name=org.hibernate.testing.cache
logger.testing-cache.level=debug

View File

@ -1,13 +0,0 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
jdbc-0.proxool.alias=pool-one
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
jdbc-0.proxool.driver-class=org.h2.Driver
jdbc-0.user=sa
jdbc-0.password=
jdbc-0.proxool.maximum-connection-count=2
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE

View File

@ -1,13 +0,0 @@
#
# Hibernate, Relational Persistence for Idiomatic Java
#
# License: GNU Lesser General Public License (LGPL), version 2.1 or later.
# See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
#
jdbc-0.proxool.alias=pool-two
jdbc-0.proxool.driver-url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
jdbc-0.proxool.driver-class=org.h2.Driver
jdbc-0.user=sa
jdbc-0.password=
jdbc-0.proxool.maximum-connection-count=2
jdbc-0.proxool.house-keeping-test-sql=select CURRENT_DATE

View File

@ -87,7 +87,6 @@ dependencyResolutionManagement {
def agroalVersion = version "agroal", "2.5"
def c3poVersion = version "c3p0", "0.10.1"
def hikaricpVersion = version "hikaricp", "6.2.1"
def proxoolVersion = version "proxool", "0.8.3"
def viburVersion = version "vibur", "25.0"
def ucpVersion = version "ucp", "23.6.0.24.10"
@ -121,7 +120,6 @@ dependencyResolutionManagement {
library( "agroalPool", "io.agroal", "agroal-pool" ).versionRef( agroalVersion )
library( "c3p0", "com.mchange", "c3p0" ).versionRef( c3poVersion )
library( "hikaricp", "com.zaxxer", "HikariCP" ).versionRef( hikaricpVersion )
library( "proxool", "proxool", "proxool" ).versionRef( proxoolVersion )
library( "vibur", "org.vibur", "vibur-dbcp" ).versionRef( viburVersion )
library( "ucp", "com.oracle.database.jdbc", "ucp11" ).versionRef( ucpVersion )
@ -323,7 +321,6 @@ include 'hibernate-community-dialects'
include 'hibernate-vector'
include 'hibernate-c3p0'
include 'hibernate-proxool'
include 'hibernate-hikaricp'
include 'hibernate-vibur'
include 'hibernate-agroal'