target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testMatchPropertyTokensProperlyFormedTwoUnique() { String example = "<cacheManagerPeerProviderFactory class=\"net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory\"" + "properties=\"peerDiscovery=automatic, " + "multicastGroupAddress=${multicastAddress}\n, " + "multicastGroupPort=4446, timeT... | static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return propertyTokens; } | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... |
@Test public void testMatchPropertyTokensNotClosed() { String example = "<cacheManagerPeerProviderFactory class=\"net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory\"" + "properties=\"peerDiscovery=automatic, " + "multicastGroupAddress=${multicastAddress\n, " + "multicastGroupPort=4446, timeToLive=${multica... | static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return propertyTokens; } | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... | ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } return property... |
@Test public void testCopyConfiguration() { File file = new File(TEST_CONFIG_DIR + "ehcache-copy.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache copyOnReadCache = configurationHelper.cr... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testElementValueComparatorConfiguration() { File file = new File(TEST_CONFIG_DIR + "ehcache-comparator.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache cache = configur... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaConfiguration() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals("tc", config... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testObjectMapping() throws IOException { EhcacheObjectMapperProvider provider = new EhcacheObjectMapperProvider(); ObjectMapper om = provider.getContext(AgentEntity.class); String output = om.writer().writeValueAsString(new AgentEntity()); Assert.assertEquals("{\"agentId\":null,\"cacheManagers\":null}... | public ObjectMapper getContext(Class<?> arg0) { return om; } | EhcacheObjectMapperProvider implements ContextResolver<ObjectMapper> { public ObjectMapper getContext(Class<?> arg0) { return om; } } | EhcacheObjectMapperProvider implements ContextResolver<ObjectMapper> { public ObjectMapper getContext(Class<?> arg0) { return om; } EhcacheObjectMapperProvider(); } | EhcacheObjectMapperProvider implements ContextResolver<ObjectMapper> { public ObjectMapper getContext(Class<?> arg0) { return om; } EhcacheObjectMapperProvider(); ObjectMapper getContext(Class<?> arg0); } | EhcacheObjectMapperProvider implements ContextResolver<ObjectMapper> { public ObjectMapper getContext(Class<?> arg0) { return om; } EhcacheObjectMapperProvider(); ObjectMapper getContext(Class<?> arg0); } |
@Test(expected = ClassNotFoundException.class) public void contentOfTheJarNotVisibleWithNormalClassLoaderTest() throws ClassNotFoundException { Class<?> simpleClass = testCaseClassLoader.loadClass("pof.Simple"); } | @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) { resolveClass(c); } return c; } | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... |
@Test public void workingWithClassFromPrivateClassPathTest() throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { ResourceClassLoader resourceClassLoader = new ResourceClassLoader("priv... | @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) { resolveClass(c); } return c; } | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... | ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) ... |
@Test public void testTerracottaEmbeddedConfig() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-tc-embedded.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals("tc", conf... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testJMXConnectorServer() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); int registryPort = startRegistry(50000, 60000, 100); JMXServiceURL url = new JMXServiceURL("service:jmx:rmi: JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnect... | public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws CacheException { ManagementService registry = new Manageme... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... |
@Test public void testTerracottaEmbeddedXsdConfig() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-tc-embedded-xsd.xml"); Configuration configuration = ConfigurationFactory .parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper( manager, configuration); assertEquals("... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaInvalidConfig1() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-invalid1.xml"); try { Configuration configuration = ConfigurationFactory.parseConfiguration(file); fail("expecting exception to be thrown"); } catch (CacheException e) { assertTrue(e.getMessage().con... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaInvalidConfig2() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-invalid2.xml"); try { Configuration configuration = ConfigurationFactory.parseConfiguration(file); fail("expecting exception to be thrown"); } catch (CacheException e) { assertTrue(e.getMessage().con... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaConfigRMIReplication() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-rmi.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); List configs = configuration.getCacheConfigurations().get("clustered").getCacheEventListenerConfiguration... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaConfigJGroupsReplication() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-jgroups.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); List configs = configuration.getCacheConfigurations().get("clustered").getCacheEventListenerConfi... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTerracottaInvalidConfig5() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-jms.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); List configs = configuration.getCacheConfigurations().get("clustered").getCacheEventListenerConfigurations(); a... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testElementValueComparatorConfiguration() { File file = new File(TEST_CONFIG_DIR + "ehcache-comparator.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache cache = configur... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testMonitoringOn() { File file = new File(TEST_CONFIG_DIR + "ehcache-monitoring-on.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(Configuration.Monitoring.ON, co... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testWriterConfig() { File file = new File(TEST_CONFIG_DIR + "ehcache-writer.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); CacheWriterConfiguration defaultCacheWriterConfig =... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testMonitoringOff() { File file = new File(TEST_CONFIG_DIR + "ehcache-monitoring-off.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(Configuration.Monitoring.OFF,... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testValidStoreConfigElements() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-store.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); CacheConfiguration cacheConfiguration = configuration.getCacheConfigurations().get("offheap1"); assertEquals(16777... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testTransactionalMode() { CacheConfiguration configuration = new CacheConfiguration(); assertEquals(CacheConfiguration.TransactionalMode.OFF, configuration.getTransactionalMode()); try { configuration.setTransactionalMode(null); fail("expected IllegalArgumentException"); } catch (IllegalArgumentExcept... | public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } | CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } } | CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); } | CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String... | CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String... |
@Test public void testSynchronousWritesPersistenceConfiguration() { CacheConfiguration configuration = new CacheConfiguration("Test", 10).persistence(new PersistenceConfiguration() .strategy(Strategy.LOCALTEMPSWAP).synchronousWrites(true)); try { cacheManager.addCache(new Cache(configuration)); fail("Expected InvalidCo... | public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } | CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } } | CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); } | CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void ... | CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void ... |
@Test public void testReturnsPinnedKeysThatArePresent() { assertThat(map.get(1), notNullValue()); assertThat(map.get(2), notNullValue()); assertThat(map.get(3), notNullValue()); assertThat(map.get(4), notNullValue()); } | public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } } | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... |
@Test public void testDoesNotReturnsPinnedKeysThatAreNotPresent() { assertThat(map.get(0), nullValue()); assertThat(map.get(5), nullValue()); } | public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } } | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... | SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final Registered... |
@Test public void testMonitoringAutodetect() { File file = new File(TEST_CONFIG_DIR + "ehcache-monitoring-autodetect.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(Configuration.M... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testWriterConfig() { File file = new File(TEST_CONFIG_DIR + "ehcache-writer.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); CacheWriterConfiguration defaultCacheWriterConfig =... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testSupportsDecoratedCaches() { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); net.sf.ehcache.Cache cache = new net.sf.ehcache.Cache(new net.sf.ehcache.config.CacheConfiguration("decoratedCache", 1000)); BlockingCache blockingCache = new BlockingCache(cache); man... | public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws CacheException { ManagementService registry = new Manageme... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... | ManagementService implements CacheManagerEventListener { public static void registerMBeans( net.sf.ehcache.CacheManager cacheManager, MBeanServer mBeanServer, boolean registerCacheManager, boolean registerCaches, boolean registerCacheConfigurations, boolean registerCacheStatistics, boolean registerCacheStores) throws C... |
@Test public void testCantSwitchPool() throws Exception { Configuration configuration = new Configuration(); CacheManager cacheManager = new CacheManager(configuration.maxBytesLocalHeap(10, MemoryUnit.MEGABYTES).name("new-cacheManager")); CacheConfiguration cacheConfiguration = new CacheConfiguration("one", 0); cacheMa... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test(expected = InvalidConfigurationException.class) public void testLocalHeapCantSwitchToCountBased() { manager.addCache(new Cache(new CacheConfiguration().name("sizeBased").maxBytesLocalHeap(10, MemoryUnit.MEGABYTES))); Cache sizeBased = manager.getCache("sizeBased"); sizeBased.getCacheConfiguration().setMaxEntriesL... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test(expected = InvalidConfigurationException.class) public void testLocalHeapCantSwitchToSizeBased() { manager.addCache(new Cache(new CacheConfiguration().name("countBased").maxEntriesLocalHeap(10))); Cache sizeBased = manager.getCache("countBased"); sizeBased.getCacheConfiguration().maxBytesLocalHeap(10, MemoryUnit.... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test(expected = InvalidConfigurationException.class) public void testLocalDiskCantSwitchToCountBased() { manager.addCache(new Cache(new CacheConfiguration().name("sizeBased").maxBytesLocalDisk(10, MemoryUnit.MEGABYTES))); Cache sizeBased = manager.getCache("sizeBased"); sizeBased.getCacheConfiguration().setMaxEntriesL... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test(expected = InvalidConfigurationException.class) public void testLocalDiskCantSwitchToSizeBased() { manager.addCache(new Cache(new CacheConfiguration().name("countBased").maxEntriesLocalDisk(10))); Cache sizeBased = manager.getCache("countBased"); sizeBased.getCacheConfiguration().maxBytesLocalDisk(10, MemoryUnit.... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test public void testAdjustsPoolSizeDynamically() throws Exception { Configuration configuration = new Configuration(); CacheManager cacheManager = new CacheManager(configuration.maxBytesLocalHeap(10, MemoryUnit.MEGABYTES).name("new-cacheManager")); CacheConfiguration cacheConfiguration = new CacheConfiguration("three... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test public void testMultipleDispose() { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); manager.addCache(cache); cache.dispose(); for (int i = 0; i < 10; i++) { cache.dispose(); } } | public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null) { executorService.shutdown(); } disposeRegistered... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... | Cache implements InternalEhcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (bootstrapCacheLoader != null && bootstrapCacheLoader instanceof Disposable) { ((Disposable)bootstrapCacheLoader).dispose(); } if (executorService != null)... |
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised")... | public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } | Cache implements InternalEhcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } } | Cache implements InternalEhcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfigur... | Cache implements InternalEhcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfigur... | Cache implements InternalEhcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfigur... |
@Test public void testListenForAttributeParsing() { File file = new File(TEST_CONFIG_DIR + "ehcache-listener-scope.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); helpTestListenFor(configuration, "listenDefault", NotificationScope.ALL); helpTestListenFor(configuration, "listenAll", N... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testAutoOverflowsToDisk() { manager.addCache(new Cache(new CacheConfiguration("overflow1", 10).maxBytesLocalDisk(10, MemoryUnit.MEGABYTES))); assertThat(manager.getCache("overflow1").getCacheConfiguration().isOverflowToDisk(), is(true)); CacheManager cacheManager = new CacheManager(new Configuration()... | public CacheConfiguration getCacheConfiguration() { return configuration; } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } } | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... | Cache implements InternalEhcache, StoreListener { public CacheConfiguration getCacheConfiguration() { return configuration; } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventListeners,
BootstrapCacheLoa... |
@Test public void testInitialiseFailures() { final String name = "testInitialiseFailures2"; Cache cache = new Cache(name, 1, false, false, 5, 1); manager.addCache(cache); try { cache.initialise(); fail("Calling cache.initialise() multiple times should fail with IllegalStateException"); } catch (IllegalStateException e)... | public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMaxBytesLocalHeap() > 0) { PoolEvictor<PoolableStore... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... | Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa... |
@Test public void testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); RetryAssert.assertBy(1, TimeUnit.SECONDS, new GetCacheDiskSize(cache), is(1... | public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } | Cache implements InternalEhcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } } | Cache implements InternalEhcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(Ca... | Cache implements InternalEhcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(Ca... | Cache implements InternalEhcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(Ca... |
@Test public void testCloneFailures() throws Exception { Cache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); manager.addCache(cache); try { cache.clone(); fail("Should have thrown CloneNotSupportedException"); } catch (CloneNotSupportedException e) { } } | @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(copy); copy.sampledCacheStatistics = new S... | Cache implements InternalEhcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatistics... | Cache implements InternalEhcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatistics... | Cache implements InternalEhcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatistics... | Cache implements InternalEhcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatistics... |
@Test public void testToString() { Ehcache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); assertTrue(cache.toString().indexOf("testGetMemoryStore") > -1); } | @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOverflow... | Cache implements InternalEhcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" o... | Cache implements InternalEhcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" o... | Cache implements InternalEhcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" o... | Cache implements InternalEhcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" o... |
@Test public void testEquals() throws CacheException, InterruptedException, ExecutionException, NoSuchFieldException, IllegalAccessException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Assume.assumeThat(cache.getStore(), IsInstanceOf.instanceOf(FrontEndCacheTier.clas... | @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } | Cache implements InternalEhcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } } | Cache implements InternalEhcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(Cache... | Cache implements InternalEhcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(Cache... | Cache implements InternalEhcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(Cache... |
@Test public void testIsKeyInCache() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); as... | public boolean isKeyInCache(Object key) { if (key == null) { return false; } return compoundStore.containsKey(key); } | Cache implements InternalEhcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return compoundStore.containsKey(key); } } | Cache implements InternalEhcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return compoundStore.containsKey(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... | Cache implements InternalEhcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return compoundStore.containsKey(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... | Cache implements InternalEhcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return compoundStore.containsKey(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... |
@Test public void testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"... | public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } } | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... |
@Test public void testGetWithLoader() { class TestCacheLoader implements CacheLoader { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException { return null; } public String getName() { ret... | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... |
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu... | Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = is... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... |
@Test public void testValidStoreConfigElements() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-store.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); CacheConfiguration cacheConfiguration = configuration.getCacheConfigurations().get("offheap1"); assertEquals(16777... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul... |
@Test public void testAsynchronousLoadAll() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService();... | Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key); } } Map<?, ?> map = loadWithRegisteredLo... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... |
@Test public void testProgrammaticConfigurationFailsProperlyWhenNoDefaultCacheConfigured() { Configuration mgrConfig = new Configuration(); mgrConfig.setUpdateCheck(false); new CacheManager(mgrConfig).shutdown(); } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testForCacheManagerThreadLeak() throws CacheException, InterruptedException { final Collection<Thread> initialThreads = Collections.unmodifiableCollection(JVMUtil.enumerateThreads()); URL configuration = this.getClass().getResource("/ehcache-2.xml"); for (int i = 0; i < 100; i++) { new CacheManager(co... | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testGetCache() throws CacheException { CacheManager manager = CacheManager.create(); try { Ehcache cache = manager.getCache("sampleCache1"); assertNotNull(cache); } finally { manager.shutdown(); } } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... |
@Test public void testRemoveCache() throws CacheException { CacheManager manager = CacheManager.create(); try { assertEquals(15, manager.getConfiguration().getCacheConfigurations().size()); Ehcache cache = manager.getCache("sampleCache1"); assertNotNull(cache); manager.removeCache("sampleCache1"); cache = manager.getCa... | public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(cache.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(c... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(c... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(c... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg.removeCache(c... |
@Test public void testAddCache() throws CacheException { CacheManager manager = CacheManager.create(); try { assertEquals(15, manager.getConfiguration().getCacheConfigurations().size()); manager.addCache("test"); manager.addCache("test2"); assertEquals(17, manager.getConfiguration().getCacheConfigurations().size()); Eh... | public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehcache clonedDefa... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... |
@Test public void testAddCacheIfAbsent() { CacheManager manager = CacheManager.create(); try { manager.addCache("present"); assertTrue(manager.getCache("present") == manager.addCacheIfAbsent(new Cache(new CacheConfiguration("present", 1000)))); Cache theCache = new Cache(new CacheConfiguration("absent", 1000)); Ehcache... | public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... |
@Test public void testMultipleCacheManagers() { CacheManager[] managers = new CacheManager[2]; managers[0] = new CacheManager(makeCacheManagerConfig("cm1")); try { managers[1] = new CacheManager(makeCacheManagerConfig("cm2")); managers[1].shutdown(); } finally { managers[0].shutdown(); } } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testDiskStorePath() { String name = "testTemp"; String path = "c:\\something\\temp"; CacheConfiguration cacheConfiguration = new CacheConfiguration() .name(name) .diskStorePath(path) .diskPersistent(true); cacheManager.addCache(new Cache(cacheConfiguration)); Cache cache = cacheManager.getCache(name);... | public final CacheConfiguration diskStorePath(String diskStorePath) { setDiskStorePath(diskStorePath); return this; } | CacheConfiguration implements Cloneable { public final CacheConfiguration diskStorePath(String diskStorePath) { setDiskStorePath(diskStorePath); return this; } } | CacheConfiguration implements Cloneable { public final CacheConfiguration diskStorePath(String diskStorePath) { setDiskStorePath(diskStorePath); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxElementsInMemory); } | CacheConfiguration implements Cloneable { public final CacheConfiguration diskStorePath(String diskStorePath) { setDiskStorePath(diskStorePath); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxElementsInMemory); @Override CacheConfiguration clone(); final void setName(String name); final Ca... | CacheConfiguration implements Cloneable { public final CacheConfiguration diskStorePath(String diskStorePath) { setDiskStorePath(diskStorePath); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxElementsInMemory); @Override CacheConfiguration clone(); final void setName(String name); final Ca... |
@Test public void testStripingDistribution() { int[] lockIndexes = new int[2048]; for (int i = 0; i < 20480 * 3; i++) { String key = "" + i * 3 / 2 + i; key += key.hashCode(); int lock = ConcurrencyUtil.selectLock(key, 2048); lockIndexes[lock]++; } int outliers = 0; for (int i = 0; i < 2048; i++) { if (20 <= lockIndexe... | public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... |
@Test public void testNullKey() { ConcurrencyUtil.selectLock(null, 2048); ConcurrencyUtil.selectLock("", 2048); } | public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... |
@Test public void testEvenLockNumber() { try { ConcurrencyUtil.selectLock("anything", 100); } catch (CacheException e) { } } | public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... | ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ... |
@Test public void testMultipleDispose() { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); manager.addCache(cache); cache.dispose(); for (int i = 0; i < 10; i++) { cache.dispose(); } } | public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); registeredEventListeners.dispose(); if (cacheW... | Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi... | Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi... | Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi... | Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi... |
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised")... | public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } | Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } } | Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); ... | Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); ... | Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.isUninitialized()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); ... |
@Test public void testInitialiseFailures() { final String name = "testInitialiseFailures2"; Cache cache = new Cache(name, 1, false, false, 5, 1); cache.initialise(); try { cache.initialise(); fail("Calling cache.initialise() multiple times should fail with IllegalStateException"); } catch (IllegalStateException e) { if... | public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0) { LOG.warn("Cache: " + configuration.getN... | Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... |
@Test public void testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); Thread.sleep(100); assertEquals(0, cache.getDiskStoreSize()); assertEquals(... | public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } } | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... |
@Test public void testNotifyCacheRemovedDoesNotCallWhenNotRegistered() { MBeanServer server = mock(MBeanServer.class); when(server.isRegistered(any(ObjectName.class))).thenReturn(true); net.sf.ehcache.CacheManager cm = mock(net.sf.ehcache.CacheManager.class); when(cm.toString()).thenReturn("cmName"); ManagementService ... | public void notifyCacheRemoved(String cacheName) { if (registerCaches) { unregisterMBean(Cache.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheConfigurations) { unregisterMBean(CacheConfiguration.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheStatistics... | ManagementService implements CacheManagerEventListener { public void notifyCacheRemoved(String cacheName) { if (registerCaches) { unregisterMBean(Cache.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheConfigurations) { unregisterMBean(CacheConfiguration.createObjectName(backingCacheManag... | ManagementService implements CacheManagerEventListener { public void notifyCacheRemoved(String cacheName) { if (registerCaches) { unregisterMBean(Cache.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheConfigurations) { unregisterMBean(CacheConfiguration.createObjectName(backingCacheManag... | ManagementService implements CacheManagerEventListener { public void notifyCacheRemoved(String cacheName) { if (registerCaches) { unregisterMBean(Cache.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheConfigurations) { unregisterMBean(CacheConfiguration.createObjectName(backingCacheManag... | ManagementService implements CacheManagerEventListener { public void notifyCacheRemoved(String cacheName) { if (registerCaches) { unregisterMBean(Cache.createObjectName(backingCacheManager.toString(), cacheName)); } if (registerCacheConfigurations) { unregisterMBean(CacheConfiguration.createObjectName(backingCacheManag... |
@Test public void testCloneFailures() throws Exception { Cache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); manager.addCache(cache); try { cache.clone(); fail("Should have thrown CloneNotSupportedException"); } catch (CloneNotSupportedException e) { } } | @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(copy); copy.sampledCacheStatistics = new S... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... |
@Test public void testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); RetryAssert.assertBy(1, TimeUnit.SECONDS, new GetCacheDiskSize(cache), is(0... | public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } } | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... | Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi... |
@Test public void testToString() { Ehcache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); assertTrue(cache.toString().indexOf("testGetMemoryStore") > -1); assertEquals(460, cache.toString().length()); } | @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOverflow... | Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT... | Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT... | Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT... | Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT... |
@Test public void testEquals() throws CacheException, InterruptedException, ExecutionException, NoSuchFieldException, IllegalAccessException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2... | @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } } | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... |
@Test public void testProgrammaticConfigurationWorksProperlyWhenNoDefaultCacheConfigured() { Configuration mgrConfig = new Configuration(); mgrConfig.setUpdateCheck(false); new CacheManager(mgrConfig).shutdown(); } | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... |
@Test public void testForCacheManagerThreadLeak() throws CacheException, InterruptedException { final Set<Thread> initialThreads = Collections.unmodifiableSet(Thread.getAllStackTraces().keySet()); Configuration config = new Configuration(); config.diskStore(new DiskStoreConfiguration().path("java.io.tmpdir/CacheManager... | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... |
@Test public void testGetCache() throws CacheException { CacheManager manager = new CacheManager(new Configuration().cache(new CacheConfiguration("foo", 100))); try { assertNotNull(manager.getCache("foo")); } finally { manager.shutdown(); } } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... |
@Test public void testEquals() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); Element ... | @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } } | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... | Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur... |
@Test public void testRemoveCache() throws CacheException { Configuration config = new Configuration().cache(new CacheConfiguration("foo", 100)); CacheManager manager = new CacheManager(config); try { assertEquals(1, manager.getConfiguration().getCacheConfigurations().size()); assertNotNull(manager.getCache("foo")); ma... | public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheConfigurations().... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... |
@Test public void testAddCache() throws CacheException { Configuration config = new Configuration().defaultCache(new CacheConfiguration().maxElementsInMemory(0)); CacheManager manager = new CacheManager(config); try { assertEquals(0, manager.getConfiguration().getCacheConfigurations().size()); manager.addCache("test");... | public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehcache clonedDefa... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... |
@Test public void testAddCacheIfAbsent() { Configuration config = new Configuration().defaultCache(new CacheConfiguration().maxElementsInMemory(100)); CacheManager manager = new CacheManager(config); try { manager.addCache("present"); assertThat(manager.addCacheIfAbsent(new Cache(new CacheConfiguration("present", 1000)... | public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... |
@Test public void testMultipleCacheManagers() { CacheManager managerOne = new CacheManager(makeCacheManagerConfig()); try { new CacheManager(makeCacheManagerConfig()).shutdown(); } finally { managerOne.shutdown(); } } | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... |
@Test public void testIsKeyInCache() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); as... | public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } | Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } } | Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
Registered... | Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
Registered... | Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
Registered... |
@Test public void testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"... | public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } | Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } } | Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registere... | Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registere... | Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registere... |
@Test public void testGetWithLoader() { class TestCacheLoader implements CacheLoader { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException { return null; } public String getName() { ret... | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element... | Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k... | Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k... | Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k... | Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k... |
@Test public void testCacheMustBeInactiveByDefault() { Assert.assertFalse(wanAwareCache.isReady()); } | public boolean isReady() { Boolean active = (Boolean) configMap.get(CACHE_ACTIVE_KEY); if (isMasterCache()) { return active != null && active; } return active != null && active && (isOrchestratorAlive() || !bidirectional); } | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isReady() { Boolean active = (Boolean) configMap.get(CACHE_ACTIVE_KEY); if (isMasterCache()) { return active != null && active; } return active != null && active && (isOrchestratorAlive() || !bidirectional); } } | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isReady() { Boolean active = (Boolean) configMap.get(CACHE_ACTIVE_KEY); if (isMasterCache()) { return active != null && active; } return active != null && active && (isOrchestratorAlive() || !bidirectional); } WanAwareToolkitCache(f... | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isReady() { Boolean active = (Boolean) configMap.get(CACHE_ACTIVE_KEY); if (isMasterCache()) { return active != null && active; } return active != null && active && (isOrchestratorAlive() || !bidirectional); } WanAwareToolkitCache(f... | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isReady() { Boolean active = (Boolean) configMap.get(CACHE_ACTIVE_KEY); if (isMasterCache()) { return active != null && active; } return active != null && active && (isOrchestratorAlive() || !bidirectional); } WanAwareToolkitCache(f... |
@Test public void testAddCacheEntityInfo() { factory.addCacheEntityInfo(CACHE_NAME, new CacheConfiguration(), "testTKCacheName"); } | void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", cacheName)); } logCacheConfigInTerracottaClientLogs(cacheName, e... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... |
@Test public void testRetrievingExistingClusteredCacheManagerEntity() { String name = "existing"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); Toolkit toolkit = getMockToolkit(); when(toolkit.getMap(anyString(), eq(String.class), eq(ClusteredCache.class))).thenReturn(mo... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testCreatingNewClusteredCacheManagerEntity() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); doAnswer(new Answer() { @Override public Object answe... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testTryingToCreateNewClusteredCacheManagerEntityButLooseRace() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); when(clusteredEntityManager.addRoot... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testConfigurationSavedContainsNoCachesAnymore() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testConfigurationSavedContainsCacheManagerName() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); configuration.addCache(new CacheConfiguration("test", 1)); Toolkit toolkit = getMockToolkit(); ClusteredEntityManager clusteredEntity... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getR... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration); ClusteredC... |
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu... | Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoader == null) { if (registered... | Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if... | Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if... | Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if... | Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if... |
@Test public void testClusterRejoined() { Toolkit toolkit = getMockToolkit(); ClusteredEntityManager entityManager = mock(ClusteredEntityManager.class); ClusteredCacheManager cmEntity = mock(ClusteredCacheManager.class); ClusteredCache cEntity = mock(ClusteredCache.class); when(cmEntity.getCache(CACHE_NAME)).thenReturn... | @Override public void clusterRejoined() { String cacheManagerName = entityNames.cacheManagerName; synchronized (entityNames) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { LOGGER.error("Cache Manag... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void clusterRejoined() { String cacheManagerName = entityNames.cacheManagerName; synchronized (entityNames) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void clusterRejoined() { String cacheManagerName = entityNames.cacheManagerName; synchronized (entityNames) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void clusterRejoined() { String cacheManagerName = entityNames.cacheManagerName; synchronized (entityNames) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void clusterRejoined() { String cacheManagerName = entityNames.cacheManagerName; synchronized (entityNames) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);... |
@Test public void testAsynchronousLoadAll() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService();... | Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key); } } Map map = loadWithRegisteredLoaders(... | Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)... | Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)... | Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)... | Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)... |
@Test public void testForCacheManagerThreadLeak() throws CacheException, InterruptedException { int startingThreadCount = countThreads(); URL secondCacheConfiguration = this.getClass().getResource( "/ehcache-2.xml"); for (int i = 0; i < 100; i++) { instanceManager = new CacheManager(secondCacheConfiguration); instanceM... | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... |
@Test public void testCacheManagerThreads() throws CacheException, InterruptedException { singletonManager = CacheManager .create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache-big.xml"); int threads = countThreads(); assertTrue("More than 145 threads: " + threads, countThreads() <= 145); } | public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to create an existing singleton... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to create an exi... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to create an exi... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to create an exi... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to create an exi... |
@Test public void testNullClusteredInstanceFactoryForUnclusteredMode() throws Exception { TerracottaClient terracottaClient = mock(TerracottaClient.class); DelegatingManagementEventSink delegatingManagementEventSink = new DelegatingManagementEventSink(terracottaClient); delegatingManagementEventSink.sendManagementEvent... | @Override public void sendManagementEvent(Serializable event, String type) { ManagementEventSink sink = get(); if (sink != null) { sink.sendManagementEvent(event, type); } } | DelegatingManagementEventSink implements ManagementEventSink { @Override public void sendManagementEvent(Serializable event, String type) { ManagementEventSink sink = get(); if (sink != null) { sink.sendManagementEvent(event, type); } } } | DelegatingManagementEventSink implements ManagementEventSink { @Override public void sendManagementEvent(Serializable event, String type) { ManagementEventSink sink = get(); if (sink != null) { sink.sendManagementEvent(event, type); } } DelegatingManagementEventSink(TerracottaClient terracottaClient); } | DelegatingManagementEventSink implements ManagementEventSink { @Override public void sendManagementEvent(Serializable event, String type) { ManagementEventSink sink = get(); if (sink != null) { sink.sendManagementEvent(event, type); } } DelegatingManagementEventSink(TerracottaClient terracottaClient); @Override void se... | DelegatingManagementEventSink implements ManagementEventSink { @Override public void sendManagementEvent(Serializable event, String type) { ManagementEventSink sink = get(); if (sink != null) { sink.sendManagementEvent(event, type); } } DelegatingManagementEventSink(TerracottaClient terracottaClient); @Override void se... |
@Test public void testGetCache() throws CacheException { instanceManager = CacheManager.create(); Ehcache cache = instanceManager.getCache("sampleCache1"); assertNotNull(cache); } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL... |
@Test public void testRemoveCache() throws CacheException { singletonManager = CacheManager.create(); assertEquals(15, singletonManager.getConfiguration().getCacheConfigurations().size()); Ehcache cache = singletonManager.getCache("sampleCache1"); assertNotNull(cache); singletonManager.removeCache("sampleCache1"); cach... | public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheConfigurations().... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configuration.getCacheCo... |
@Test public void testAddCache() throws CacheException { singletonManager = CacheManager.create(); assertEquals(15, singletonManager.getConfiguration().getCacheConfigurations().size()); singletonManager.addCache("test"); singletonManager.addCache("test2"); assertEquals(17, singletonManager.getConfiguration().getCacheCo... | public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehcache clonedDefa... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... | CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already exists"); } Ehc... |
@Test public void testAddCacheIfAbsent() { singletonManager = CacheManager.create(); singletonManager.addCache("present"); assertTrue(singletonManager.getCache("present") == singletonManager.addCacheIfAbsent(new Cache(new CacheConfiguration("present", 1000)))); Cache theCache = new Cache(new CacheConfiguration("absent"... | public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } } | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... | CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInputStr... |
@Test public void testMultipleCacheManagers() { CacheManager[] managers = new CacheManager[2]; managers[0] = new CacheManager(makeCacheManagerConfig()); managers[1] = new CacheManager(makeCacheManagerConfig()); managers[0].shutdown(); managers[1].shutdown(); } | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider.... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag... |
@Test public void testIsRegionCacheOrphanEvictionEnabled() { assertThat(stats.isRegionCacheOrphanEvictionEnabled("sampleCache1"), is(false)); } | public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEviction(); } else { return false; } } | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictio... |
@Test public void testGetRegionCacheOrphanEvictionPeriod() { assertThat(stats.getRegionCacheOrphanEvictionPeriod("sampleCache1"), is(-1)); } | public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPeriod(); } else { return -1; } } | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... | EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.