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 testGetCache() throws CacheException { instanceManager = CacheManager.create(); Ehcache cache = instanceManager.getCache("sampleCache1"); assertNotNull(cache); } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... |
@Test public void testRemoveCache() throws CacheException { singletonManager = CacheManager.create(); Ehcache cache = singletonManager.getCache("sampleCache1"); assertNotNull(cache); singletonManager.removeCache("sampleCache1"); cache = singletonManager.getCache("sampleCache1"); assertNull(cache); singletonManager.remo... | public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEventListenerRegi... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... |
@Test public void testAddCache() throws CacheException { singletonManager = CacheManager.create(); singletonManager.addCache("test"); singletonManager.addCache("test2"); Ehcache cache = singletonManager.getCache("test"); assertNotNull(cache); assertEquals("test", cache.getName()); String[] cacheNames = singletonManager... | 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 cache = nu... | 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 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 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 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 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 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 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 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 testMaximumDatagram() throws IOException { String payload = createReferenceString(); final byte[] compressed = PayloadUtil.gzip(payload.getBytes()); int length = compressed.length; LOG.info("gzipped size: " + length); assertTrue("Heartbeat too big for one Datagram " + length, length <= 1500); } | public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + ungzipped); } r... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + u... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + u... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + u... | PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could not gzip " + u... |
@Test public void testTerracottaConfigurationForWAN() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta-wan.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); assertEquals(true, configuration.getTerracottaConfiguration().isWanEnabledTSA()); } | 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 testLoadConfigurationFromClasspath() throws Exception { Configuration configuration = ConfigurationFactory.parseConfiguration(); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(null, configurationHelper.getConfigurationBean().getName()); assertEq... | 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 testLoadConfigurationFromFile() throws Exception { File file = new File(SRC_CONFIG_DIR + "ehcache.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(null, configurat... | 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 testLoadConfigurationFromFileDistribution() throws Exception { File file = new File(TEST_CONFIG_DIR + "distribution/ehcache-distributed1.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, 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 testToString() { Ehcache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); assertTrue(cache.toString().indexOf("testGetMemoryStore") > -1); assertEquals(410, cache.toString().length()); } | @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOverflowToDisk()) .append... | Cache implements Ehcache { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.... | Cache implements Ehcache { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.... | Cache implements Ehcache { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.... | Cache implements Ehcache { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.... |
@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 { 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 =... | Cache implements Ehcache { 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 =... | Cache implements Ehcache { 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 =... | Cache implements Ehcache { 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 =... |
@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 testGetCache() throws CacheException { instanceManager = CacheManager.create(); Ehcache cache = instanceManager.getCache("sampleCache1"); assertNotNull(cache); } | public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } } | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... | CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configurationInput... |
@Test public void testRemoveCache() throws CacheException { singletonManager = CacheManager.create(); Ehcache cache = singletonManager.getCache("sampleCache1"); assertNotNull(cache); singletonManager.removeCache("sampleCache1"); cache = singletonManager.getCache("sampleCache1"); assertNull(cache); singletonManager.remo... | public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEventListenerRegi... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... | CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); cacheManagerEv... |
@Test public void testAddCache() throws CacheException { singletonManager = CacheManager.create(); singletonManager.addCache("test"); singletonManager.addCache("test2"); Ehcache cache = singletonManager.getCache("test"); assertNotNull(cache); assertEquals("test", cache.getName()); String[] cacheNames = singletonManager... | 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 cache = nu... | 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 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 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 testMaxMemoryOffHeap() { CacheConfiguration configuration = new CacheConfiguration(); configuration.setMaxMemoryOffHeap("100m"); assertEquals("100m", configuration.getMaxMemoryOffHeap()); configuration.setMaxBytesLocalOffHeap("1G"); assertEquals("1G", configuration.getMaxMemoryOffHeap()); } | @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(Stri... | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(Stri... |
@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 testCreateElementDataForNonEternalElement() { ElementData elementData = valueModeHandler.createElementData(nonEternalElement); Assert.assertTrue(elementData instanceof NonEternalElementData); } | @Override public ElementData createElementData(Element element) { if(element.isEternal()) { return new EternalElementData(element); } else { return new NonEternalElementData(element); } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public ElementData createElementData(Element element) { if(element.isEternal()) { return new EternalElementData(element); } else { return new NonEternalElementData(element); } } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public ElementData createElementData(Element element) { if(element.isEternal()) { return new EternalElementData(element); } else { return new NonEternalElementData(element); } } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public ElementData createElementData(Element element) { if(element.isEternal()) { return new EternalElementData(element); } else { return new NonEternalElementData(element); } } @Override Object getRealKeyObject(String portableKey); @Override String... | ValueModeHandlerSerialization implements ValueModeHandler { @Override public ElementData createElementData(Element element) { if(element.isEternal()) { return new EternalElementData(element); } else { return new NonEternalElementData(element); } } @Override Object getRealKeyObject(String portableKey); @Override String... |
@Test public void testMaxEntriesInCacheBounds() { try { new CacheConfiguration().maxEntriesInCache(-1); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), CoreMatchers.containsString("maxEntriesInCache")); } } | public final CacheConfiguration maxEntriesInCache(long maxEntriesInCache) { setMaxEntriesInCache(maxEntriesInCache); return this; } | CacheConfiguration implements Cloneable { public final CacheConfiguration maxEntriesInCache(long maxEntriesInCache) { setMaxEntriesInCache(maxEntriesInCache); return this; } } | CacheConfiguration implements Cloneable { public final CacheConfiguration maxEntriesInCache(long maxEntriesInCache) { setMaxEntriesInCache(maxEntriesInCache); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); } | CacheConfiguration implements Cloneable { public final CacheConfiguration maxEntriesInCache(long maxEntriesInCache) { setMaxEntriesInCache(maxEntriesInCache); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String n... | CacheConfiguration implements Cloneable { public final CacheConfiguration maxEntriesInCache(long maxEntriesInCache) { setMaxEntriesInCache(maxEntriesInCache); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String n... |
@Test public void testRegistrationServiceFourTrue() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); assertEquals(OBJECTS_IN_TEST_EHCACHE, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); } | 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 testRegistrationServiceFourTrueUsing14MBeanServer() throws Exception { mBeanServer = create14MBeanServer(); ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); assertEquals(OBJECTS_IN_TEST_EHCACHE, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size(... | 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 testRegistrationServiceFourTrueUsing14MBeanServerWithConstructorInjection() throws Exception { mBeanServer = create14MBeanServer(); ManagementService managementService = new ManagementService(manager, mBeanServer, true, true, true, true, true); managementService.init(); assertEquals(OBJECTS_IN_TEST_EH... | public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cache cache = (Cache) caches.get(i); registerCachesIfRequired... | ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cach... | ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cach... | ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cach... | ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cach... |
@Test public void testRegistrationServiceListensForCacheChanges() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); assertEquals(OBJECTS_IN_TEST_EHCACHE, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); manager.addCache("new cache"); assert... | 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 testMultipleCacheManagers() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); assertEquals(OBJECTS_IN_TEST_EHCACHE, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); File file = new File(AbstractCacheTest.SRC_CONFIG_DIR + "... | 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 testStatisticsMBeanUpdatesAsStatsChange() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, false, false, false, true, false); Ehcache cache = manager.getCache("sampleCache1"); ObjectName name = CacheStatistics.createObjectName(manager.getName(), cache.getName()); assertEquals(... | 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 testRegistrationServiceThreeTrue() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, false, false); assertEquals(31, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); } | 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 testRegistrationServiceTwoTrue() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, false, false, false); assertEquals(16, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); } | 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 testRegistrationServiceOneTrue() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, false, false, false, false); assertEquals(1, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); } | 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 testRegistrationServiceNoneTrue() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, false, false, false, false, false); assertEquals(0, mBeanServer.queryNames(new ObjectName("net.sf.ehcache:*"), null).size()); } | 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 testRegisterCacheManager() throws Exception { Ehcache ehcache = new net.sf.ehcache.Cache("testNoOverflowToDisk", 1, false, false, 500, 200); manager.addCache(ehcache); ehcache.put(new Element("key1", "value1")); ehcache.put(new Element("key2", "value1")); assertNull(ehcache.get("key1")); assertNotNull... | private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectName()); } } | ManagementService implements CacheManagerEventListener { private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectName()); } } } | ManagementService implements CacheManagerEventListener { private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectName()); } } Man... | ManagementService implements CacheManagerEventListener { private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectName()); } } Man... | ManagementService implements CacheManagerEventListener { private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectName()); } } Man... |
@Test public void testListCachesFromManager() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, false, false, false, false); Ehcache ehcache = manager.getCache("sampleCache1"); ehcache.put(new Element("key1", "value1")); ehcache.put(new Element("key2", "value1")); assertNotNull(ehcache.get... | 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 testJMXConnectorServer() throws Exception { ManagementService.registerMBeans(manager, mBeanServer, true, true, true, true, true); LocateRegistry.createRegistry(55000); String serverUrl = "service:jmx:rmi: JMXServiceURL url = new JMXServiceURL(serverUrl); JMXConnectorServer cs = JMXConnectorServerFacto... | 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 testWarnTieredSizing() { final AtomicReference<String> ref = new AtomicReference<String>(); try { Class.forName("org.slf4j.impl.JDK14LoggerFactory"); } catch (ClassNotFoundException e) { fail("Could not load org.slf4j.impl.JDK14LoggerFactory, required for test to work. Is slf4j-jdk14 in test dependenc... | private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap. " + "This will result in useless off heap... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... |
@Test public void testRemoveCache() throws CacheException { singletonManager = CacheManager.create(); Ehcache cache = singletonManager.getCache("sampleCache1"); assertNotNull(cache); singletonManager.removeCache("sampleCache1"); cache = singletonManager.getCache("sampleCache1"); assertNull(cache); singletonManager.remo... | 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(); cacheManagerEventListenerRegistry.notif... | 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(); cacheManagerEventListene... | 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(); cacheManagerEventListene... | 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(); cacheManagerEventListene... | 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(); cacheManagerEventListene... |
@Test public void testAddCache() throws CacheException { singletonManager = CacheManager.create(); singletonManager.addCache("test"); singletonManager.addCache("test2"); Ehcache cache = singletonManager.getCache("test"); assertNotNull(cache); assertEquals("test", cache.getName()); String[] cacheNames = singletonManager... | 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 testSizeSumsAllCollections() { assertThat(keySet.size(), is(9)); } | public int size() { int size = 0; for (Collection keySet : keySets) { size += keySet.size(); } return size; } | CacheKeySet implements Set<E> { public int size() { int size = 0; for (Collection keySet : keySets) { size += keySet.size(); } return size; } } | CacheKeySet implements Set<E> { public int size() { int size = 0; for (Collection keySet : keySets) { size += keySet.size(); } return size; } CacheKeySet(final Collection<E>... keySets); } | CacheKeySet implements Set<E> { public int size() { int size = 0; for (Collection keySet : keySets) { size += keySet.size(); } return size; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(final T[] a)... | CacheKeySet implements Set<E> { public int size() { int size = 0; for (Collection keySet : keySets) { size += keySet.size(); } return size; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(final T[] a)... |
@Test public void testContainsIsSupported() { Set<Integer> keys = new HashSet<Integer>(keySet); for (Integer key : keys) { assertThat(keySet.contains(key), is(true)); } } | public boolean contains(final Object o) { for (Collection keySet : keySets) { if (keySet.contains(o)) { return true; } } return false; } | CacheKeySet implements Set<E> { public boolean contains(final Object o) { for (Collection keySet : keySets) { if (keySet.contains(o)) { return true; } } return false; } } | CacheKeySet implements Set<E> { public boolean contains(final Object o) { for (Collection keySet : keySets) { if (keySet.contains(o)) { return true; } } return false; } CacheKeySet(final Collection<E>... keySets); } | CacheKeySet implements Set<E> { public boolean contains(final Object o) { for (Collection keySet : keySets) { if (keySet.contains(o)) { return true; } } return false; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(... | CacheKeySet implements Set<E> { public boolean contains(final Object o) { for (Collection keySet : keySets) { if (keySet.contains(o)) { return true; } } return false; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(... |
@Test public void testSupportsEmptyKeySets() { final CacheKeySet cacheKeySet = new CacheKeySet(); assertThat(cacheKeySet.isEmpty(), is(true)); for (Object o : cacheKeySet) { fail("Shouldn't get anything!"); } } | public boolean isEmpty() { for (Collection keySet : keySets) { if (!keySet.isEmpty()) { return false; } } return true; } | CacheKeySet implements Set<E> { public boolean isEmpty() { for (Collection keySet : keySets) { if (!keySet.isEmpty()) { return false; } } return true; } } | CacheKeySet implements Set<E> { public boolean isEmpty() { for (Collection keySet : keySets) { if (!keySet.isEmpty()) { return false; } } return true; } CacheKeySet(final Collection<E>... keySets); } | CacheKeySet implements Set<E> { public boolean isEmpty() { for (Collection keySet : keySets) { if (!keySet.isEmpty()) { return false; } } return true; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(f... | CacheKeySet implements Set<E> { public boolean isEmpty() { for (Collection keySet : keySets) { if (!keySet.isEmpty()) { return false; } } return true; } CacheKeySet(final Collection<E>... keySets); int size(); boolean isEmpty(); boolean contains(final Object o); Iterator<E> iterator(); Object[] toArray(); T[] toArray(f... |
@Test public void testOnlyPopulatesOnce() throws InterruptedException, BrokenBarrierException { final int threadCount = Runtime.getRuntime().availableProcessors() * 2; final CachingTier<String, String> cache = new OnHeapCachingTier<String, String>(new CountBasedBackEnd<String, Object>(threadCount * 2)); final AtomicBoo... | @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new Fault<V>(source); cachedValue = backEnd.putIfAbse... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... | OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fault<V> f = new ... |
@Test public void testInlineEvictionNotified() { PoolAccessor onHeapAccessor = mock(PoolAccessor.class); when(onHeapAccessor.add(eq("key"), any(DiskStorageFactory.DiskSubstitute.class), any(HashEntry.class), eq(false))).thenReturn(-1L); RegisteredEventListeners cacheEventNotificationService = new RegisteredEventListene... | Element put(Object key, int hash, Element element, boolean onlyIfAbsent, boolean faulted) { boolean installed = false; DiskSubstitute encoded = disk.create(element); final long incomingHeapSize = onHeapPoolAccessor.add(key, encoded, NULL_HASH_ENTRY, cachePinned || faulted); if (incomingHeapSize < 0) { LOG.debug("put fa... | Segment extends ReentrantReadWriteLock { Element put(Object key, int hash, Element element, boolean onlyIfAbsent, boolean faulted) { boolean installed = false; DiskSubstitute encoded = disk.create(element); final long incomingHeapSize = onHeapPoolAccessor.add(key, encoded, NULL_HASH_ENTRY, cachePinned || faulted); if (... | Segment extends ReentrantReadWriteLock { Element put(Object key, int hash, Element element, boolean onlyIfAbsent, boolean faulted) { boolean installed = false; DiskSubstitute encoded = disk.create(element); final long incomingHeapSize = onHeapPoolAccessor.add(key, encoded, NULL_HASH_ENTRY, cachePinned || faulted); if (... | Segment extends ReentrantReadWriteLock { Element put(Object key, int hash, Element element, boolean onlyIfAbsent, boolean faulted) { boolean installed = false; DiskSubstitute encoded = disk.create(element); final long incomingHeapSize = onHeapPoolAccessor.add(key, encoded, NULL_HASH_ENTRY, cachePinned || faulted); if (... | Segment extends ReentrantReadWriteLock { Element put(Object key, int hash, Element element, boolean onlyIfAbsent, boolean faulted) { boolean installed = false; DiskSubstitute encoded = disk.create(element); final long incomingHeapSize = onHeapPoolAccessor.add(key, encoded, NULL_HASH_ENTRY, cachePinned || faulted); if (... |
@Test public void given_no_copy_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); assertThat(copyStrategyHandler.isCopyActive(), is(false)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } |
@Test public void testCacheMustBeInactiveByDefault() { Assert.assertFalse(wanAwareCache.isActive()); } | public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } | WanAwareToolkitCache implements BufferingToolkitCache<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } } | WanAwareToolkitCache implements BufferingToolkitCache<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final ToolkitMap<Stri... | WanAwareToolkitCache implements BufferingToolkitCache<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final ToolkitMap<Stri... | WanAwareToolkitCache implements BufferingToolkitCache<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final ToolkitMap<Stri... |
@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)); } ClusteredCache cacheEntity = clusteredCacheManage... | 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 = mock(Toolkit.class); when(toolkit.getMap(anyString(), eq(String.class), eq(ClusteredCache.class))).thenReturn... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ToolkitReadWriteLock... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... |
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ToolkitReadWriteLock... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... |
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ToolkitReadWriteLock... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... |
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ToolkitReadWriteLock... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... |
@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 = mock(Toolkit.class); ClusteredEntityManager clusteredEnt... | @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ToolkitReadWriteLock... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { if (clusteredCacheManagerEntity == null) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cache... |
@Test public void testClusterRejoined() { Toolkit toolkit = mock(Toolkit.class); ClusteredEntityManager entityManager = mock(ClusteredEntityManager.class); ClusteredCacheManager cmEntity = mock(ClusteredCacheManager.class); ClusteredCache cEntity = mock(ClusteredCache.class); when(cmEntity.getCache(CACHE_NAME)).thenRet... | @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 given_copy_on_read_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } |
@Test public void given_copy_on_write_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } |
@Test public void testCreateElementForEternalElement() { Element createdElement = valueModeHandler.createElement(KEY, new EternalElementData(eternalElement)); Assert.assertTrue(createdElement.isEternal()); } | @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } @Override Object getRealKeyObject(String portableKey); @Override String createPortableKey(Object key); @Override... | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } @Override Object getRealKeyObject(String portableKey); @Override String createPortableKey(Object key); @Override... |
@Test public void given_copy_on_read_and_write_when_isCopyActive_then_false() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.isCopyActive(), is(true)); } | boolean isCopyActive() { return copyOnRead || copyOnWrite; } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } | CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy, ClassLoader loader); Element copyElementForReadIfNeeded(Element element); } |
@Test public void given_no_copy_when_copyElementForReadIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(element), sameInstanc... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void given_no_copy_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void given_no_copy_when_copyElementForWriteIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(element), sameInsta... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_no_copy_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_no_copy_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(element), sameI... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void given_no_copy_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, false, null, loader); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void testSimpleCaseProgrammatic() { CacheManager manager = new CacheManager(); manager.removalAll(); manager.addCache(new Cache(new CacheConfiguration().name("test").eternal(true).maxEntriesLocalHeap(5000))); Ehcache cache = manager.getEhcache("test"); cache.registerCacheLoader(stupidCacheLoaderEvens); cac... | @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + unde... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... |
@Test public void testPolling() { CacheManager manager = new CacheManager(); manager.removalAll(); manager.addCache(new Cache(new CacheConfiguration().name("tt").eternal(true).maxEntriesLocalHeap(5000).overflowToDisk(false))); Ehcache cache = manager.getEhcache("tt"); stupidCacheLoaderEvens.setMsDelay(100); cache.regis... | @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + unde... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... | ScheduledRefreshCacheExtension implements CacheExtension { @Override public void init() { if (config.getUniqueNamePart() != null) { this.name = "scheduledRefresh_" + underlyingCache.getCacheManager().getName() + "_" + underlyingCache.getName() + "_" + config.getUniqueNamePart(); } else { this.name = "scheduledRefresh_"... |
@Test public void given_copy_on_read_when_copyElementForReadIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element, loader)).thenReturn(serial); when(copyStrategy.copyForRead(serial, load... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@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 testMaxMemoryOffHeap() { CacheConfiguration configuration = new CacheConfiguration(); configuration.setMaxMemoryOffHeap("100m"); assertEquals("100m", configuration.getMaxMemoryOffHeap()); configuration.setMaxBytesLocalOffHeap("1G"); assertEquals("1G", configuration.getMaxMemoryOffHeap()); } | @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); } | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(Stri... | CacheConfiguration implements Cloneable { @Deprecated public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(Stri... |
@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 given_copy_on_read_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void testOnHeapConsumption() throws Exception { SizeOf sizeOf = new CrossCheckingSizeOf(); int size = 80000; for (int j = 0; j < 5; j++) { container = new Object[size]; long usedBefore = measureMemoryUse(); for (int i = 0; i < size; i++) { container[i] = new EvilPair(new Object(), new SomeClass(i % 2 == 0)... | public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } } | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } SizeOf(SizeOfFilter fie... | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } SizeOf(SizeOfFilter fie... | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } SizeOf(SizeOfFilter fie... |
@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 evictor = new... | 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 given_copy_on_read_when_copyElementForWriteIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(element... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void testCreateElementForNonEternalElement() { Element createdElement = valueModeHandler.createElement(KEY, new NonEternalElementData(nonEternalElement)); Assert.assertFalse(createdElement.isEternal()); } | @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } } | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } @Override Object getRealKeyObject(String portableKey); @Override String createPortableKey(Object key); @Override... | ValueModeHandlerSerialization implements ValueModeHandler { @Override public Element createElement(Object key, Serializable value) { return value == null ? null : ((ElementData) value).createElement(key); } @Override Object getRealKeyObject(String portableKey); @Override String createPortableKey(Object key); @Override... |
@Test public void given_copy_on_read_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_copy_on_read_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(ele... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void testInitialiseFailures() { try { Cache cache = new Cache("testInitialiseFailures2", 1, false, false, 5, 1); cache.initialise(); cache.initialise(); fail("Should have thrown IllegalArgumentException"); } catch (IllegalStateException e) { } } | public void initialise() { synchronized (this) { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0) { LOG.warn("Cache: " + con... | Cache implements Ehcache { public void initialise() { synchronized (this) { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache { public void initialise() { synchronized (this) { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache { public void initialise() { synchronized (this) { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... | Cache implements Ehcache { public void initialise() { synchronized (this) { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)... |
@Test public void given_copy_on_read_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, false, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void given_copy_on_write_when_copyElementForReadIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(element)... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void given_copy_on_write_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void given_copy_on_write_when_copyElementForWriteIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element, loader)).thenReturn(serial); when(copyStrategy.copyForRead(serial, lo... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_copy_on_write_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_copy_on_write_when_copyElementForRemovalIfNeeded_with_Element_then_returns_same() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy, loader); Element element = new Element("key", "value"); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(el... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void given_copy_on_write_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(false, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void given_copy_on_read_and_write_when_copyElementForReadIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForRead(serial, loader)).thenReturn(new Element("key", "value")); CopyStrategyH... | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void clusteredStore_putIfAbsent_enabled_in_eventual_consistency() { clusteredStore.putIfAbsent(new Element("key", "value")); verify(toolkitCacheInternal).putIfAbsent(eq("key"), any(NonEternalElementData.class)); } | @Override public Element putIfAbsent(Element element) throws NullPointerException { String pKey = generatePortableKeyFor(element.getObjectKey()); ElementData value = valueModeHandler.createElementData(element); Serializable data = backend.putIfAbsent(pKey, value); return data == null ? null : this.valueModeHandler.crea... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { String pKey = generatePortableKeyFor(element.getObjectKey()); ElementData value = valueModeHandler.createElementData(element); Serializable data = backend.putIfAbsent(pKey, valu... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { String pKey = generatePortableKeyFor(element.getObjectKey()); ElementData value = valueModeHandler.createElementData(element); Serializable data = backend.putIfAbsent(pKey, valu... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { String pKey = generatePortableKeyFor(element.getObjectKey()); ElementData value = valueModeHandler.createElementData(element); Serializable data = backend.putIfAbsent(pKey, valu... | ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { String pKey = generatePortableKeyFor(element.getObjectKey()); ElementData value = valueModeHandler.createElementData(element); Serializable data = backend.putIfAbsent(pKey, valu... |
@Test public void given_copy_on_read_and_write_when_copyElementForReadIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForReadIfNeeded(null), nullValue()); } | public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... | CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element, loader); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else... |
@Test public void given_copy_on_read_and_write_when_copyElementForWriteIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element, loader)).thenReturn(new Element("key", new byte[] { })); Cop... | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void given_copy_on_read_and_write_when_copyElementForWriteIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForWriteIfNeeded(null), nullValue()); } | Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... | CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element, loader), loader); } else { r... |
@Test public void testWarnTieredSizing() { final AtomicReference<String> ref = new AtomicReference<String>(); try { Class.forName("org.slf4j.impl.JDK14LoggerFactory"); } catch (ClassNotFoundException e) { fail("Could not load org.slf4j.impl.JDK14LoggerFactory, required for test to work. Is slf4j-jdk14 in test dependenc... | private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap. " + "This will result in useless off heap... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... | CacheConfiguration implements Cloneable { private void warnTieredSizing() { if (isOverflowToOffHeap()) { if (getMaxBytesLocalHeap() >= getMaxBytesLocalOffHeap() && getMaxBytesLocalOffHeap() != 0) { LOG.warn("Configuration problem for cache " + getName() + ": MaxBytesLocalHeap equal or greater than MaxBytesLocalOffHeap.... |
@Test public void given_copy_on_read_and_write_when_copyElementForRemovalIfNeeded_with_Element_then_returns_different() { Element element = new Element("key", "value"); Element serial = new Element("key", new byte[] { }); when(copyStrategy.copyForWrite(element, loader)).thenReturn(new Element("key", new byte[] { })); C... | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void given_copy_on_read_and_write_when_copyElementForRemovalIfNeeded_with_null_then_returns_null() { CopyStrategyHandler copyStrategyHandler = new CopyStrategyHandler(true, true, copyStrategy, loader); assertThat(copyStrategyHandler.copyElementForRemovalIfNeeded(null), nullValue()); } | Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } } | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... | CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element, loader); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element... |
@Test public void testWrappingElementValueComparatorEquals() throws Exception { CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); CopyStrategyConfiguration copyStrategyConfiguration = mock(CopyStrategyConfiguration.class); when(copyStrategyConfiguration.getCopyStrategyInstance(any(ClassLoader.clas... | private static <T extends Store> TxCopyingCacheStore<T> wrap(final T cacheStore, final CacheConfiguration cacheConfiguration) { final ReadWriteCopyStrategy<Element> copyStrategyInstance = cacheConfiguration.getCopyStrategyConfiguration() .getCopyStrategyInstance(cacheConfiguration.getClassLoader()); return new TxCopyin... | TxCopyingCacheStore extends AbstractCopyingCacheStore<T> { private static <T extends Store> TxCopyingCacheStore<T> wrap(final T cacheStore, final CacheConfiguration cacheConfiguration) { final ReadWriteCopyStrategy<Element> copyStrategyInstance = cacheConfiguration.getCopyStrategyConfiguration() .getCopyStrategyInstanc... | TxCopyingCacheStore extends AbstractCopyingCacheStore<T> { private static <T extends Store> TxCopyingCacheStore<T> wrap(final T cacheStore, final CacheConfiguration cacheConfiguration) { final ReadWriteCopyStrategy<Element> copyStrategyInstance = cacheConfiguration.getCopyStrategyConfiguration() .getCopyStrategyInstanc... | TxCopyingCacheStore extends AbstractCopyingCacheStore<T> { private static <T extends Store> TxCopyingCacheStore<T> wrap(final T cacheStore, final CacheConfiguration cacheConfiguration) { final ReadWriteCopyStrategy<Element> copyStrategyInstance = cacheConfiguration.getCopyStrategyConfiguration() .getCopyStrategyInstanc... | TxCopyingCacheStore extends AbstractCopyingCacheStore<T> { private static <T extends Store> TxCopyingCacheStore<T> wrap(final T cacheStore, final CacheConfiguration cacheConfiguration) { final ReadWriteCopyStrategy<Element> copyStrategyInstance = cacheConfiguration.getCopyStrategyConfiguration() .getCopyStrategyInstanc... |
@Test public void testCountBasedLimitSetToNoLimit() { configuration.setOverflowToOffHeap(false); configuration.setMaxEntriesLocalHeap(0); assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); } | protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :... | MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa... | MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa... | MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa... | MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.