/** * 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 ); } }
protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) { return TransactionManagerLookupFactory.getTransactionManagerLookup(properties); }
public TransactionManagerLookup getTransactionManagerLookup() { return transactionManagerLookup; }
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); } }
TransactionManagerLookupAdaptor(TransactionManagerLookup tml, Properties props) { this.tml=tml; this.props=props; }