HHH-9840 Checkstyle fixes
This commit is contained in:
parent
cffe71aeba
commit
e5f4b616d4
|
@ -21,6 +21,8 @@ import org.hibernate.type.Type;
|
|||
*
|
||||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated In optimized implementations, wrapping the id is not necessary.
|
||||
*/
|
||||
@Deprecated
|
||||
final class OldCacheKeyImplementation implements Serializable {
|
||||
|
@ -55,7 +57,7 @@ final class OldCacheKeyImplementation implements Serializable {
|
|||
}
|
||||
|
||||
private int calculateHashCode(Type type, SessionFactoryImplementor factory) {
|
||||
int result = type.getHashCode(id, factory );
|
||||
int result = type.getHashCode( id, factory );
|
||||
result = 31 * result + (tenantId != null ? tenantId.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
@ -78,7 +80,7 @@ final class OldCacheKeyImplementation implements Serializable {
|
|||
}
|
||||
final OldCacheKeyImplementation that = (OldCacheKeyImplementation) other;
|
||||
return EqualsHelper.equals( entityOrRoleName, that.entityOrRoleName )
|
||||
&& type.isEqual(id, that.id)
|
||||
&& type.isEqual( id, that.id)
|
||||
&& EqualsHelper.equals( tenantId, that.tenantId );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.hibernate.type.Type;
|
|||
*
|
||||
* @author Eric Dalquist
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated Cache implementation should provide optimized key.
|
||||
*/
|
||||
@Deprecated
|
||||
public class OldNaturalIdCacheKey implements Serializable {
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
|||
public interface EntityRegionAccessStrategy extends RegionAccessStrategy {
|
||||
|
||||
/**
|
||||
* To create instances of EntityCacheKey for this region, Hibernate will invoke this method
|
||||
* To create instances of keys for this region, Hibernate will invoke this method
|
||||
* exclusively so that generated implementations can generate optimised keys.
|
||||
* @param id the primary identifier of the entity
|
||||
* @param persister the persister for the type for which a key is being generated
|
||||
|
|
|
@ -292,9 +292,7 @@ public class CollectionLoadContext {
|
|||
if ( debugEnabled ) {
|
||||
LOG.debug( "Refusing to add to cache due to enabled filters" );
|
||||
}
|
||||
// todo : add the notion of enabled filters to the CacheKey to differentiate filtered collections from non-filtered;
|
||||
// but CacheKey is currently used for both collections and entities; would ideally need to define two seperate ones;
|
||||
// currently this works in conjuction with the check on
|
||||
// todo : add the notion of enabled filters to the cache key to differentiate filtered collections from non-filtered;
|
||||
// DefaultInitializeCollectionEventHandler.initializeCollectionFromCache() (which makes sure to not read from
|
||||
// cache with enabled filters).
|
||||
// EARLY EXIT!!!!!
|
||||
|
|
|
@ -29,8 +29,8 @@ public class ConcurrentSecondLevelCacheStatisticsImpl extends CategorizedStatist
|
|||
private AtomicLong putCount = new AtomicLong();
|
||||
|
||||
ConcurrentSecondLevelCacheStatisticsImpl(Region region,
|
||||
EntityRegionAccessStrategy entityRegionAccessStrategy,
|
||||
CollectionRegionAccessStrategy collectionRegionAccessStrategy) {
|
||||
EntityRegionAccessStrategy entityRegionAccessStrategy,
|
||||
CollectionRegionAccessStrategy collectionRegionAccessStrategy) {
|
||||
super( region.getName() );
|
||||
this.region = region;
|
||||
this.entityRegionAccessStrategy = entityRegionAccessStrategy;
|
||||
|
@ -63,34 +63,36 @@ public class ConcurrentSecondLevelCacheStatisticsImpl extends CategorizedStatist
|
|||
|
||||
public Map getEntries() {
|
||||
Map map = new HashMap();
|
||||
for (Object o : region.toMap().entrySet()) {
|
||||
for ( Object o : region.toMap().entrySet() ) {
|
||||
Map.Entry me = (Map.Entry) o;
|
||||
Object id;
|
||||
if (entityRegionAccessStrategy != null) {
|
||||
id = entityRegionAccessStrategy.getCacheKeyId(me.getKey());
|
||||
} else if (collectionRegionAccessStrategy != null) {
|
||||
id = collectionRegionAccessStrategy.getCacheKeyId(me.getKey());
|
||||
} else {
|
||||
if ( entityRegionAccessStrategy != null ) {
|
||||
id = entityRegionAccessStrategy.getCacheKeyId( me.getKey() );
|
||||
}
|
||||
else if ( collectionRegionAccessStrategy != null ) {
|
||||
id = collectionRegionAccessStrategy.getCacheKeyId( me.getKey() );
|
||||
}
|
||||
else {
|
||||
id = me.getKey();
|
||||
}
|
||||
map.put(id, me.getValue());
|
||||
map.put( id, me.getValue() );
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder()
|
||||
.append("SecondLevelCacheStatistics")
|
||||
.append("[hitCount=").append(this.hitCount)
|
||||
.append(",missCount=").append(this.missCount)
|
||||
.append(",putCount=").append(this.putCount);
|
||||
.append( "SecondLevelCacheStatistics" )
|
||||
.append( "[hitCount=").append( this.hitCount )
|
||||
.append( ",missCount=").append( this.missCount )
|
||||
.append( ",putCount=").append( this.putCount );
|
||||
//not sure if this would ever be null but wanted to be careful
|
||||
if (region != null) {
|
||||
buf.append(",elementCountInMemory=").append(this.getElementCountInMemory())
|
||||
.append(",elementCountOnDisk=").append(this.getElementCountOnDisk())
|
||||
.append(",sizeInMemory=").append(this.getSizeInMemory());
|
||||
if ( region != null ) {
|
||||
buf.append( ",elementCountInMemory=" ).append( this.getElementCountInMemory() )
|
||||
.append( ",elementCountOnDisk=" ).append( this.getElementCountOnDisk() )
|
||||
.append( ",sizeInMemory=" ).append( this.getSizeInMemory() );
|
||||
}
|
||||
buf.append(']');
|
||||
buf.append( ']' );
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,6 @@ public class NonStrictReadWriteEhcacheCollectionRegionAccessStrategy
|
|||
|
||||
@Override
|
||||
public Object getCacheKeyId(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getCollectionId(cacheKey);
|
||||
return DefaultCacheKeysFactory.getCollectionId( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,6 @@ public class NonStrictReadWriteEhcacheEntityRegionAccessStrategy
|
|||
|
||||
@Override
|
||||
public Object getCacheKeyId(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getEntityId(cacheKey);
|
||||
return DefaultCacheKeysFactory.getEntityId( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,13 +120,13 @@ public class NonStrictReadWriteEhcacheNaturalIdRegionAccessStrategy
|
|||
region().remove( key );
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public Object generateCacheKey(Object[] naturalIdValues, EntityPersister persister, SessionImplementor session) {
|
||||
return DefaultCacheKeysFactory.createNaturalIdKey(naturalIdValues, persister, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getNaturalIdValues(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues(cacheKey);
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,6 @@ class BaseNaturalIdRegionAccessStrategy extends BaseRegionAccessStrategy impleme
|
|||
|
||||
@Override
|
||||
public Object[] getNaturalIdValues(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues(cacheKey);
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ class ReadWriteCollectionRegionAccessStrategy extends AbstractReadWriteAccessStr
|
|||
|
||||
@Override
|
||||
public Object getCacheKeyId(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getCollectionId(cacheKey);
|
||||
return DefaultCacheKeysFactory.getCollectionId( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,6 @@ class ReadWriteEntityRegionAccessStrategy extends AbstractReadWriteAccessStrateg
|
|||
|
||||
@Override
|
||||
public Object getCacheKeyId(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getEntityId(cacheKey);
|
||||
return DefaultCacheKeysFactory.getEntityId( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,6 +112,6 @@ class ReadWriteNaturalIdRegionAccessStrategy extends AbstractReadWriteAccessStra
|
|||
|
||||
@Override
|
||||
public Object[] getNaturalIdValues(Object cacheKey) {
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues(cacheKey);
|
||||
return DefaultCacheKeysFactory.getNaturalIdValues( cacheKey );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue