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

项目: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);
    }
}
项目:cacheonix-core    文件:OptimisticTreeCacheProvider.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 ) {
            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 );
    }
}
项目:cacheonix-core    文件:SettingsFactory.java   
protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) {
    return TransactionManagerLookupFactory.getTransactionManagerLookup(properties);     
}
项目:cacheonix-core    文件:Settings.java   
public TransactionManagerLookup getTransactionManagerLookup() {
    return transactionManagerLookup;
}
项目:cacheonix-core    文件:Settings.java   
void setTransactionManagerLookup(TransactionManagerLookup lookup) {
    transactionManagerLookup = lookup;
}
项目:cacheonix-core    文件:OptimisticTreeCacheProvider.java   
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
    this.tml = tml;
    this.props = props;
}
项目:cacheonix-core    文件:JndiBoundTreeCacheProvider.java   
public void prepare(Properties properties) throws CacheException {
    TransactionManagerLookup transactionManagerLookup = TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
    if (transactionManagerLookup!=null) {
        transactionManager = transactionManagerLookup.getTransactionManager(properties);
    }
}
项目:cacheonix-core    文件:TreeCacheProvider.java   
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) {
    this.tml=tml;
    this.props=props;
}