1 package org.hibernate.cache; 3 4 import java.util.Properties ; 5 6 import javax.transaction.TransactionManager ; 7 8 import org.hibernate.transaction.TransactionManagerLookup; 9 import org.hibernate.transaction.TransactionManagerLookupFactory; 10 11 17 public class JndiBoundTreeCacheProvider extends AbstractJndiBoundCacheProvider { 18 19 private TransactionManager transactionManager; 20 21 30 public Cache buildCache(String regionName, Properties properties) throws CacheException { 31 return new TreeCache( getTreeCacheInstance(), regionName, transactionManager ); 32 } 33 34 public void prepare(Properties properties) throws CacheException { 35 TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties); 36 if (transactionManagerLookup!=null) { 37 transactionManager = transactionManagerLookup.getTransactionManager(properties); 38 } 39 } 40 43 public long nextTimestamp() { 44 return System.currentTimeMillis() / 100; 45 } 46 47 56 public boolean isMinimalPutsEnabledByDefault() { 57 return true; 58 } 59 60 public org.jboss.cache.TreeCache getTreeCacheInstance() { 61 return ( org.jboss.cache.TreeCache ) super.getCache(); 62 } 63 } 64 | Popular Tags |