HHH-11356 - Adjust the 2nd-Cache SPIs to better reflect supported uses

HHH-12323 - Update Statistics API and SPI based on changes to 2nd level caching changes
HHH-12416 - set up relocation for hibernate-ehcache
HHH-12417 - default strategy based on registrations with StrategySelector

test failure
This commit is contained in:
Steve Ebersole 2018-03-22 23:25:08 -05:00
parent 7f12e2a161
commit 1ae38f27a7
2 changed files with 17 additions and 57 deletions

View File

@ -82,31 +82,32 @@ public class RegionFactoryInitiator implements StandardServiceInitiator<RegionFa
final StrategySelector selector = registry.getService( StrategySelector.class );
final Collection<Class<? extends RegionFactory>> implementors = selector.getRegisteredStrategyImplementors( RegionFactory.class );
if ( ( useSecondLevelCache != null && useSecondLevelCache == TRUE )
|| ( useQueryCache != null && useQueryCache == TRUE ) ) {
// if either are explicitly defined and one is TRUE, we need a RegionFactory
if ( setting == null && implementors.size() != 1 ) {
if ( setting == null && implementors.size() != 1 ) {
// if either are explicitly defined as TRUE we need a RegionFactory
if ( ( useSecondLevelCache != null && useSecondLevelCache == TRUE )
|| ( useQueryCache != null && useQueryCache == TRUE ) ) {
throw new CacheException( "Caching was explicitly requested, but no RegionFactory was defined and there is not a single registered RegionFactory" );
}
final RegionFactory regionFactory = registry.getService( StrategySelector.class ).resolveStrategy(
RegionFactory.class,
setting,
(RegionFactory) null,
new StrategyCreatorRegionFactoryImpl( p )
);
}
if ( regionFactory != null ) {
return regionFactory;
}
final RegionFactory regionFactory = registry.getService( StrategySelector.class ).resolveStrategy(
RegionFactory.class,
setting,
(RegionFactory) null,
new StrategyCreatorRegionFactoryImpl( p )
);
if ( regionFactory != null ) {
return regionFactory;
}
if ( implementors.size() == 1 ) {
final RegionFactory regionFactory = selector.resolveStrategy( RegionFactory.class, implementors.iterator().next() );
configurationValues.put( AvailableSettings.CACHE_REGION_FACTORY, regionFactory );
final RegionFactory registeredFactory = selector.resolveStrategy( RegionFactory.class, implementors.iterator().next() );
configurationValues.put( AvailableSettings.CACHE_REGION_FACTORY, registeredFactory );
configurationValues.put( AvailableSettings.USE_SECOND_LEVEL_CACHE, "true" );
return regionFactory;
return registeredFactory;
}
else {
LOG.debugf(

View File

@ -1,41 +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.testing.mocks.url;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* @author Steve Ebersole
*/
public class MockHttpURLConnection extends HttpURLConnection {
protected MockHttpURLConnection(URL url) {
super( url );
}
@Override
public InputStream getInputStream() throws IOException {
throw new UnsupportedOperationException( "not yet implemented" );
}
@Override
public void connect() throws IOException {
}
@Override
public void disconnect() {
}
@Override
public boolean usingProxy() {
return false;
}
}