jndiboundtreecacheprovider.java

来自「介绍了hibernate的入门有一些基本常用的事例」· Java 代码 · 共 64 行

JAVA
64
字号
// $Id: JndiBoundTreeCacheProvider.java,v 1.2 2005/03/16 06:01:16 oneovthafew Exp $package org.hibernate.cache;import java.util.Properties;import javax.transaction.TransactionManager;import org.hibernate.transaction.TransactionManagerLookup;import org.hibernate.transaction.TransactionManagerLookupFactory;/** * Support for JBossCache (TreeCache), where the cache instance is available * via JNDI lookup. * * @author Steve Ebersole */public class JndiBoundTreeCacheProvider extends AbstractJndiBoundCacheProvider {	private TransactionManager transactionManager;	/**	 * Construct a Cache representing the "region" within in the underlying cache	 * provider.	 *	 * @param regionName the name of the cache region	 * @param properties configuration settings	 *	 * @throws CacheException	 */	public Cache buildCache(String regionName, Properties properties) throws CacheException {		return new TreeCache( getTreeCacheInstance(), regionName, transactionManager );	}	public void prepare(Properties properties) throws CacheException {		TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);		if (transactionManagerLookup!=null) {			transactionManager = transactionManagerLookup.getTransactionManager(properties);		}	}	/**	 * Generate a timestamp	 */	public long nextTimestamp() {		return System.currentTimeMillis() / 100;	}	/**	 * By default, should minimal-puts mode be enabled when using this cache.	 * <p/>	 * Since TreeCache is a clusterable cache and we are only getting a	 * reference the instance from JNDI, safest to assume a clustered	 * setup and return true here.	 *	 * @return True.	 */	public boolean isMinimalPutsEnabledByDefault() {		return true;	}	public org.jboss.cache.TreeCache getTreeCacheInstance() {		return ( org.jboss.cache.TreeCache ) super.getCache();	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?