org.hibernate.transaction.TransactionManagerLookup Java Examples

The following examples show how to use org.hibernate.transaction.TransactionManagerLookup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TreeCacheProvider.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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);
	}
}
 
Example #2
Source File: OptimisticTreeCacheProvider.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * 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 );
	}
}
 
Example #3
Source File: SettingsFactory.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) {
	return TransactionManagerLookupFactory.getTransactionManagerLookup(properties);		
}
 
Example #4
Source File: Settings.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public TransactionManagerLookup getTransactionManagerLookup() {
	return transactionManagerLookup;
}
 
Example #5
Source File: Settings.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
void setTransactionManagerLookup(TransactionManagerLookup lookup) {
	transactionManagerLookup = lookup;
}
 
Example #6
Source File: OptimisticTreeCacheProvider.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
	this.tml = tml;
	this.props = props;
}
 
Example #7
Source File: JndiBoundTreeCacheProvider.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void prepare(Properties properties) throws CacheException {
	TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
	if (transactionManagerLookup!=null) {
		transactionManager = transactionManagerLookup.getTransactionManager(properties);
	}
}
 
Example #8
Source File: TreeCacheProvider.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
	this.tml=tml;
	this.props=props;
}