类org.hibernate.transaction.TransactionManagerLookup源码实例Demo

下面列出了怎么用org.hibernate.transaction.TransactionManagerLookup的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: cacheonix-core   文件: TreeCacheProvider.java
/**
 * Prepare the underlying JBossCache TreeCache instance.
 *
 * @param properties All current config settings.
 *
 * @throws CacheException Indicates a problem preparing cache for use.
 */
public void start(Properties properties) {
	String resource = properties.getProperty( Environment.CACHE_PROVIDER_CONFIG );

	if ( resource == null ) {
		resource = properties.getProperty( CONFIG_RESOURCE );
	}
	if ( resource == null ) {
		resource = DEFAULT_CONFIG;
	}
	log.debug( "Configuring TreeCache from resource [" + resource + "]" );
	try {
		cache = new org.jboss.cache.TreeCache();
		PropertyConfigurator config = new PropertyConfigurator();
		config.configure( cache, resource );
		TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
		if (transactionManagerLookup!=null) {
			cache.setTransactionManagerLookup( new TransactionManagerLookupAdaptor(transactionManagerLookup, properties) );
			transactionManager = transactionManagerLookup.getTransactionManager(properties);
		}
		cache.start();
	}
	catch (Exception e) {
		throw new CacheException(e);
	}
}
 
/**
 * Prepare the underlying JBossCache TreeCache instance.
 *
 * @param properties All current config settings.
 * @throws CacheException
 *          Indicates a problem preparing cache for use.
 */
public void start(Properties properties) {
	String resource = properties.getProperty( Environment.CACHE_PROVIDER_CONFIG );
	if (resource == null) {
		resource = properties.getProperty( CONFIG_RESOURCE );
	}
	if ( resource == null ) {
		resource = DEFAULT_CONFIG;
	}
	log.debug( "Configuring TreeCache from resource [" + resource + "]" );
	try {
		cache = new org.jboss.cache.TreeCache();
		PropertyConfigurator config = new PropertyConfigurator();
		config.configure( cache, resource );
		TransactionManagerLookup transactionManagerLookup =
				TransactionManagerLookupFactory.getTransactionManagerLookup( properties );
		if ( transactionManagerLookup == null ) {
			throw new CacheException(
					"JBossCache only supports optimisitc locking with a configured " +
					"TransactionManagerLookup (" + Environment.TRANSACTION_MANAGER_STRATEGY + ")"
			);
		}
		cache.setTransactionManagerLookup(
				new TransactionManagerLookupAdaptor(
						transactionManagerLookup,
						properties
				)
		);
		if ( ! NODE_LOCKING_SCHEME.equalsIgnoreCase( cache.getNodeLockingScheme() ) ) {
			log.info( "Overriding node-locking-scheme to : " + NODE_LOCKING_SCHEME );
			cache.setNodeLockingScheme( NODE_LOCKING_SCHEME );
		}
		cache.start();
	}
	catch ( Exception e ) {
		throw new CacheException( e );
	}
}
 
源代码3 项目: cacheonix-core   文件: SettingsFactory.java
protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) {
	return TransactionManagerLookupFactory.getTransactionManagerLookup(properties);		
}
 
源代码4 项目: cacheonix-core   文件: Settings.java
public TransactionManagerLookup getTransactionManagerLookup() {
	return transactionManagerLookup;
}
 
源代码5 项目: cacheonix-core   文件: Settings.java
void setTransactionManagerLookup(TransactionManagerLookup lookup) {
	transactionManagerLookup = lookup;
}
 
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
	this.tml = tml;
	this.props = props;
}
 
public void prepare(Properties properties) throws CacheException {
	TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
	if (transactionManagerLookup!=null) {
		transactionManager = transactionManagerLookup.getTransactionManager(properties);
	}
}
 
源代码8 项目: cacheonix-core   文件: TreeCacheProvider.java
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
	this.tml=tml;
	this.props=props;
}
 
 类所在包
 类方法
 同包方法