diff --git a/hibernate-core/src/main/java/org/hibernate/type/internal/TypeConfigurationRegistry.java b/hibernate-core/src/main/java/org/hibernate/type/internal/TypeConfigurationRegistry.java deleted file mode 100644 index 7d8e039aed..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/type/internal/TypeConfigurationRegistry.java +++ /dev/null @@ -1,60 +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 - */ -package org.hibernate.type.internal; - -import java.util.concurrent.ConcurrentHashMap; - -import org.hibernate.type.spi.TypeConfiguration; - -import org.jboss.logging.Logger; - -/** - * A Registry of TypeConfiguration references based on the - * TypeConfiguration's UUID. - * - * @author Steve Ebersole - */ -public class TypeConfigurationRegistry { - private static final Logger LOG = Logger.getLogger( TypeConfigurationRegistry.class ); - - /** - * Singleton access - */ - public static final TypeConfigurationRegistry INSTANCE = new TypeConfigurationRegistry(); - - private TypeConfigurationRegistry() { - } - - private ConcurrentHashMap configurationMap; - - public void registerTypeConfiguration(TypeConfiguration typeConfiguration) { - if ( configurationMap == null ) { - configurationMap = new ConcurrentHashMap<>(); - } - configurationMap.put( typeConfiguration.getUuid(), typeConfiguration ); - } - - public TypeConfiguration findTypeConfiguration(String uuid) { - if ( configurationMap == null ) { - return null; - } - - return configurationMap.get( uuid ); - } - - public void deregisterTypeConfiguration(TypeConfiguration typeConfiguration) { - final TypeConfiguration existing = configurationMap.remove( typeConfiguration.getUuid() ); - if ( existing != typeConfiguration ) { - LOG.debugf( - "Different TypeConfiguration [%s] passed to #deregisterTypeConfiguration than previously registered [%s] under that UUID [%s]", - typeConfiguration, - existing, - typeConfiguration.getUuid() - ); - } - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java index b73199b8cc..b9f9444e62 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java @@ -37,7 +37,6 @@ import org.hibernate.type.TypeFactory; import org.hibernate.type.TypeResolver; import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry; import org.hibernate.type.descriptor.sql.spi.SqlTypeDescriptorRegistry; -import org.hibernate.type.internal.TypeConfigurationRegistry; import static org.hibernate.internal.CoreLogging.messageLogger; @@ -88,8 +87,6 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { this.basicTypeRegistry = new BasicTypeRegistry(); this.typeFactory = new TypeFactory( this ); this.typeResolver = new TypeResolver( this, typeFactory ); - - TypeConfigurationRegistry.INSTANCE.registerTypeConfiguration( this ); } public String getUuid() { @@ -210,8 +207,6 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { public void sessionFactoryClosed(SessionFactory factory) { log.tracef( "Handling #sessionFactoryClosed from [%s] for TypeConfiguration", factory ); - TypeConfigurationRegistry.INSTANCE.deregisterTypeConfiguration( this ); - scope.unsetSessionFactory( factory ); // todo (6.0) : finish this @@ -374,12 +369,4 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { } } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Custom serialization hook - - private Object readResolve() throws InvalidObjectException { - log.trace( "Resolving serialized TypeConfiguration - readResolve" ); - return TypeConfigurationRegistry.INSTANCE.findTypeConfiguration( getUuid() ); - } }