/** * Extension point for subclasses, where we actually use a * {@link CacheFactory} to create a cache. This default implementation * uses {@link DefaultCacheFactory}. * * @param config the Configuration for the cache * @return the Cache */ protected Cache<Object, Object> createCache(Configuration config) { return new DefaultCacheFactory<Object, Object>().createCache(config, false); }
protected CacheSPI<K, V> createAndWire(Configuration configuration) throws Exception { CacheSPI<K, V> spi = new CacheInvocationDelegate<K, V>(); bootstrap(spi, configuration); return spi; }
public JBossCacheCacheFactory() { super(); cacheFactory = new DefaultCacheFactory<String, Object>(); }
/** * This implementation clones the configuration passed in before using it. * * @param configuration to use * @return a cache * @throws ConfigurationException if there are problems with the cfg */ public Cache<K, V> createCache(Configuration configuration) throws ConfigurationException { return createCache(configuration, true); }
/** * This implementation clones the configuration passed in before using it. * * @param configuration to use * @param start whether to start the cache * @return a cache * @throws ConfigurationException if there are problems with the cfg */ public Cache<K, V> createCache(Configuration configuration, boolean start) throws ConfigurationException { try { CacheSPI<K, V> cache = createAndWire(configuration); if (start) cache.start(); return cache; } catch (ConfigurationException ce) { throw ce; } catch (RuntimeException re) { throw re; } catch (Exception e) { throw new RuntimeException(e); } }
/** * Create a cache using the given settings and properties. * * @param settings The Hibernate settings * @param properties The configuration properties * @return The created cache */ protected Cache createSharedCache(Settings settings, Properties properties) { String configResource = PropertiesHelper.getString(CACHE_RESOURCE_PROP, properties, DEFAULT_CACHE_RESOURCE); return DefaultCacheFactory.getInstance().createCache(configResource, false); }
/** * This is here for backward compatibility only. Use <tt>new DefaultCacheFactory()</tt> instead. * * @deprecated */ @SuppressWarnings("unchecked") @Deprecated @Compat public static CacheFactory getInstance() { return new DefaultCacheFactory(); }
public Cache<K, V> createCache(String configFileName) throws ConfigurationException { return createCache(configFileName, true); }
/** * Create a cache using the given settings and properties. * * @param settings The Hibernate settings * @param properties The configuration properties * @return The created cache */ protected Cache createSharedCache(Settings settings, Properties properties) { String configResource = PropertiesHelper.getString(CACHE_RESOURCE_PROP, properties, null); if (configResource == null) { configResource = PropertiesHelper.getString(LEGACY_CACHE_RESOURCE_PROP, properties, DEFAULT_CACHE_RESOURCE); } return new DefaultCacheFactory().createCache(configResource, false); }
@Override public void afterPropertiesSet() throws Exception { final CacheFactory<String, Ticket> cf = new DefaultCacheFactory<>(); this.cache = cf.createCache(this.configLocation.getInputStream()); }
public Cache<K, V> createCache() throws ConfigurationException { return createCache(true); }
CacheSPI cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(configFileName); ConsoleListener listener = new ConsoleListener(cache); listener.listen();
Configuration config = new Configuration(); config.setCacheMode(LOCAL); Cache cache = new DefaultCacheFactory().createCache(config, false); ...
public Cache<K, V> createCache(boolean start) throws ConfigurationException { return createCache(new Configuration(), start); }
public void init() throws SipCacheException { String pojoConfigurationPath = configProperties.getProperty(JBOSS_CACHE_CONFIG_PATH, DEFAULT_FILE_CONFIG_PATH); if (clusteredlogger.isLoggingEnabled(StackLogger.TRACE_INFO)) { clusteredlogger.logInfo( "Mobicents JAIN SIP JBoss Cache Configuration path is : " + pojoConfigurationPath); } try { cache = new DefaultCacheFactory<String, SIPDialog>().createCache(pojoConfigurationPath); cache.create(); cacheListener = new JBossJainSipCacheListener(clusteredSipStack); cache.addCacheListener(cacheListener); } catch (Exception e) { throw new SipCacheException("Couldn't init JBoss Cache", e); } }
protected void constructCache() throws ConfigurationException { log.debug("Constructing Cache"); CacheFactory<K, V> cf = new DefaultCacheFactory<K, V>(); setCache(cf.createCache(config, false)); }
public Cache<K, V> createCache(InputStream is, boolean start) throws ConfigurationException { XmlConfigurationParser parser = new XmlConfigurationParser(); Configuration c = parser.parseStream(is); return createCache(c, start); }
cache = (CacheSPI) new DefaultCacheFactory<Object, Object>().createCache(this.config);
public void start() { CacheFactory<String, Object> factory = new DefaultCacheFactory<>(); String configFileName = CONFIG_PATH; _cache = factory.createCache(configFileName, false); _cache.create(); _cache.start(); } }
public Cache<K, V> createCache(InputStream is) throws ConfigurationException { XmlConfigurationParser parser = new XmlConfigurationParser(); Configuration c = null; try { c = parser.parseStream(is); } catch (ConfigurationException e) { XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x(); c = oldParser.parseStream(is); if (c != null && log.isInfoEnabled()) log.info("Detected legacy configuration file format when parsing configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for details."); } return createCache(c); }