diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
index fc955d77ee..d9a52cf4e4 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/InfinispanRegionFactory.java
@@ -30,6 +30,7 @@ import org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl;
import org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup;
import org.hibernate.cache.infinispan.util.CacheCommandFactory;
import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.internal.DefaultCacheKeysFactory;
import org.hibernate.cache.internal.SimpleCacheKeysFactory;
import org.hibernate.cache.spi.CacheDataDescription;
@@ -51,7 +52,6 @@ import org.infinispan.commons.util.FileLookupFactory;
import org.infinispan.commons.util.Util;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.configuration.cache.ConfigurationBuilder;
-import org.infinispan.configuration.cache.ExpirationConfiguration;
import org.infinispan.configuration.cache.TransactionConfiguration;
import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
import org.infinispan.configuration.parsing.ParserRegistry;
@@ -60,8 +60,6 @@ import org.infinispan.factories.GlobalComponentRegistry;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.transaction.lookup.GenericTransactionManagerLookup;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import javax.transaction.TransactionManager;
@@ -74,7 +72,7 @@ import javax.transaction.TransactionManager;
* @since 3.5
*/
public class InfinispanRegionFactory implements RegionFactory {
- private static final Log log = LogFactory.getLog( InfinispanRegionFactory.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( InfinispanRegionFactory.class );
private static final String PREFIX = "hibernate.cache.infinispan.";
@@ -129,24 +127,26 @@ public class InfinispanRegionFactory implements RegionFactory {
COLLECTION("collection", DEF_ENTITY_RESOURCE, NO_VALIDATION),
IMMUTABLE_ENTITY("immutable-entity", DEF_ENTITY_RESOURCE, NO_VALIDATION),
TIMESTAMPS("timestamps", DEF_TIMESTAMPS_RESOURCE, c -> {
+ if ( c.clustering().cacheMode().isInvalidation() ) {
+ throw log.timestampsMustNotUseInvalidation();
+ }
if (c.eviction().strategy() != EvictionStrategy.NONE) {
- throw new CacheException("Timestamps cache must not use eviction!");
+ throw log.timestampsMustNotUseEviction();
}
}),
QUERY("query", DEF_QUERY_RESOURCE, NO_VALIDATION),
PENDING_PUTS("pending-puts", DEF_PENDING_PUTS_RESOURCE, c -> {
+ if (!c.isTemplate()) {
+ log.pendingPutsShouldBeTemplate();
+ }
if (c.clustering().cacheMode().isClustered()) {
- throw new CacheException("Pending-puts cache must not be clustered!");
+ throw log.pendingPutsMustNotBeClustered();
}
if (c.transaction().transactionMode().isTransactional()) {
- throw new CacheException("Pending-puts cache must not be transactional!");
+ throw log.pendingPutsMustNotBeTransactional();
}
- if (!c.isTemplate()) {
- log.warn("Pending-puts cache configuration should be a template.");
- }
- ExpirationConfiguration expiration = c.expiration();
- if (expiration.maxIdle() <= 0 && expiration.lifespan() <= 0) {
- log.warn("Pending-puts cache should expire old entries");
+ if (c.expiration().maxIdle() <= 0) {
+ throw log.pendingPutsMustHaveMaxIdle();
}
});
@@ -445,7 +445,7 @@ public class InfinispanRegionFactory implements RegionFactory {
throw ce;
}
catch (Throwable t) {
- throw new CacheException( "Unable to start region factory", t );
+ throw log.unableToStart(t);
}
}
@@ -453,7 +453,7 @@ public class InfinispanRegionFactory implements RegionFactory {
/* In WF, the global configuration setting is ignored */
protected EmbeddedCacheManager createCacheManager(Properties properties, ServiceRegistry serviceRegistry) {
if (properties.containsKey(INFINISPAN_USE_SYNCHRONIZATION_PROP)) {
- log.warn("Property '" + INFINISPAN_USE_SYNCHRONIZATION_PROP + "' is deprecated; 2LC with transactional cache must always use synchronizations.");
+ log.propertyUseSynchronizationDeprecated();
}
ConfigurationBuilderHolder cfgHolder;
String configFile = ConfigurationHelper.extractPropertyValue(INFINISPAN_CONFIG_RESOURCE_PROP, properties);
@@ -528,7 +528,7 @@ public class InfinispanRegionFactory implements RegionFactory {
return holder;
}
catch (IOException e) {
- throw new CacheException( "Unable to create default cache manager", e );
+ throw log.unableToCreateCacheManager(e);
}
finally {
Util.close( is );
@@ -617,7 +617,7 @@ public class InfinispanRegionFactory implements RegionFactory {
if (configuration == null) {
log.debugf("Cache configuration not found for %s", type);
if (!cacheName.equals(type.defaultCacheName)) {
- log.warnf("Custom cache configuration '%s' was requested for type %s but it was not found!", cacheName, type);
+ log.customConfigForTypeNotFound(cacheName, type.key);
}
builder = defaultConfiguration.getNamedConfigurationBuilders().get(type.defaultCacheName);
if (builder == null) {
@@ -645,8 +645,7 @@ public class InfinispanRegionFactory implements RegionFactory {
if (templateCacheName != null) {
configuration = manager.getCacheConfiguration(templateCacheName);
if (configuration == null) {
- log.errorf("Region '%s' should use cache '%s' but its configuration is not defined - using configuration by type (%s).",
- regionName, templateCacheName, type.key);
+ log.customConfigForRegionNotFound(templateCacheName, regionName, type.key);
}
else {
log.debugf("Region '%s' will use cache template '%s'", regionName, templateCacheName);
@@ -678,9 +677,6 @@ public class InfinispanRegionFactory implements RegionFactory {
if (globalStats != null) {
builder.jmxStatistics().enabled(globalStats).available(globalStats);
}
- if (manager.getCacheConfiguration(regionName) != null) {
- log.warnf("Cache configuration for region '%s' was already defined! Cache exists? %s", regionName, manager.cacheExists(regionName));
- }
configuration = builder.build();
type.validate(configuration);
manager.defineConfiguration(regionName, configuration);
@@ -705,11 +701,7 @@ public class InfinispanRegionFactory implements RegionFactory {
}
}
- throw new CacheException(
- "Infinispan custom cache command factory not " +
- "installed (possibly because the classloader where Infinispan " +
- "lives couldn't find the Hibernate Infinispan cache provider)"
- );
+ throw log.cannotInstallCommandFactory();
}
protected AdvancedCache createCacheWrapper(AdvancedCache cache) {
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
index 019db319bd..53b0ae9ad7 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/JndiInfinispanRegionFactory.java
@@ -12,13 +12,12 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.hibernate.cache.CacheException;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.internal.util.jndi.JndiHelper;
import org.hibernate.service.ServiceRegistry;
import org.infinispan.manager.EmbeddedCacheManager;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
/**
* A {@link org.hibernate.cache.spi.RegionFactory} for Infinispan-backed cache
@@ -29,7 +28,7 @@ import org.infinispan.util.logging.LogFactory;
*/
public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
- private static final Log log = LogFactory.getLog( JndiInfinispanRegionFactory.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( JndiInfinispanRegionFactory.class );
/**
* Specifies the JNDI name under which the {@link EmbeddedCacheManager} to use is bound.
@@ -61,7 +60,7 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
ServiceRegistry serviceRegistry) throws CacheException {
final String name = ConfigurationHelper.getString( CACHE_MANAGER_RESOURCE_PROP, properties, null );
if ( name == null ) {
- throw new CacheException( "Configuration property " + CACHE_MANAGER_RESOURCE_PROP + " not set" );
+ throw log.propertyCacheManagerResourceNotSet();
}
return locateCacheManager( name, JndiHelper.extractJndiProperties( properties ) );
}
@@ -73,9 +72,7 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
return (EmbeddedCacheManager) ctx.lookup( jndiNamespace );
}
catch (NamingException ne) {
- final String msg = "Unable to retrieve CacheManager from JNDI [" + jndiNamespace + "]";
- log.info( msg, ne );
- throw new CacheException( msg );
+ throw log.unableToRetrieveCmFromJndi(jndiNamespace);
}
finally {
if ( ctx != null ) {
@@ -83,7 +80,7 @@ public class JndiInfinispanRegionFactory extends InfinispanRegionFactory {
ctx.close();
}
catch (NamingException ne) {
- log.info( "Unable to release initial context", ne );
+ log.unableToReleaseContext(ne);
}
}
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/FutureUpdateSynchronization.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/FutureUpdateSynchronization.java
index 2e1db9b5cf..1089350fb5 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/FutureUpdateSynchronization.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/FutureUpdateSynchronization.java
@@ -7,11 +7,10 @@
package org.hibernate.cache.infinispan.access;
import org.hibernate.cache.infinispan.util.FutureUpdate;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.infinispan.util.InvocationAfterCompletion;
import org.hibernate.resource.transaction.TransactionCoordinator;
import org.infinispan.AdvancedCache;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.UUID;
@@ -19,7 +18,7 @@ import java.util.UUID;
* @author Radim Vansa <rvansa@redhat.com>
*/
public class FutureUpdateSynchronization extends InvocationAfterCompletion {
- private static final Log log = LogFactory.getLog( FutureUpdateSynchronization.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( FutureUpdateSynchronization.class );
private final UUID uuid = UUID.randomUUID();
private final Object key;
@@ -45,7 +44,7 @@ public class FutureUpdateSynchronization extends InvocationAfterCompletion {
return;
}
catch (Exception e) {
- log.error("Failure updating cache in afterCompletion, will retry", e);
+ log.failureInAfterCompletion(e);
}
}
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/InvalidationCacheAccessDelegate.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/InvalidationCacheAccessDelegate.java
index 93480e2b5e..ad85ba814e 100755
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/InvalidationCacheAccessDelegate.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/InvalidationCacheAccessDelegate.java
@@ -9,10 +9,9 @@ package org.hibernate.cache.infinispan.access;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.impl.BaseRegion;
import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.engine.spi.SessionImplementor;
import org.infinispan.AdvancedCache;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
/**
*
@@ -21,7 +20,7 @@ import org.infinispan.util.logging.LogFactory;
* @since 3.5
*/
public abstract class InvalidationCacheAccessDelegate implements AccessDelegate {
- protected static final Log log = LogFactory.getLog( InvalidationCacheAccessDelegate.class );
+ protected static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( InvalidationCacheAccessDelegate.class );
protected static final boolean TRACE_ENABLED = log.isTraceEnabled();
protected final AdvancedCache cache;
protected final BaseRegion region;
@@ -124,9 +123,7 @@ public abstract class InvalidationCacheAccessDelegate implements AccessDelegate
@Override
public void remove(SessionImplementor session, Object key) throws CacheException {
if ( !putValidator.beginInvalidatingKey(session, key)) {
- throw new CacheException(
- "Failed to invalidate pending putFromLoad calls for key " + key + " from region " + region.getName()
- );
+ throw log.failedInvalidatePendingPut(key, region.getName());
}
putValidator.setCurrentSession(session);
try {
@@ -144,7 +141,7 @@ public abstract class InvalidationCacheAccessDelegate implements AccessDelegate
public void removeAll() throws CacheException {
try {
if (!putValidator.beginInvalidatingRegion()) {
- throw new CacheException("Failed to invalidate pending putFromLoad calls for region " + region.getName());
+ log.failedInvalidateRegion(region.getName());
}
Caches.removeAll(cache);
}
@@ -162,7 +159,7 @@ public abstract class InvalidationCacheAccessDelegate implements AccessDelegate
public void evictAll() throws CacheException {
try {
if (!putValidator.beginInvalidatingRegion()) {
- throw new CacheException("Failed to invalidate pending putFromLoad calls for region " + region.getName());
+ log.failedInvalidateRegion(region.getName());
}
// Invalidate the local region and then go remote
@@ -177,9 +174,7 @@ public abstract class InvalidationCacheAccessDelegate implements AccessDelegate
@Override
public void unlockItem(SessionImplementor session, Object key) throws CacheException {
if ( !putValidator.endInvalidatingKey(session, key) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
}
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonStrictAccessDelegate.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonStrictAccessDelegate.java
index 009aabb21d..29a89a37a1 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonStrictAccessDelegate.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonStrictAccessDelegate.java
@@ -9,6 +9,7 @@ package org.hibernate.cache.infinispan.access;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion;
import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.infinispan.util.VersionedEntry;
import org.hibernate.cache.spi.access.SoftLock;
import org.hibernate.cache.spi.entry.CacheEntry;
@@ -17,8 +18,6 @@ import org.hibernate.resource.transaction.TransactionCoordinator;
import org.infinispan.AdvancedCache;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.context.Flag;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.Comparator;
import java.util.concurrent.TimeUnit;
@@ -31,7 +30,7 @@ import java.util.concurrent.TimeUnit;
* @author Radim Vansa <rvansa@redhat.com>
*/
public class NonStrictAccessDelegate implements AccessDelegate {
- private static final Log log = LogFactory.getLog( NonStrictAccessDelegate.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( NonStrictAccessDelegate.class );
private static final boolean trace = log.isTraceEnabled();
private final BaseTransactionalDataRegion region;
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationCacheAccessDelegate.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationCacheAccessDelegate.java
index 3c0be3179b..c1a43a59e7 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationCacheAccessDelegate.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationCacheAccessDelegate.java
@@ -38,9 +38,7 @@ public class NonTxInvalidationCacheAccessDelegate extends InvalidationCacheAcces
// (or any other invalidation), naked put that was started after the eviction ended but before this insert
// ended could insert the stale entry into the cache (since the entry was removed by eviction).
if ( !putValidator.beginInvalidatingWithPFER(session, key, value)) {
- throw new CacheException(
- "Failed to invalidate pending putFromLoad calls for key " + key + " from region " + region.getName()
- );
+ throw log.failedInvalidatePendingPut(key, region.getName());
}
putValidator.setCurrentSession(session);
try {
@@ -64,9 +62,7 @@ public class NonTxInvalidationCacheAccessDelegate extends InvalidationCacheAcces
// (or any other invalidation), naked put that was started after the eviction ended but before this update
// ended could insert the stale entry into the cache (since the entry was removed by eviction).
if ( !putValidator.beginInvalidatingWithPFER(session, key, value)) {
- throw new CacheException(
- "Failed to invalidate pending putFromLoad calls for key " + key + " from region " + region.getName()
- );
+ throw log.failedInvalidatePendingPut(key, region.getName());
}
putValidator.setCurrentSession(session);
try {
@@ -108,18 +104,14 @@ public class NonTxInvalidationCacheAccessDelegate extends InvalidationCacheAcces
@Override
public void unlockItem(SessionImplementor session, Object key) throws CacheException {
if ( !putValidator.endInvalidatingKey(session, key, isCommitted(session)) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
}
@Override
public boolean afterInsert(SessionImplementor session, Object key, Object value, Object version) {
if ( !putValidator.endInvalidatingKey(session, key, isCommitted(session)) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
return false;
}
@@ -127,9 +119,7 @@ public class NonTxInvalidationCacheAccessDelegate extends InvalidationCacheAcces
@Override
public boolean afterUpdate(SessionImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) {
if ( !putValidator.endInvalidatingKey(session, key, isCommitted(session)) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
return false;
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationInterceptor.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationInterceptor.java
index dff8dc44b7..9126da0603 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationInterceptor.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/NonTxInvalidationInterceptor.java
@@ -7,6 +7,7 @@
package org.hibernate.cache.infinispan.access;
import org.hibernate.cache.infinispan.util.CacheCommandInitializer;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.infinispan.commands.CommandsFactory;
import org.infinispan.commands.FlagAffectedCommand;
import org.infinispan.commands.write.ClearCommand;
@@ -30,8 +31,6 @@ import org.infinispan.jmx.annotations.ManagedAttribute;
import org.infinispan.jmx.annotations.ManagedOperation;
import org.infinispan.jmx.annotations.MeasurementType;
import org.infinispan.jmx.annotations.Parameter;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.concurrent.atomic.AtomicLong;
@@ -53,17 +52,12 @@ public class NonTxInvalidationInterceptor extends BaseRpcInterceptor implements
private CacheCommandInitializer commandInitializer;
private boolean statisticsEnabled;
- private static final Log log = LogFactory.getLog(InvalidationInterceptor.class);
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(InvalidationInterceptor.class);
public NonTxInvalidationInterceptor(PutFromLoadValidator putFromLoadValidator) {
this.putFromLoadValidator = putFromLoadValidator;
}
- @Override
- protected Log getLog() {
- return log;
- }
-
@Inject
public void injectDependencies(CommandsFactory commandsFactory, CacheCommandInitializer commandInitializer) {
this.commandsFactory = commandsFactory;
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/PutFromLoadValidator.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/PutFromLoadValidator.java
index 5c8196aae3..a6bf5d26bc 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/PutFromLoadValidator.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/PutFromLoadValidator.java
@@ -20,6 +20,7 @@ import java.util.concurrent.locks.ReentrantLock;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.util.CacheCommandInitializer;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.spi.RegionFactory;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.resource.transaction.TransactionCoordinator;
@@ -31,8 +32,6 @@ import org.infinispan.interceptors.EntryWrappingInterceptor;
import org.infinispan.interceptors.InvalidationInterceptor;
import org.infinispan.interceptors.base.CommandInterceptor;
import org.infinispan.manager.EmbeddedCacheManager;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
/**
* Encapsulates logic to allow a {@link InvalidationCacheAccessDelegate} to determine
@@ -84,7 +83,7 @@ import org.infinispan.util.logging.LogFactory;
* @version $Revision: $
*/
public class PutFromLoadValidator {
- private static final Log log = LogFactory.getLog(PutFromLoadValidator.class);
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(PutFromLoadValidator.class);
private static final boolean trace = log.isTraceEnabled();
/**
@@ -152,7 +151,7 @@ public class PutFromLoadValidator {
this.expirationPeriod = pendingPutsConfiguration.expiration().maxIdle();
}
else {
- throw new IllegalArgumentException("Pending puts cache needs to have maxIdle expiration set!");
+ throw log.pendingPutsMustHaveMaxIdle();
}
CacheMode cacheMode = cache.getCacheConfiguration().clustering().cacheMode();
// Since we need to intercept both invalidations of entries that are in the cache and those
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneAccessDelegate.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneAccessDelegate.java
index 24ddc3bc80..b82163ad98 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneAccessDelegate.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneAccessDelegate.java
@@ -10,6 +10,7 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion;
import org.hibernate.cache.infinispan.util.Caches;
import org.hibernate.cache.infinispan.util.FutureUpdate;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.infinispan.util.TombstoneUpdate;
import org.hibernate.cache.infinispan.util.Tombstone;
import org.hibernate.cache.spi.access.SoftLock;
@@ -18,8 +19,6 @@ import org.hibernate.resource.transaction.TransactionCoordinator;
import org.infinispan.AdvancedCache;
import org.infinispan.configuration.cache.Configuration;
import org.infinispan.context.Flag;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.concurrent.TimeUnit;
@@ -27,7 +26,7 @@ import java.util.concurrent.TimeUnit;
* @author Radim Vansa <rvansa@redhat.com>
*/
public class TombstoneAccessDelegate implements AccessDelegate {
- private static final Log log = LogFactory.getLog( TombstoneAccessDelegate.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( TombstoneAccessDelegate.class );
protected final BaseTransactionalDataRegion region;
protected final AdvancedCache cache;
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneCallInterceptor.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneCallInterceptor.java
index aa9a1e73e9..1a25ff9a5c 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneCallInterceptor.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TombstoneCallInterceptor.java
@@ -21,8 +21,6 @@ import org.infinispan.factories.annotations.Inject;
import org.infinispan.interceptors.CallInterceptor;
import org.infinispan.metadata.EmbeddedMetadata;
import org.infinispan.metadata.Metadata;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.Map;
import java.util.Set;
@@ -38,7 +36,6 @@ import java.util.concurrent.TimeUnit;
* @author Radim Vansa <rvansa@redhat.com>
*/
public class TombstoneCallInterceptor extends CallInterceptor {
- private static final Log log = LogFactory.getLog( TombstoneCallInterceptor.class );
private static final UUID ZERO = new UUID(0, 0);
private AdvancedCache cache;
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationCacheAccessDelegate.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationCacheAccessDelegate.java
index 11f688126f..a095d59026 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationCacheAccessDelegate.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationCacheAccessDelegate.java
@@ -32,9 +32,7 @@ public class TxInvalidationCacheAccessDelegate extends InvalidationCacheAccessDe
// (or any other invalidation), naked put that was started after the eviction ended but before this insert
// ended could insert the stale entry into the cache (since the entry was removed by eviction).
if ( !putValidator.beginInvalidatingKey(session, key)) {
- throw new CacheException(
- "Failed to invalidate pending putFromLoad calls for key " + key + " from region " + region.getName()
- );
+ throw log.failedInvalidatePendingPut(key, region.getName());
}
putValidator.setCurrentSession(session);
try {
@@ -58,9 +56,7 @@ public class TxInvalidationCacheAccessDelegate extends InvalidationCacheAccessDe
// (or any other invalidation), naked put that was started after the eviction ended but before this update
// ended could insert the stale entry into the cache (since the entry was removed by eviction).
if ( !putValidator.beginInvalidatingKey(session, key)) {
- throw new CacheException(
- "Failed to invalidate pending putFromLoad calls for key " + key + " from region " + region.getName()
- );
+ log.failedInvalidatePendingPut(key, region.getName());
}
putValidator.setCurrentSession(session);
try {
@@ -75,9 +71,7 @@ public class TxInvalidationCacheAccessDelegate extends InvalidationCacheAccessDe
@Override
public boolean afterInsert(SessionImplementor session, Object key, Object value, Object version) {
if ( !putValidator.endInvalidatingKey(session, key) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
return false;
}
@@ -85,9 +79,7 @@ public class TxInvalidationCacheAccessDelegate extends InvalidationCacheAccessDe
@Override
public boolean afterUpdate(SessionImplementor session, Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) {
if ( !putValidator.endInvalidatingKey(session, key) ) {
- // TODO: localization
- log.warn("Failed to end invalidating pending putFromLoad calls for key " + key + " from region "
- + region.getName() + "; the key won't be cached until invalidation expires.");
+ log.failedEndInvalidating(key, region.getName());
}
return false;
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationInterceptor.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationInterceptor.java
index 7243198e3c..73608c7007 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationInterceptor.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxInvalidationInterceptor.java
@@ -6,6 +6,7 @@
*/
package org.hibernate.cache.infinispan.access;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.infinispan.commands.AbstractVisitor;
import org.infinispan.commands.CommandsFactory;
import org.infinispan.commands.FlagAffectedCommand;
@@ -34,8 +35,6 @@ import org.infinispan.jmx.annotations.ManagedAttribute;
import org.infinispan.jmx.annotations.ManagedOperation;
import org.infinispan.jmx.annotations.MeasurementType;
import org.infinispan.jmx.annotations.Parameter;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.Arrays;
import java.util.Collections;
@@ -64,12 +63,7 @@ public class TxInvalidationInterceptor extends BaseRpcInterceptor implements Jmx
private CommandsFactory commandsFactory;
private boolean statisticsEnabled;
- private static final Log log = LogFactory.getLog( TxInvalidationInterceptor.class );
-
- @Override
- protected Log getLog() {
- return log;
- }
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( TxInvalidationInterceptor.class );
@Inject
public void injectDependencies(CommandsFactory commandsFactory) {
@@ -181,9 +175,9 @@ public class TxInvalidationInterceptor extends BaseRpcInterceptor implements Jmx
invalidateAcrossCluster( defaultSynchronous, filterVisitor.result.toArray(), ctx );
}
catch (Throwable t) {
- log.unableToRollbackEvictionsDuringPrepare( t );
+ log.unableToRollbackInvalidationsDuringPrepare( t );
if ( t instanceof RuntimeException ) {
- throw (RuntimeException) t;
+ throw t;
}
else {
throw new RuntimeException( "Unable to broadcast invalidation messages", t );
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxPutFromLoadInterceptor.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxPutFromLoadInterceptor.java
index 30a66a7ef4..e6adbf4e56 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxPutFromLoadInterceptor.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/access/TxPutFromLoadInterceptor.java
@@ -8,6 +8,7 @@ package org.hibernate.cache.infinispan.access;
import org.hibernate.cache.infinispan.util.CacheCommandInitializer;
import org.hibernate.cache.infinispan.util.EndInvalidationCommand;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.infinispan.commands.VisitableCommand;
import org.infinispan.commands.tx.CommitCommand;
import org.infinispan.commands.tx.PrepareCommand;
@@ -20,8 +21,6 @@ import org.infinispan.factories.annotations.Inject;
import org.infinispan.interceptors.base.BaseRpcInterceptor;
import org.infinispan.remoting.inboundhandler.DeliverOrder;
import org.infinispan.remoting.rpc.RpcManager;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.Set;
@@ -34,7 +33,7 @@ import java.util.Set;
* @author Radim Vansa <rvansa@redhat.com>
*/
class TxPutFromLoadInterceptor extends BaseRpcInterceptor {
- private final static Log log = LogFactory.getLog(TxPutFromLoadInterceptor.class);
+ private final static InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(TxPutFromLoadInterceptor.class);
private PutFromLoadValidator putFromLoadValidator;
private final String cacheName;
private RpcManager rpcManager;
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java
index c6a6a5b32b..239327e2ca 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseRegion.java
@@ -15,13 +15,12 @@ import javax.transaction.TransactionManager;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.spi.Region;
import org.hibernate.cache.spi.access.AccessType;
import org.infinispan.AdvancedCache;
import org.infinispan.context.Flag;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
/**
* Support for Infinispan {@link Region}s. Handles common "utility" methods for an underlying named
@@ -34,7 +33,7 @@ import org.infinispan.util.logging.LogFactory;
*/
public abstract class BaseRegion implements Region {
- private static final Log log = LogFactory.getLog( BaseRegion.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( BaseRegion.class );
protected final String name;
protected final AdvancedCache cache;
@@ -152,7 +151,7 @@ public abstract class BaseRegion implements Region {
}
}
catch (SystemException se) {
- throw new CacheException( "Could not suspend transaction", se );
+ throw log.cannotSuspendTx(se);
}
return tx;
}
@@ -169,7 +168,7 @@ public abstract class BaseRegion implements Region {
}
}
catch (Exception e) {
- throw new CacheException( "Could not resume transaction", e );
+ throw log.cannotResumeTx( e );
}
}
@@ -224,16 +223,16 @@ public abstract class BaseRegion implements Region {
return tm != null ? tm.getTransaction() : null;
}
catch (SystemException e) {
- throw new CacheException("Unable to get current transaction", e);
+ throw log.cannotGetCurrentTx(e);
}
}
protected void checkAccessType(AccessType accessType) {
if (accessType == AccessType.TRANSACTIONAL && !cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) {
- log.warn("Requesting TRANSACTIONAL cache concurrency strategy but the cache is not configured as transactional.");
+ log.transactionalStrategyNonTransactionalCache();
}
else if (accessType == AccessType.READ_WRITE && cache.getCacheConfiguration().transaction().transactionMode().isTransactional()) {
- log.warn("Requesting READ_WRITE cache concurrency strategy but the cache was configured as transactional.");
+ log.readWriteStrategyTransactionalCache();
}
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseTransactionalDataRegion.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseTransactionalDataRegion.java
index 718d51cac6..b04e5d1d96 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseTransactionalDataRegion.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/impl/BaseTransactionalDataRegion.java
@@ -17,6 +17,7 @@ import org.hibernate.cache.infinispan.access.TxInvalidationCacheAccessDelegate;
import org.hibernate.cache.infinispan.access.VersionedCallInterceptor;
import org.hibernate.cache.infinispan.util.Caches;
import org.hibernate.cache.infinispan.util.FutureUpdate;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.infinispan.util.Tombstone;
import org.hibernate.cache.infinispan.util.VersionedEntry;
import org.hibernate.cache.spi.CacheDataDescription;
@@ -32,12 +33,9 @@ import org.infinispan.container.entries.CacheEntry;
import org.infinispan.filter.KeyValueFilter;
import org.infinispan.interceptors.CallInterceptor;
import org.infinispan.interceptors.base.CommandInterceptor;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import javax.transaction.TransactionManager;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@@ -51,7 +49,7 @@ import java.util.concurrent.TimeUnit;
*/
public abstract class BaseTransactionalDataRegion
extends BaseRegion implements TransactionalDataRegion {
- private static final Log log = LogFactory.getLog( BaseTransactionalDataRegion.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( BaseTransactionalDataRegion.class );
private final CacheDataDescription metadata;
private final CacheKeysFactory cacheKeysFactory;
private final boolean requiresTransaction;
@@ -166,7 +164,7 @@ public abstract class BaseTransactionalDataRegion
}
Configuration configuration = cache.getCacheConfiguration();
if (configuration.eviction().maxEntries() >= 0) {
- log.warn("Setting eviction on cache using tombstones can introduce inconsistencies!");
+ log.evictionWithTombstones();
}
cache.removeInterceptor(CallInterceptor.class);
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/query/QueryResultsRegionImpl.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/query/QueryResultsRegionImpl.java
index f706bada47..c6836cf619 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/query/QueryResultsRegionImpl.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/query/QueryResultsRegionImpl.java
@@ -13,6 +13,7 @@ import org.hibernate.cache.CacheException;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.impl.BaseTransactionalDataRegion;
import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.infinispan.util.InvocationAfterCompletion;
import org.hibernate.cache.spi.QueryResultsRegion;
import org.hibernate.engine.spi.SessionImplementor;
@@ -21,8 +22,6 @@ import org.infinispan.AdvancedCache;
import org.infinispan.configuration.cache.TransactionConfiguration;
import org.infinispan.context.Flag;
import org.infinispan.transaction.TransactionMode;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import java.util.HashMap;
import java.util.Map;
@@ -37,7 +36,7 @@ import java.util.concurrent.ConcurrentMap;
* @since 3.5
*/
public class QueryResultsRegionImpl extends BaseTransactionalDataRegion implements QueryResultsRegion {
- private static final Log log = LogFactory.getLog( QueryResultsRegionImpl.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( QueryResultsRegionImpl.class );
private final AdvancedCache evictCache;
private final AdvancedCache putCache;
@@ -71,7 +70,7 @@ public class QueryResultsRegionImpl extends BaseTransactionalDataRegion implemen
// Since we execute the query update explicitly form transaction synchronization, the putCache does not need
// to be transactional anymore (it had to be in the past to prevent revealing uncommitted changes).
if (transactional) {
- log.warn("Use non-transactional query caches for best performance!");
+ log.useNonTransactionalQueryCache();
}
}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/TimestampTypeOverrides.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/TimestampTypeOverrides.java
deleted file mode 100644
index edf8781294..0000000000
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/timestamp/TimestampTypeOverrides.java
+++ /dev/null
@@ -1,34 +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 .
- */
-package org.hibernate.cache.infinispan.timestamp;
-
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.infinispan.TypeOverrides;
-
-import org.infinispan.configuration.cache.Configuration;
-import org.infinispan.eviction.EvictionStrategy;
-
-/**
- * TimestampTypeOverrides.
- *
- * @author Galder Zamarreño
- * @since 3.5
- */
-public class TimestampTypeOverrides extends TypeOverrides {
-
- @Override
- public void validateInfinispanConfiguration(Configuration cfg) throws CacheException {
- if ( cfg.clustering().cacheMode().isInvalidation() ) {
- throw new CacheException( "Timestamp cache cannot be configured with invalidation" );
- }
- final EvictionStrategy strategy = cfg.eviction().strategy();
- if ( !strategy.equals( EvictionStrategy.NONE ) ) {
- throw new CacheException( "Timestamp cache cannot be configured with eviction" );
- }
- }
-
-}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InfinispanMessageLogger.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InfinispanMessageLogger.java
new file mode 100644
index 0000000000..c698453e1d
--- /dev/null
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InfinispanMessageLogger.java
@@ -0,0 +1,132 @@
+/*
+ * 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 .
+ */
+package org.hibernate.cache.infinispan.util;
+
+import org.hibernate.cache.CacheException;
+import org.hibernate.cache.infinispan.InfinispanRegionFactory;
+import org.hibernate.cache.infinispan.JndiInfinispanRegionFactory;
+import org.jboss.logging.BasicLogger;
+import org.jboss.logging.Logger;
+import org.jboss.logging.annotations.Cause;
+import org.jboss.logging.annotations.LogMessage;
+import org.jboss.logging.annotations.Message;
+import org.jboss.logging.annotations.MessageLogger;
+
+import javax.naming.NamingException;
+import javax.transaction.SystemException;
+
+import static org.jboss.logging.Logger.Level.*;
+
+/**
+ * The jboss-logging {@link MessageLogger} for the hibernate-infinispan module. It reserves message ids ranging from
+ * 25001 to 30000 inclusively.
+ *
+ * @author Radim Vansa <rvansa@redhat.com>
+ */
+@MessageLogger(projectCode = "HHH")
+public interface InfinispanMessageLogger extends BasicLogger {
+ // Workaround for JBLOGGING-120: cannot add static interface method
+ class Provider {
+ public static InfinispanMessageLogger getLog(Class clazz) {
+ return Logger.getMessageLogger(InfinispanMessageLogger.class, clazz.getName());
+ }
+ }
+
+ @Message(value = "Pending-puts cache must not be clustered!", id = 25001)
+ CacheException pendingPutsMustNotBeClustered();
+
+ @Message(value = "Pending-puts cache must not be transactional!", id = 25002)
+ CacheException pendingPutsMustNotBeTransactional();
+
+ @LogMessage(level = WARN)
+ @Message(value = "Pending-puts cache configuration should be a template.", id = 25003)
+ void pendingPutsShouldBeTemplate();
+
+ @Message(value = "Pending-puts cache must have expiration.max-idle set", id = 25004)
+ CacheException pendingPutsMustHaveMaxIdle();
+
+ @LogMessage(level = WARN)
+ @Message(value = "Property '" + InfinispanRegionFactory.INFINISPAN_USE_SYNCHRONIZATION_PROP + "' is deprecated; 2LC with transactional cache must always use synchronizations.", id = 25005)
+ void propertyUseSynchronizationDeprecated();
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Custom cache configuration '%s' was requested for type %s but it was not found!", id = 25006)
+ void customConfigForTypeNotFound(String cacheName, String type);
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Custom cache configuration '%s' was requested for region %s but it was not found - using configuration by type (%s).", id = 25007)
+ void customConfigForRegionNotFound(String templateCacheName, String regionName, String type);
+
+ @Message(value = "Timestamps cache must not use eviction!", id = 25008)
+ CacheException timestampsMustNotUseEviction();
+
+ @Message(value = "Unable to start region factory", id = 25009)
+ CacheException unableToStart(@Cause Throwable t);
+
+ @Message(value = "Unable to create default cache manager", id = 25010)
+ CacheException unableToCreateCacheManager(@Cause Throwable t);
+
+ @Message(value = "Infinispan custom cache command factory not installed (possibly because the classloader where Infinispan lives couldn't find the Hibernate Infinispan cache provider)", id = 25011)
+ CacheException cannotInstallCommandFactory();
+
+ @LogMessage(level = WARN)
+ @Message(value = "Requesting TRANSACTIONAL cache concurrency strategy but the cache is not configured as transactional.", id = 25012)
+ void transactionalStrategyNonTransactionalCache();
+
+ @LogMessage(level = WARN)
+ @Message(value = "Requesting READ_WRITE cache concurrency strategy but the cache was configured as transactional.", id = 25013)
+ void readWriteStrategyTransactionalCache();
+
+ @LogMessage(level = WARN)
+ @Message(value = "Setting eviction on cache using tombstones can introduce inconsistencies!", id = 25014)
+ void evictionWithTombstones();
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Failure updating cache in afterCompletion, will retry", id = 25015)
+ void failureInAfterCompletion(@Cause Exception e);
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Failed to end invalidating pending putFromLoad calls for key %s from region %s; the key won't be cached until invalidation expires.", id = 25016)
+ void failedEndInvalidating(Object key, String name);
+
+ @Message(value = "Unable to retrieve CacheManager from JNDI [%s]", id = 25017)
+ CacheException unableToRetrieveCmFromJndi(String jndiNamespace);
+
+ @LogMessage(level = WARN)
+ @Message(value = "Unable to release initial context", id = 25018)
+ void unableToReleaseContext(@Cause NamingException ne);
+
+ @LogMessage(level = WARN)
+ @Message(value = "Use non-transactional query caches for best performance!", id = 25019)
+ void useNonTransactionalQueryCache();
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Unable to broadcast invalidations as a part of the prepare phase. Rolling back.", id = 25020)
+ void unableToRollbackInvalidationsDuringPrepare(@Cause Throwable t);
+
+ @Message(value = "Could not suspend transaction", id = 25021)
+ CacheException cannotSuspendTx(@Cause SystemException se);
+
+ @Message(value = "Could not resume transaction", id = 25022)
+ CacheException cannotResumeTx(@Cause Exception e);
+
+ @Message(value = "Unable to get current transaction", id = 25023)
+ CacheException cannotGetCurrentTx(@Cause SystemException e);
+
+ @Message(value = "Failed to invalidate pending putFromLoad calls for key %s from region %s", id = 25024)
+ CacheException failedInvalidatePendingPut(Object key, String regionName);
+
+ @LogMessage(level = ERROR)
+ @Message(value = "Failed to invalidate pending putFromLoad calls for region %s", id = 25025)
+ void failedInvalidateRegion(String regionName);
+
+ @Message(value = "Property '" + JndiInfinispanRegionFactory.CACHE_MANAGER_RESOURCE_PROP + "' not set", id = 25026)
+ CacheException propertyCacheManagerResourceNotSet();
+
+ @Message(value = "Timestamp cache cannot be configured with invalidation", id = 25027)
+ CacheException timestampsMustNotUseInvalidation();
+}
diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InvocationAfterCompletion.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InvocationAfterCompletion.java
index f6eeccb803..b25a0f67fd 100644
--- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InvocationAfterCompletion.java
+++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/util/InvocationAfterCompletion.java
@@ -11,8 +11,6 @@ import org.hibernate.jdbc.WorkExecutor;
import org.hibernate.jdbc.WorkExecutorVisitable;
import org.hibernate.resource.transaction.TransactionCoordinator;
import org.infinispan.AdvancedCache;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import javax.transaction.Status;
import javax.transaction.Synchronization;
@@ -24,7 +22,7 @@ import java.sql.SQLException;
* @author Radim Vansa <rvansa@redhat.com>
*/
public abstract class InvocationAfterCompletion implements Synchronization {
- protected static final Log log = LogFactory.getLog( InvocationAfterCompletion.class );
+ protected static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( InvocationAfterCompletion.class );
protected final TransactionCoordinator tc;
protected final AdvancedCache cache;
diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTest.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTest.java
index 29a47911a4..3f72703870 100644
--- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTest.java
+++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTest.java
@@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.access.PutFromLoadValidator;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransactionManagerImpl;
import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
@@ -33,8 +34,6 @@ import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.test.CacheManagerCallable;
import org.infinispan.test.fwk.TestCacheManagerFactory;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -55,7 +54,7 @@ import static org.junit.Assert.*;
*/
public class PutFromLoadValidatorUnitTest {
- private static final Log log = LogFactory.getLog(
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(
PutFromLoadValidatorUnitTest.class);
@Rule
diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/AbstractNonInvalidationTest.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/AbstractNonInvalidationTest.java
index 589be7256b..6efe5e32b6 100644
--- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/AbstractNonInvalidationTest.java
+++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/AbstractNonInvalidationTest.java
@@ -4,17 +4,14 @@ import org.hibernate.PessimisticLockException;
import org.hibernate.StaleStateException;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.entity.EntityRegionImpl;
-import org.hibernate.cache.infinispan.util.Caches;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.spi.Region;
-import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.test.cache.infinispan.functional.entities.Item;
import org.hibernate.test.cache.infinispan.util.TestInfinispanRegionFactory;
import org.hibernate.test.cache.infinispan.util.TestTimeService;
import org.hibernate.testing.AfterClassOnce;
import org.hibernate.testing.BeforeClassOnce;
import org.infinispan.AdvancedCache;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import org.junit.After;
import org.junit.Before;
@@ -43,7 +40,7 @@ public abstract class AbstractNonInvalidationTest extends SingleNodeTest {
protected long TIMEOUT;
protected ExecutorService executor;
- protected Log log = LogFactory.getLog(getClass());
+ protected InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(getClass());
protected AdvancedCache entityCache;
protected long itemId;
protected Region region;
diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/ConcurrentWriteTest.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/ConcurrentWriteTest.java
index 9200022c81..4a125bdbed 100644
--- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/ConcurrentWriteTest.java
+++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/ConcurrentWriteTest.java
@@ -22,15 +22,13 @@ import java.util.concurrent.TimeUnit;
import org.hibernate.FlushMode;
import org.hibernate.LockMode;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.stat.SecondLevelCacheStatistics;
import org.hibernate.test.cache.infinispan.functional.entities.Contact;
import org.hibernate.test.cache.infinispan.functional.entities.Customer;
import org.junit.Test;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -40,7 +38,7 @@ import static org.junit.Assert.assertNull;
* @author Galder Zamarreño
*/
public class ConcurrentWriteTest extends SingleNodeTest {
- private static final Log log = LogFactory.getLog( ConcurrentWriteTest.class );
+ private static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog( ConcurrentWriteTest.class );
private static final boolean trace = log.isTraceEnabled();
/**
* when USER_COUNT==1, tests pass, when >4 tests fail
diff --git a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/InvalidationTest.java b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/InvalidationTest.java
index adb8490c0f..aa87dc0aaa 100644
--- a/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/InvalidationTest.java
+++ b/hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/InvalidationTest.java
@@ -3,6 +3,7 @@ package org.hibernate.test.cache.infinispan.functional;
import org.hibernate.PessimisticLockException;
import org.hibernate.cache.infinispan.InfinispanRegionFactory;
import org.hibernate.cache.infinispan.entity.EntityRegionImpl;
+import org.hibernate.cache.infinispan.util.InfinispanMessageLogger;
import org.hibernate.cache.spi.Region;
import org.hibernate.test.cache.infinispan.functional.entities.Item;
import org.hibernate.test.cache.infinispan.util.TestInfinispanRegionFactory;
@@ -11,8 +12,6 @@ import org.infinispan.AdvancedCache;
import org.infinispan.commands.read.GetKeyValueCommand;
import org.infinispan.context.InvocationContext;
import org.infinispan.interceptors.base.BaseCustomInterceptor;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
import org.junit.Test;
import java.util.Arrays;
@@ -33,7 +32,7 @@ import static org.junit.Assert.assertNull;
* @author Radim Vansa <rvansa@redhat.com>
*/
public class InvalidationTest extends SingleNodeTest {
- static final Log log = LogFactory.getLog(ReadOnlyTest.class);
+ static final InfinispanMessageLogger log = InfinispanMessageLogger.Provider.getLog(ReadOnlyTest.class);
@Override
public List