From 90ff5e712a448f363c493865331704ab2551810b Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 30 Nov 2024 17:26:48 +0100 Subject: [PATCH] HHH-18902 completely remove Proxool it has not been updated in 20 years! --- documentation/documentation.gradle | 12 - .../asciidoc/quickstart/guides/obtaining.adoc | 1 - .../chapters/jdbc/Database_Access.adoc | 45 +-- etc/hibernate.properties | 17 -- etc/hibernate.properties.template | 17 -- .../java/org/hibernate/cfg/JdbcSettings.java | 2 +- .../org/hibernate/cfg/ProxoolSettings.java | 40 --- .../internal/ConnectionProviderInitiator.java | 9 - hibernate-platform/hibernate-platform.gradle | 2 - hibernate-proxool/hibernate-proxool.gradle | 28 -- .../internal/ProxoolConnectionProvider.java | 271 ------------------ .../internal/ProxoolMessageLogger.java | 72 ----- .../StrategyRegistrationProviderImpl.java | 37 --- .../proxool/internal/package-info.java | 11 - ...stry.selector.StrategyRegistrationProvider | 13 - .../OSGI-INF/blueprint/blueprint.xml | 16 -- .../ProxoolConnectionProviderTest.java | 66 ----- ...ProxoolTransactionIsolationConfigTest.java | 57 ---- .../src/test/resources/hibernate.properties | 24 -- .../src/test/resources/log4j2.properties | 19 -- .../src/test/resources/pool-one.properties | 13 - .../src/test/resources/pool-two.properties | 13 - settings.gradle | 3 - 23 files changed, 7 insertions(+), 781 deletions(-) delete mode 100644 hibernate-core/src/main/java/org/hibernate/cfg/ProxoolSettings.java delete mode 100644 hibernate-proxool/hibernate-proxool.gradle delete mode 100644 hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java delete mode 100644 hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java delete mode 100644 hibernate-proxool/src/main/java/org/hibernate/proxool/internal/StrategyRegistrationProviderImpl.java delete mode 100644 hibernate-proxool/src/main/java/org/hibernate/proxool/internal/package-info.java delete mode 100644 hibernate-proxool/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.StrategyRegistrationProvider delete mode 100644 hibernate-proxool/src/main/resources/OSGI-INF/blueprint/blueprint.xml delete mode 100644 hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolConnectionProviderTest.java delete mode 100644 hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java delete mode 100644 hibernate-proxool/src/test/resources/hibernate.properties delete mode 100644 hibernate-proxool/src/test/resources/log4j2.properties delete mode 100644 hibernate-proxool/src/test/resources/pool-one.properties delete mode 100644 hibernate-proxool/src/test/resources/pool-two.properties diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 54b07c1567..473a3bcbf5 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -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" diff --git a/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc b/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc index f7d8ba1c22..2d376b82b9 100644 --- a/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc +++ b/documentation/src/main/asciidoc/quickstart/guides/obtaining.adoc @@ -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 diff --git a/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc b/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc index b8fafb17eb..1057f66391 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/jdbc/Database_Access.adoc @@ -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 -> <> 3. else if any setting prefixed by `hibernate.c3p0.` is set -> <> -4. else if any setting prefixed by `hibernate.proxool.` is set -> <> -5. else if any setting prefixed by `hibernate.hikari.` is set -> <> -6. else if any setting prefixed by `hibernate.vibur.` is set -> <> -7. else if any setting prefixed by `hibernate.agroal.` is set -> <> -8. else if any setting prefixed by `hibernate.oracleucp.` is set -> <> -9. else if `hibernate.connection.url` is set -> <> -10. else -> <> +4. else if any setting prefixed by `hibernate.hikari.` is set -> <> +5. else if any setting prefixed by `hibernate.vibur.` is set -> <> +6. else if any setting prefixed by `hibernate.agroal.` is set -> <> +7. else if any setting prefixed by `hibernate.oracleucp.` is set -> <> +8. else if `hibernate.connection.url` is set -> <> +9. else -> <> [[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-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 diff --git a/etc/hibernate.properties b/etc/hibernate.properties index fcee8489cd..aa427fdec1 100644 --- a/etc/hibernate.properties +++ b/etc/hibernate.properties @@ -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 diff --git a/etc/hibernate.properties.template b/etc/hibernate.properties.template index b583a72c0d..f42b7fd11f 100644 --- a/etc/hibernate.properties.template +++ b/etc/hibernate.properties.template @@ -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 diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/JdbcSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/JdbcSettings.java index 65b453a95f..2fdb4f27ac 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/JdbcSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/JdbcSettings.java @@ -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. diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ProxoolSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/ProxoolSettings.java deleted file mode 100644 index 90b51eb6a7..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ProxoolSettings.java +++ /dev/null @@ -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"; -} diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/ConnectionProviderInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/ConnectionProviderInitiator.java index bc49ef6147..d76e089deb 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/ConnectionProviderInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/ConnectionProviderInitiator.java @@ -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. - */ - -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.(Enhancer.java:96) - jvmArgs( ['--add-opens', 'java.base/java.lang=ALL-UNNAMED'] ) -} \ No newline at end of file diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java deleted file mode 100644 index d065190730..0000000000 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolConnectionProvider.java +++ /dev/null @@ -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 unwrap(Class 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 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(); - } -} diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java deleted file mode 100644 index 07054861d5..0000000000 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/ProxoolMessageLogger.java +++ /dev/null @@ -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. - *

- * 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); - -} diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/StrategyRegistrationProviderImpl.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/StrategyRegistrationProviderImpl.java deleted file mode 100644 index 150d7c32e7..0000000000 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/StrategyRegistrationProviderImpl.java +++ /dev/null @@ -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 getStrategyRegistrations() { - return Collections.singletonList( - new SimpleStrategyRegistrationImpl( - ConnectionProvider.class, - ProxoolConnectionProvider.class, - "proxool", - ProxoolConnectionProvider.class.getSimpleName(), - // legacy - "org.hibernate.connection.ProxoolConnectionProvider", - // legacy - "org.hibernate.service.jdbc.connections.internal.ProxoolConnectionProvider" - ) ); - } -} diff --git a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/package-info.java b/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/package-info.java deleted file mode 100644 index e59a1ea325..0000000000 --- a/hibernate-proxool/src/main/java/org/hibernate/proxool/internal/package-info.java +++ /dev/null @@ -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 . - */ - -/** - * Implementation of ConnectionProvider using the proxool Connection pool. - */ -package org.hibernate.proxool.internal; diff --git a/hibernate-proxool/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.StrategyRegistrationProvider b/hibernate-proxool/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.StrategyRegistrationProvider deleted file mode 100644 index e752debfb8..0000000000 --- a/hibernate-proxool/src/main/resources/META-INF/services/org.hibernate.boot.registry.selector.StrategyRegistrationProvider +++ /dev/null @@ -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 . -# -# -# 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 . -# -org.hibernate.proxool.internal.StrategyRegistrationProviderImpl diff --git a/hibernate-proxool/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/hibernate-proxool/src/main/resources/OSGI-INF/blueprint/blueprint.xml deleted file mode 100644 index 6dd16f5951..0000000000 --- a/hibernate-proxool/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - diff --git a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolConnectionProviderTest.java b/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolConnectionProviderTest.java deleted file mode 100644 index ed240906b9..0000000000 --- a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolConnectionProviderTest.java +++ /dev/null @@ -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 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(); - - } -} diff --git a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java b/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java deleted file mode 100644 index 318498642d..0000000000 --- a/hibernate-proxool/src/test/java/org/hibernate/test/proxool/ProxoolTransactionIsolationConfigTest.java +++ /dev/null @@ -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 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 ); - } -} diff --git a/hibernate-proxool/src/test/resources/hibernate.properties b/hibernate-proxool/src/test/resources/hibernate.properties deleted file mode 100644 index b297114d5f..0000000000 --- a/hibernate-proxool/src/test/resources/hibernate.properties +++ /dev/null @@ -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 . -# -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 diff --git a/hibernate-proxool/src/test/resources/log4j2.properties b/hibernate-proxool/src/test/resources/log4j2.properties deleted file mode 100644 index d4da0b21a5..0000000000 --- a/hibernate-proxool/src/test/resources/log4j2.properties +++ /dev/null @@ -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 . -# -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 diff --git a/hibernate-proxool/src/test/resources/pool-one.properties b/hibernate-proxool/src/test/resources/pool-one.properties deleted file mode 100644 index e496ca4e61..0000000000 --- a/hibernate-proxool/src/test/resources/pool-one.properties +++ /dev/null @@ -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 . -# -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 \ No newline at end of file diff --git a/hibernate-proxool/src/test/resources/pool-two.properties b/hibernate-proxool/src/test/resources/pool-two.properties deleted file mode 100644 index 1246107910..0000000000 --- a/hibernate-proxool/src/test/resources/pool-two.properties +++ /dev/null @@ -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 . -# -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 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index f323fa8888..2c893b9496 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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'