diff --git a/documentation/src/main/docbook/devguide/en-US/Caching.xml b/documentation/src/main/docbook/devguide/en-US/Caching.xml index 213b39cecf..d2894b3812 100644 --- a/documentation/src/main/docbook/devguide/en-US/Caching.xml +++ b/documentation/src/main/docbook/devguide/en-US/Caching.xml @@ -383,42 +383,12 @@ read-only nontrict read-write read-write - - - - - OSCache - - - - read-only - nontrict read-write - read-write - - - - - SwarmCache - - - - read-only - nontrict read-write - - - - - JBoss Cache 1.x - - - - read-only transactional - JBoss Cache 2.x + Infinispan diff --git a/documentation/src/main/docbook/manual/en-US/content/batch.xml b/documentation/src/main/docbook/manual/en-US/content/batch.xml index 4ef5a23791..0754b972ca 100755 --- a/documentation/src/main/docbook/manual/en-US/content/batch.xml +++ b/documentation/src/main/docbook/manual/en-US/content/batch.xml @@ -226,7 +226,7 @@ session.close();]]> In keeping with the EJB3 specification, HQL UPDATE statements, by default, do not effect the - version + version or the timestamp property values for the affected entities. However, you can force Hibernate to reset the version or 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 9f07d706f4..003dce0b16 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 @@ -194,7 +194,7 @@ public class PutFromLoadValidator { // or regionRemoved has been called. Check if we can proceed if (now > invalidationTimestamp) { Long removedTime = recentRemovals.get(key); - if (removedTime == null || now > removedTime.longValue()) { + if (removedTime == null || now > removedTime ) { // It's legal to proceed. But we have to record this key // in pendingPuts so releasePutFromLoadLock can find it. // To do this we basically simulate a normal "register @@ -280,7 +280,7 @@ public class PutFromLoadValidator { // Don't let recentRemovals map become a memory leak RecentRemoval toClean = null; - boolean attemptClean = removal.timestamp.longValue() > earliestRemovalTimestamp; + boolean attemptClean = removal.timestamp > earliestRemovalTimestamp; removalsLock.lock(); try { removalsQueue.add(removal); @@ -290,7 +290,7 @@ public class PutFromLoadValidator { // just added it toClean = removalsQueue.remove(0); } - earliestRemovalTimestamp = removalsQueue.get(0).timestamp.longValue(); + earliestRemovalTimestamp = removalsQueue.get( 0 ).timestamp; } } finally { removalsLock.unlock(); @@ -526,7 +526,7 @@ public class PutFromLoadValidator { private RecentRemoval(Object key, long nakedPutInvalidationPeriod) { this.key = key; - timestamp = Long.valueOf(System.currentTimeMillis() + nakedPutInvalidationPeriod); + timestamp = System.currentTimeMillis() + nakedPutInvalidationPeriod; } } diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/EntityRegionImpl.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/EntityRegionImpl.java index ad66557cfb..7b61bca2b8 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/EntityRegionImpl.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/entity/EntityRegionImpl.java @@ -8,6 +8,7 @@ import org.hibernate.cache.spi.EntityRegion; import org.hibernate.cache.spi.RegionFactory; import org.hibernate.cache.spi.access.AccessType; import org.hibernate.cache.spi.access.EntityRegionAccessStrategy; + import org.infinispan.AdvancedCache; /** @@ -17,22 +18,25 @@ import org.infinispan.AdvancedCache; */ public class EntityRegionImpl extends BaseTransactionalDataRegion implements EntityRegion { - public EntityRegionImpl(AdvancedCache cache, String name, - CacheDataDescription metadata, RegionFactory factory) { - super(cache, name, metadata, factory); - } + public EntityRegionImpl(AdvancedCache cache, String name, + CacheDataDescription metadata, RegionFactory factory) { + super( cache, name, metadata, factory ); + } - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - if (AccessType.READ_ONLY.equals(accessType)) { - return new ReadOnlyAccess(this); - } else if (AccessType.TRANSACTIONAL.equals(accessType)) { - return new TransactionalAccess(this); - } - throw new CacheException("Unsupported access type [" + accessType.getExternalName() + "]"); - } + @Override + public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { + switch ( accessType ) { + case READ_ONLY: + return new ReadOnlyAccess( this ); + case TRANSACTIONAL: + return new TransactionalAccess( this ); + default: + throw new CacheException( "Unsupported access type [" + accessType.getExternalName() + "]" ); + } + } - public PutFromLoadValidator getPutFromLoadValidator() { - return new PutFromLoadValidator(cache); - } + public PutFromLoadValidator getPutFromLoadValidator() { + return new PutFromLoadValidator( cache ); + } } \ No newline at end of file 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 880d3eece7..8c57ad512c 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 @@ -23,6 +23,7 @@ public abstract class BaseTransactionalDataRegion this.metadata = metadata; } + @Override public CacheDataDescription getCacheDataDescription() { return metadata; } diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/NaturalIdRegionImpl.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/NaturalIdRegionImpl.java index 8f6f43fdb9..04aa44ae60 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/NaturalIdRegionImpl.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/NaturalIdRegionImpl.java @@ -26,12 +26,14 @@ public class NaturalIdRegionImpl extends BaseTransactionalDataRegion @Override public NaturalIdRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - if (AccessType.READ_ONLY.equals(accessType)) { - return new ReadOnlyAccess(this); - } else if (AccessType.TRANSACTIONAL.equals(accessType)) { - return new TransactionalAccess(this); + switch ( accessType ){ + case READ_ONLY: + return new ReadOnlyAccess( this ); + case TRANSACTIONAL: + return new TransactionalAccess( this ); + default: + throw new CacheException( "Unsupported access type [" + accessType.getExternalName() + "]" ); } - throw new CacheException("Unsupported access type [" + accessType.getExternalName() + "]"); } public PutFromLoadValidator getPutFromLoadValidator() { diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/ReadOnlyAccess.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/ReadOnlyAccess.java index f2ca29e713..0c173d0a5e 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/ReadOnlyAccess.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/naturalid/ReadOnlyAccess.java @@ -10,7 +10,6 @@ import org.hibernate.cache.spi.access.SoftLock; * @author Strong Liu */ class ReadOnlyAccess extends TransactionalAccess { - private static final Log log = LogFactory.getLog( ReadOnlyAccess.class ); ReadOnlyAccess(NaturalIdRegionImpl naturalIdRegion) { super( naturalIdRegion ); diff --git a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/tm/HibernateTransactionManagerLookup.java b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/tm/HibernateTransactionManagerLookup.java index e852e20e88..fbce5ff00e 100644 --- a/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/tm/HibernateTransactionManagerLookup.java +++ b/hibernate-infinispan/src/main/java/org/hibernate/cache/infinispan/tm/HibernateTransactionManagerLookup.java @@ -37,14 +37,9 @@ public class HibernateTransactionManagerLookup implements org.infinispan.transac private final JtaPlatform jtaPlatform; public HibernateTransactionManagerLookup(Settings settings, Properties properties) { - if ( settings != null ) { - jtaPlatform = settings.getJtaPlatform(); - } - else { - jtaPlatform = null; - } + this.jtaPlatform = settings != null ? settings.getJtaPlatform() : null; } - + @Override public TransactionManager getTransactionManager() throws Exception { return jtaPlatform == null ? null : jtaPlatform.retrieveTransactionManager(); }