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 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 testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); assertEquals(0, cache.getDiskStoreSize()); assertEquals(1, cache.getSize())... | public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return memoryStore.getTerracottaClusteredSize(); } if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return memoryStore.getTerracottaClusteredSize(); } if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } } | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return memoryStore.getTerracottaClusteredSize(); } if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overf... | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return memoryStore.getTerracottaClusteredSize(); } if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overf... | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return memoryStore.getTerracottaClusteredSize(); } if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overf... |
@Test public void testCloneFailures() throws Exception { Cache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); manager.addCache(cache); try { cache.clone(); fail("Should have thrown CloneNotSupportedException"); } catch (CloneNotSupportedException e) { } } | @Override public final Cache clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(copy); copy.sampledC... | Cache implements Ehcache { @Override public final Cache clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsW... | Cache implements Ehcache { @Override public final Cache clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsW... | Cache implements Ehcache { @Override public final Cache clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsW... | Cache implements Ehcache { @Override public final Cache clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsW... |
@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 testEquals() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); Element ... | @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } | Cache implements Ehcache { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } } | Cache implements Ehcache { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
... | Cache implements Ehcache { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
... | Cache implements Ehcache { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
... |
@Test public void testIsKeyInCache() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); as... | public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOnDisk(key); } | Cache implements Ehcache { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOnDisk(key); } } | Cache implements Ehcache { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOnDisk(key); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(S... | Cache implements Ehcache { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOnDisk(key); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(S... | Cache implements Ehcache { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOnDisk(key); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(S... |
@Test public void testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"... | public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } } | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... |
@Test public void testGetWithLoader() { class TestCacheLoader implements CacheLoader { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException { return null; } public String getName() { ret... | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... |
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu... | Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoader == null) { if (registered... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... |
@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 testConcurrentPutsAreConsistent() throws InterruptedException { Cache cache = new Cache("someName", 100, true, true, 0, 0); manager.addCache(cache); ExecutorService executor = Executors.newFixedThreadPool(10); for (int i = 0; i < 5000; i++) { executor.execute(new CacheTestRunnable(cache, String.valueO... | public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStatistics() .getOnDiskHitCount(... | Cache implements Ehcache { public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStati... | Cache implements Ehcache { public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStati... | Cache implements Ehcache { public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStati... | Cache implements Ehcache { public Statistics getStatistics() throws IllegalStateException { int size = getSizeBasedOnAccuracy(getLiveCacheStatistics() .getStatisticsAccuracy()); return new Statistics(this, getLiveCacheStatistics() .getStatisticsAccuracy(), getLiveCacheStatistics() .getCacheHitCount(), getLiveCacheStati... |
@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 testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"... | public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } } | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... | Cache implements InternalEhcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners r... |
@Test public void 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 testEvictsWhenAtCapacityMultiThreaded() throws InterruptedException { final int limit = 1000; final int threadNumber = Runtime.getRuntime().availableProcessors() * 2; final CountBasedBackEnd<String, Element> countBasedBackEnd = new CountBasedBackEnd<String, Element>(limit); final AtomicInteger counter... | @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evicting", e); } } return v; } | CountBasedBackEnd extends ConcurrentHashMap<K, V> implements HeapCacheBackEnd<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evicting", e); } } re... | CountBasedBackEnd extends ConcurrentHashMap<K, V> implements HeapCacheBackEnd<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evicting", e); } } re... | CountBasedBackEnd extends ConcurrentHashMap<K, V> implements HeapCacheBackEnd<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evicting", e); } } re... | CountBasedBackEnd extends ConcurrentHashMap<K, V> implements HeapCacheBackEnd<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evicting", e); } } re... |
@Test public void testPutIfAbsent() throws Exception { transactionManager.begin(); assertEquals("Cache should be empty to start", 0, cache.getSize()); assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); assertNull(cach1.putIfAbsent(new Element("key", "value1"))); assertNull(cache.putIfAbsent(new Element... | public Element putIfAbsent(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous == null) { context.addCommand(new StorePutIfAbsentCommand(element), element); } return previous; } | XATransactionalStore extends AbstractStore { public Element putIfAbsent(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous == null) { context.addCommand(new StorePutIfAbsentCommand(ele... | XATransactionalStore extends AbstractStore { public Element putIfAbsent(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous == null) { context.addCommand(new StorePutIfAbsentCommand(ele... | XATransactionalStore extends AbstractStore { public Element putIfAbsent(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous == null) { context.addCommand(new StorePutIfAbsentCommand(ele... | XATransactionalStore extends AbstractStore { public Element putIfAbsent(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous == null) { context.addCommand(new StorePutIfAbsentCommand(ele... |
@Test public void testRemoveElement() throws Exception { transactionManager.begin(); assertEquals("Cache should be empty to start", 0, cache.getSize()); assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); assertFalse(cache.removeElement(new Element("blah", "someValue"))); cache.put(new Element("blah", "... | public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element.getValue())) { context.addCommand(new StoreRemoveElementCo... | XATransactionalStore extends AbstractStore { public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element.getValue())) ... | XATransactionalStore extends AbstractStore { public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element.getValue())) ... | XATransactionalStore extends AbstractStore { public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element.getValue())) ... | XATransactionalStore extends AbstractStore { public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element.getValue())) ... |
@Test public void testReplace() throws Exception { transactionManager.begin(); assertEquals("Cache should be empty to start", 0, cache.getSize()); assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); assertNull(cache.replace(new Element("blah", "someValue"))); cache.put(new Element("blah", "value")); ass... | public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); boolean replaced = false; if (previous != null && previous.getValue().equals(old.get... | XATransactionalStore extends AbstractStore { public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); boolean replaced = false; if (previous ... | XATransactionalStore extends AbstractStore { public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); boolean replaced = false; if (previous ... | XATransactionalStore extends AbstractStore { public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); boolean replaced = false; if (previous ... | XATransactionalStore extends AbstractStore { public boolean replace(Element old, Element element) throws NullPointerException, IllegalArgumentException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); boolean replaced = false; if (previous ... |
@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, StoreListener { 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.getMaxElementsI... | Cache implements Ehcache, StoreListener { 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.getMaxElementsI... | Cache implements Ehcache, StoreListener { 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.getMaxElementsI... | Cache implements Ehcache, StoreListener { 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.getMaxElementsI... |
@Test public void testGetWithLoader() { class TestCacheLoader implements CacheLoader { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException { return null; } public String getName() { ret... | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... | Cache implements InternalEhcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = ge... |
@Test public void testIsEmpty() throws Exception { Ehcache ehcache = new net.sf.ehcache.Cache("testIsEmpty", 1, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); assertTrue(cache.isEmpty()); cache.put("key1", "value1"); assertFalse(cache.isEmpty()); cache.put("key2", "value1"); asser... | public boolean isEmpty() { return (size() == 0); } | JCache implements net.sf.jsr107cache.Cache { public boolean isEmpty() { return (size() == 0); } } | JCache implements net.sf.jsr107cache.Cache { public boolean isEmpty() { return (size() == 0); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); } | JCache implements net.sf.jsr107cache.Cache { public boolean isEmpty() { return (size() == 0); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(CacheListener cache... | JCache implements net.sf.jsr107cache.Cache { public boolean isEmpty() { return (size() == 0); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(CacheListener cache... |
@Test public void testContainsKey() throws Exception { Ehcache ehcache = new net.sf.ehcache.Cache("testContainsKey", 1, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); assertFalse(cache.containsKey("key1")); assertFalse(cache.containsKey("key2")); cache.put("key1", "value1"); asser... | public boolean containsKey(Object key) { return cache.isKeyInCache(key); } | JCache implements net.sf.jsr107cache.Cache { public boolean containsKey(Object key) { return cache.isKeyInCache(key); } } | JCache implements net.sf.jsr107cache.Cache { public boolean containsKey(Object key) { return cache.isKeyInCache(key); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); } | JCache implements net.sf.jsr107cache.Cache { public boolean containsKey(Object key) { return cache.isKeyInCache(key); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addList... | JCache implements net.sf.jsr107cache.Cache { public boolean containsKey(Object key) { return cache.isKeyInCache(key); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addList... |
@Test public void testContainsValue() throws Exception { Ehcache ehcache = new net.sf.ehcache.Cache("testContainsValue", 2, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); assertFalse(cache.containsValue("value1")); assertFalse(cache.containsValue(null)); cache.put("key1", null); a... | public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommended. This call took " + (end - start) + " ms"); } return inCa... | JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommended. This call t... | JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommended. This call t... | JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommended. This call t... | JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommended. This call t... |
@Test public void testGet() throws Exception { Ehcache ehcache = new net.sf.ehcache.Cache("testGet", 10, true, false, 500, 200); manager.addCache(ehcache); JCache jcache = new JCache(manager.getCache("sampleCache1")); CountingCacheLoader specificCacheLoader = new CountingCacheLoader(); specificCacheLoader.setName("Spec... | public Object get(Object key) throws RuntimeException { return get(key, null); } | JCache implements net.sf.jsr107cache.Cache { public Object get(Object key) throws RuntimeException { return get(key, null); } } | JCache implements net.sf.jsr107cache.Cache { public Object get(Object key) throws RuntimeException { return get(key, null); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); } | JCache implements net.sf.jsr107cache.Cache { public Object get(Object key) throws RuntimeException { return get(key, null); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void a... | JCache implements net.sf.jsr107cache.Cache { public Object get(Object key) throws RuntimeException { return get(key, null); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void a... |
@Test public void testPutAll() { Ehcache ehcache = new net.sf.ehcache.Cache("testPutAll", 2, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); assertTrue(cache.isEmpty()); cache.putAll(null); assertTrue(cache.isEmpty()); cache.putAll(new HashMap()); assertTrue(cache.isEmpty()); Map m... | public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } | JCache implements net.sf.jsr107cache.Cache { public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } } | JCache implements net.sf.jsr107cache.Cache { public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } JCache(Ehcache cache); JCache(Ehcache cac... | JCache implements net.sf.jsr107cache.Cache { public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } JCache(Ehcache cache); JCache(Ehcache cac... | JCache implements net.sf.jsr107cache.Cache { public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } JCache(Ehcache cache); JCache(Ehcache cac... |
@Test public void testClear() { Ehcache ehcache = new net.sf.ehcache.Cache("testClear", 2, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); assertTrue(cache.isEmpty()); cache.clear(); assertTrue(cache.isEmpty()); cache.put("1", new Date()); cache.clear(); assertTrue(cache.isEmpty())... | public void clear() { cache.removeAll(); } | JCache implements net.sf.jsr107cache.Cache { public void clear() { cache.removeAll(); } } | JCache implements net.sf.jsr107cache.Cache { public void clear() { cache.removeAll(); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); } | JCache implements net.sf.jsr107cache.Cache { public void clear() { cache.removeAll(); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(CacheListener cacheListener... | JCache implements net.sf.jsr107cache.Cache { public void clear() { cache.removeAll(); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(CacheListener cacheListener... |
@Test public void testKeySet() { Ehcache ehcache = new net.sf.ehcache.Cache("testKeySet", 2, true, false, 500, 200); manager.addCache(ehcache); Cache cache = new JCache(ehcache); for (int i = 0; i < 10; i++) { cache.put(i + "", new Date()); } cache.put(0 + "", new Date()); Set set = cache.keySet(); assertEquals(10, set... | public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } | JCache implements net.sf.jsr107cache.Cache { public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } } | JCache implements net.sf.jsr107cache.Cache { public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); } | JCache implements net.sf.jsr107cache.Cache { public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCache... | JCache implements net.sf.jsr107cache.Cache { public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCache... |
@Test public void testClearStatistics() throws InterruptedException { Ehcache ehcache = new net.sf.ehcache.Cache("test", 1, true, false, 5, 2); manager.addCache(ehcache); ehcache.setStatisticsEnabled(true); Cache cache = new JCache(ehcache, null); cache.put("key1", "value1"); cache.put("key2", "value1"); cache.get("key... | public void clearStatistics() { statistics.clearStatistics(); } | JCacheStatistics implements CacheStatistics, Serializable { public void clearStatistics() { statistics.clearStatistics(); } } | JCacheStatistics implements CacheStatistics, Serializable { public void clearStatistics() { statistics.clearStatistics(); } JCacheStatistics(Statistics statistics); } | JCacheStatistics implements CacheStatistics, Serializable { public void clearStatistics() { statistics.clearStatistics(); } JCacheStatistics(Statistics statistics); int getStatisticsAccuracy(); void clearStatistics(); int getCacheHits(); int getCacheMisses(); int getObjectCount(); float getAverageGetTime(); long getEvi... | JCacheStatistics implements CacheStatistics, Serializable { public void clearStatistics() { statistics.clearStatistics(); } JCacheStatistics(Statistics statistics); int getStatisticsAccuracy(); void clearStatistics(); int getCacheHits(); int getCacheMisses(); int getObjectCount(); float getAverageGetTime(); long getEvi... |
@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) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } } | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } SizeOf(SizeOfFilter fieldFilter, boolean caching); } | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } SizeOf(SizeOfFilter fieldFilter, boolean caching); abstract long sizeOf(Object obj); Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthEx... | SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } SizeOf(SizeOfFilter fieldFilter, boolean caching); abstract long sizeOf(Object obj); Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthEx... |
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu... | Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = is... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... | Cache implements InternalEhcache, StoreListener { Future<AtomicReference<Object>> asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { final AtomicReference<Object> result = new AtomicReference<Object>(); return getExecutorService().submit(new Runnable() { public void run() thro... |
@Test public void testAsynchronousLoadAll() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService();... | Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key); } } Map<?, ?> map = loadWithRegisteredLo... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... | Cache implements InternalEhcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.... |
@Test public void testSummed() { SampledCounterConfig configSec = new SampledCounterConfig(1, 10, true, 0); SampledCounterImpl counter1 = new SampledCounterImpl(configSec); SampledCounterImpl counter2 = new SampledCounterImpl(configSec); SampledCounterImpl counter3 = new SampledCounterImpl(configSec); SummedSampledCoun... | @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); @Override long getValue(); } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); @Override long getValue(); } |
@Test public void testNoops() { SampledCounterConfig configSec = new SampledCounterConfig(1, 10, true, 0); SampledCounterImpl counter1 = new SampledCounterImpl(configSec); SampledCounterImpl counter2 = new SampledCounterImpl(configSec); SampledCounterImpl counter3 = new SampledCounterImpl(configSec); SummedSampledCount... | @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); @Override long getValue(); } | SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); @Override long getValue(); } |
@Test public void testProgrammaticConfigurationWorksProperlyWhenNoDefaultCacheConfigured() { Configuration mgrConfig = new Configuration(); mgrConfig.setUpdateCheck(false); new CacheManager(mgrConfig).shutdown(); } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testForCacheManagerThreadLeak() throws CacheException, InterruptedException { final Set<Thread> initialThreads = Collections.unmodifiableSet(Thread.getAllStackTraces().keySet()); Configuration config = new Configuration(); config.diskStore(new DiskStoreConfiguration().path("${java.io.tmpdir}/CacheMana... | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testListenerCleanup() throws Exception { Configuration configuration = new Configuration() .maxBytesLocalHeap(10, MemoryUnit.MEGABYTES) .maxBytesLocalDisk(10, MemoryUnit.MEGABYTES) .name("new-cacheManager"); CacheManager cacheManager = new CacheManager(configuration); CacheConfiguration cacheConfigura... | public final Element get(Serializable key) throws IllegalStateException, CacheException { return get((Object) key); } | Cache implements InternalEhcache, StoreListener { public final Element get(Serializable key) throws IllegalStateException, CacheException { return get((Object) key); } } | Cache implements InternalEhcache, StoreListener { public final Element get(Serializable key) throws IllegalStateException, CacheException { return get((Object) key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... | Cache implements InternalEhcache, StoreListener { public final Element get(Serializable key) throws IllegalStateException, CacheException { return get((Object) key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... | Cache implements InternalEhcache, StoreListener { public final Element get(Serializable key) throws IllegalStateException, CacheException { return get((Object) key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration,
RegisteredEventListeners registeredEventLis... |
@Test public void testAddCacheEntityInfo() { factory.addCacheEntityInfo(CACHE_NAME, new CacheConfiguration(), "testTKCacheName"); } | void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", cacheName)); } logCacheConfigInTerracottaClientLogs(cacheName, e... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... | ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", c... |
@Test public void testMultipleCacheManagers() { CacheManager managerOne = new CacheManager(makeCacheManagerConfig("cm1")); try { new CacheManager(makeCacheManagerConfig("cm2")).shutdown(); } finally { managerOne.shutdown(); } } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testDisposesProperlyImmediately() throws BrokenBarrierException, InterruptedException, IOException { CacheManager manager = new CacheManager(new Configuration().name("testDisposesProperlyImmediately")); try { deleteFolder(new File(DUMPS_DIRECTORY)); final RotatingSnapshotFile rotatingSnapshotFile = ne... | void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... |
@Test public void testDisposesProperlyButFinishes() throws BrokenBarrierException, InterruptedException, IOException { CacheManager manager = new CacheManager(new Configuration().name("testDisposesProperlyImmediately")); try { deleteFolder(new File(DUMPS_DIRECTORY)); final RotatingSnapshotFile rotatingSnapshotFile = ne... | void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... | KeySnapshotter implements Runnable { void dispose(boolean immediately) { if (thread != null) { rotatingWriter.setShutdownOnThreadInterrupted(immediately); thread.interrupt(); try { thread.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } KeySnapshotter(final Ehcache cache, final long ... |
@Test(expected = IllegalStateException.class) public void testNameIsNotDynamicallyChangeable() { Configuration configuration = new Configuration().name("ChangeMe"); try { configuration.setName("cantChangeThis!"); } catch (IllegalStateException e) { fail(); } CacheManager cm = new CacheManager(configuration); try { conf... | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void testProgrammaticConfigurationWorksProperlyWhenNoDefaultCacheConfigured() { Configuration mgrConfig = new Configuration(); mgrConfig.setUpdateCheck(false); new CacheManager(mgrConfig).shutdown(); } | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void 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>, Watchable { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean) active; } } | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean) active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final Too... | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean) active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final Too... | WanAwareToolkitCache implements BufferingToolkitCache<K, V>, Watchable { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean) active; } WanAwareToolkitCache(final BufferingToolkitCache<K, V> delegate,
final Too... |
@Test public void testCloneFailures() throws Exception { Cache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); manager.addCache(cache); try { cache.clone(); fail("Should have thrown CloneNotSupportedException"); } catch (CloneNotSupportedException e) { } } | @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(copy); copy.sampledCacheStatistics = new S... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... | Cache implements Ehcache, StoreListener { @Override public final Cache clone() throws CloneNotSupportedException { if (compoundStore != null) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.liveCacheStatisticsData = new LiveCacheStatisticsWrapper(... |
@Test public void 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 testForCacheManagerThreadLeak() throws CacheException, InterruptedException { final Set<Thread> initialThreads = Collections.unmodifiableSet(Thread.getAllStackTraces().keySet()); Configuration config = new Configuration(); config.diskStore(new DiskStoreConfiguration().path("${java.io.tmpdir}/CacheMana... | public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedException ie) { Thr... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (localTransactionsRecoveryThread != null && localTransactionsRecoveryThread.isAlive()) { localTransactionsRecoveryThread.interrupt(); try { localTransactionsRecoveryThread.join(LOCAL_TX_RECOVERY_THREAD_JOIN_TIMEOUT); } catch (InterruptedExce... |
@Test public void 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 testFetch() throws Exception { LOG.severe("."); System.out.println("-=-"); final Element element = selfPopulatingCache.get("key"); assertEquals("value", element.getValue()); } | public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException e) { String message = "Timeout after " + tim... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... |
@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 testRefresh() throws Exception { final String value = "value"; final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); selfPopulatingCache = new SelfPopulatingCache(cache, factory); assertSame(value, selfPopulatingCache.get("key").getObjectValue()); assertEquals(1, factory.getC... | public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator iterator = keys.iterator(); iterator.hasNext();) { final... | SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator iterator = k... | SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator iterator = k... | SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator iterator = k... | SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator iterator = k... |
@Test public void testCacheEntryFactoryReturningElementMake() throws Exception { final long SPECIAL_VERSION_NUMBER = 54321L; final CacheEntryFactory elementReturningFactory = new CacheEntryFactory() { public Object createEntry(final Object key) throws Exception { Element e = new Element(key,"V_"+key); e.setVersion(SPEC... | public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException e) { String message = "Timeout after " + tim... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... |
@Test public void testCacheEntryFactoryReturningElementBadKey() throws Exception { final CacheEntryFactory elementReturningFactory = new CacheEntryFactory() { public Object createEntry(final Object key) throws Exception { Object modifiedKey = key.toString()+"XX"; Element e = new Element(modifiedKey,"V_"+modifiedKey); r... | public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException e) { String message = "Timeout after " + tim... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... | SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTimeoutException ... |
@Test public void testThrashBlockingCache() throws Exception { Ehcache cache = manager.getCache("sampleCache1"); blockingCache = new BlockingCache(cache); long duration = thrashCache(blockingCache, 50, 500L, 1000L); LOG.fine("Thrash Duration:" + duration); } | protected Ehcache getCache() { return cache; } | BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } } | BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache); } | BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); Object clone(); RegisteredEventListeners getCacheEventNotificationService(); boolean isElementInMemory(Serializable key);... | BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); Object clone(); RegisteredEventListeners getCacheEventNotificationService(); boolean isElementInMemory(Serializable key);... |
@Test public void testGetWithLoader() { super.testGetWithLoader(); } | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } | BlockingCache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } } | BlockingCache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } BlockingCache(final Ehcache cache); } | BlockingCache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExp... | BlockingCache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExp... |
@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 testLoadConfigurationFromClasspath() throws Exception { Configuration configuration = ConfigurationFactory.parseConfiguration(); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(System.getProperty("java.io.tmpdir"), configurationHelper.getDiskStor... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@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(System.getProper... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadUTF8ConfigurationFromFile() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcacheUTF8.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); } | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromEhcache11File() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-1_1.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(Sy... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileNoCacheManagerListenerDefault() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-nolisteners.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, con... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileUnloadableCacheManagerListenerDefault() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-unloadablecachemanagerlistenerclass.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileCountingCacheListener() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-countinglisteners.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, confi... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@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."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileNoBootstrapPropertiesSet() throws Exception { File file = new File(TEST_CONFIG_DIR + "distribution/ehcache-distributed1.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(man... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileWithSpecificPropertiesSet() throws Exception { File file = new File(TEST_CONFIG_DIR + "distribution/ehcache-distributed1.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(ma... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@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 testLoadConfigurationFromFileNoDefault() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-nodefault.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEqu... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testDefaultValues() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-nodefault.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache sampleCacheNoOptionalA... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFileNoDisk() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-nodisk.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(nu... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testOptionalAttributeDefaultValues() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-nodisk.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(nul... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromInputStream() throws Exception { InputStream fis = new FileInputStream(new File(SRC_CONFIG_DIR + "ehcache.xml").getAbsolutePath()); ConfigurationHelper configurationHelper; try { Configuration configuration = ConfigurationFactory.parseConfiguration(fis); configurationHelper = ... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromFailsafe() throws Exception { try { File file = new File(AbstractCacheTest.TEST_CLASSES_DIR + "ehcache.xml"); file.renameTo(new File(AbstractCacheTest.TEST_CLASSES_DIR + "hideehcache.xml")); Configuration configuration = ConfigurationFactory.parseConfiguration(); Configuration... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationFromInvalidXMLFileWithDefaultCacheNameUsed() throws Exception { File file = new File(TEST_CONFIG_DIR + "ehcache-withdefaultset.xml"); try { Configuration configuration = ConfigurationFactory.parseConfiguration(file); } catch (CacheException e) { assertTrue(e.getMessage().contains(... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testLoadConfigurationWithReplacement() throws Exception { System.setProperty("multicastGroupPort", "4446"); File file = new File(TEST_CONFIG_DIR + "ehcache-replacement.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new Conf... | public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration configuration = null; I... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... | ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } if (LOG.isLoggable(Level.FINE)) { LOG.fine("Configuring ehcache from file: " + file.toString()); } Configuration ... |
@Test public void testConstructor() { GroupElement element = new GroupElement("key"); assertEquals("key", element.getKey()); assertNotNull(element.getObjectValue()); assertTrue(element.getObjectValue() instanceof Set); assertEquals(0, ((Set) element.getValue()).size()); assertNotNull(element.getMemberKeys()); assertEqu... | public Set getMemberKeys() { return (Set) getObjectValue(); } | GroupElement extends Element { public Set getMemberKeys() { return (Set) getObjectValue(); } } | GroupElement extends Element { public Set getMemberKeys() { return (Set) getObjectValue(); } GroupElement(Object key); GroupElement(Object key, Object value, long version,
long creationTime, long lastAccessTime, long nextToLastAccessTime,
long lastUpdateTime, long hitCount); } | GroupElement extends Element { public Set getMemberKeys() { return (Set) getObjectValue(); } GroupElement(Object key); GroupElement(Object key, Object value, long version,
long creationTime, long lastAccessTime, long nextToLastAccessTime,
long lastUpdateTime, long hitCount); Set getMemberKeys()... | GroupElement extends Element { public Set getMemberKeys() { return (Set) getObjectValue(); } GroupElement(Object key); GroupElement(Object key, Object value, long version,
long creationTime, long lastAccessTime, long nextToLastAccessTime,
long lastUpdateTime, long hitCount); Set getMemberKeys()... |
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } try { cache.setName("illegal/name"); fail(); } catch (IllegalArgumentException e) { } manager.addCache(cache); try { cach... | public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only unitialised caches can have their names set."); } configuration.setName(name); } | Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only unitialised caches can have their names set."); } configuration.setName(name); } } | Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only unitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, boolea... | Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only unitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, boolea... | Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only unitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, boolea... |
@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) { if (LOG.isLoggable(Level... | 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 testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); assertEquals(0, cache.getDiskStoreSize()); assertEquals(1, cache.getSize())... | public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } } | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToId... | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToId... | Cache implements Ehcache { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isDiskStore()) { return diskStore.getSize(); } else { return 0; } } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToId... |
@Test public void testCloneFailures() throws Exception { Cache cache = new Cache("testGetMemoryStore", 10, false, false, 100, 200); manager.addCache(cache); try { cache.clone(); fail("Should have thrown CloneNotSupportedException"); } catch (CloneNotSupportedException e) { } } | public final Object clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.configuration = (CacheConfiguration) configuration.clone(); copy.guid = createGuid(); ... | Cache implements Ehcache { public final Object clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.configuration = (CacheConfiguration) configuration.clone();... | Cache implements Ehcache { public final Object clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.configuration = (CacheConfiguration) configuration.clone();... | Cache implements Ehcache { public final Object clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.configuration = (CacheConfiguration) configuration.clone();... | Cache implements Ehcache { public final Object clone() throws CloneNotSupportedException { if (!(memoryStore == null && diskStore == null)) { throw new CloneNotSupportedException("Cannot clone an initialized cache."); } Cache copy = (Cache) super.clone(); copy.configuration = (CacheConfiguration) configuration.clone();... |
@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()); } | public final String toString() { StringBuffer dump = new StringBuffer(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOverflowToDisk()) .append(" max... | Cache implements Ehcache { public final String toString() { StringBuffer dump = new StringBuffer(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOver... | Cache implements Ehcache { public final String toString() { StringBuffer dump = new StringBuffer(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOver... | Cache implements Ehcache { public final String toString() { StringBuffer dump = new StringBuffer(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOver... | Cache implements Ehcache { public final String toString() { StringBuffer dump = new StringBuffer(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(status) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOver... |
@Test public void testEquals() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); Element ... | public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } | Cache implements Ehcache { public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } } | Cache implements Ehcache { public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolea... | Cache implements Ehcache { public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolea... | Cache implements Ehcache { public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolea... |
@Test public void testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"... | public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } } | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... | Cache implements Ehcache { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(String name, int maxElementsInMemory, boolean overflowToDisk,
boolean eternal, long timeToLiveSeconds, long timeToIdleSeconds); Cache(... |
@Test public void testGetWithLoader() { Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(new CacheLoader() { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException... | public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... | Cache implements Ehcache { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (elemen... |
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu... | Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoader == null) { if (registered... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... | Cache implements Ehcache { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoade... |
@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 { List<Object> nonLoadedKeys = new ArrayList<Object>(keys.size()); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key); } } Map map = null; if (ar... | Cache implements Ehcache { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { List<Object> nonLoadedKeys = new ArrayList<Object>(keys.size()); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key);... | Cache implements Ehcache { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { List<Object> nonLoadedKeys = new ArrayList<Object>(keys.size()); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key);... | Cache implements Ehcache { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { List<Object> nonLoadedKeys = new ArrayList<Object>(keys.size()); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key);... | Cache implements Ehcache { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { List<Object> nonLoadedKeys = new ArrayList<Object>(keys.size()); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key);... |
@Test public void testGetKeysForGroup() { Ehcache cache = createTestCache(); putGroupTestSuite(3,4,cache); assertEqualSets(new String[] {ELEMENT_KEY4, ELEMENT_KEY6}, cache.getKeysForGroup(GROUP_KEY_DIV2)); assertEqualSets(new String[] {ELEMENT_KEY3, ELEMENT_KEY6}, cache.getKeysForGroup(GROUP_KEY_DIV3)); assertNull(cach... | public final Set getKeysForGroup(Object groupKey) throws IllegalStateException, CacheException { Element groupE = get(groupKey); if (groupE == null) { return null; } if (groupE instanceof GroupElement) { GroupElement group = (GroupElement) groupE; return group.getMemberKeys(); } else { throw new CacheException("The gro... | Cache implements Ehcache { public final Set getKeysForGroup(Object groupKey) throws IllegalStateException, CacheException { Element groupE = get(groupKey); if (groupE == null) { return null; } if (groupE instanceof GroupElement) { GroupElement group = (GroupElement) groupE; return group.getMemberKeys(); } else { throw ... | Cache implements Ehcache { public final Set getKeysForGroup(Object groupKey) throws IllegalStateException, CacheException { Element groupE = get(groupKey); if (groupE == null) { return null; } if (groupE instanceof GroupElement) { GroupElement group = (GroupElement) groupE; return group.getMemberKeys(); } else { throw ... | Cache implements Ehcache { public final Set getKeysForGroup(Object groupKey) throws IllegalStateException, CacheException { Element groupE = get(groupKey); if (groupE == null) { return null; } if (groupE instanceof GroupElement) { GroupElement group = (GroupElement) groupE; return group.getMemberKeys(); } else { throw ... | Cache implements Ehcache { public final Set getKeysForGroup(Object groupKey) throws IllegalStateException, CacheException { Element groupE = get(groupKey); if (groupE == null) { return null; } if (groupE instanceof GroupElement) { GroupElement group = (GroupElement) groupE; return group.getMemberKeys(); } else { throw ... |
@Test public void testRemoveByGroup() { Ehcache cache = createTestCache(); putGroupTestSuite(3,4,cache); assertEquals("There should be 4 elements, 2 groups, and one master group", 4+2+1, cache.getSize()); Set removedKeys = cache.removeByGroup(GROUP_KEY_DIV2, false); assertEquals("There should be 2 elements, 1 group, an... | public final Set removeByGroup(Object groupKey, boolean doNotNotifyCacheReplicators) throws IllegalStateException, CacheException { Set proposedRemovals = getKeysForGroup(groupKey); if (proposedRemovals == null) { return null; } proposedRemovals = new HashSet(proposedRemovals); Set actualRemovals = new HashSet(); for (... | Cache implements Ehcache { public final Set removeByGroup(Object groupKey, boolean doNotNotifyCacheReplicators) throws IllegalStateException, CacheException { Set proposedRemovals = getKeysForGroup(groupKey); if (proposedRemovals == null) { return null; } proposedRemovals = new HashSet(proposedRemovals); Set actualRemo... | Cache implements Ehcache { public final Set removeByGroup(Object groupKey, boolean doNotNotifyCacheReplicators) throws IllegalStateException, CacheException { Set proposedRemovals = getKeysForGroup(groupKey); if (proposedRemovals == null) { return null; } proposedRemovals = new HashSet(proposedRemovals); Set actualRemo... | Cache implements Ehcache { public final Set removeByGroup(Object groupKey, boolean doNotNotifyCacheReplicators) throws IllegalStateException, CacheException { Set proposedRemovals = getKeysForGroup(groupKey); if (proposedRemovals == null) { return null; } proposedRemovals = new HashSet(proposedRemovals); Set actualRemo... | Cache implements Ehcache { public final Set removeByGroup(Object groupKey, boolean doNotNotifyCacheReplicators) throws IllegalStateException, CacheException { Set proposedRemovals = getKeysForGroup(groupKey); if (proposedRemovals == null) { return null; } proposedRemovals = new HashSet(proposedRemovals); Set actualRemo... |
@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); instanceMa... | public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider !... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... |
@Test public void testCacheManagerThreads() throws CacheException, InterruptedException { singletonManager = CacheManager.create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache-big.xml"); int threads = countThreads(); assertTrue("More than 75 threads: " + threads, countThreads() <= 75); } | public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager(); } else { if (LOG.isLoggable... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager(); } else { if ... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager(); } else { if ... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager(); } else { if ... | CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager(); } else { if ... |
@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)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider !... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... | CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManage... |
@Test public void testSerializationPerformanceByteArray() throws CacheException { Serializable key = "key"; ByteArrayOutputStream bout = new ByteArrayOutputStream(); for (int j = 0; j < 10000; j++) { try { bout.write("abcdefghijklmnopqrstv1234567890".getBytes()); } catch (IOException e) { LOG.severe("This should not ha... | public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return size; } catch (IOException e) { LOG.fine("Error... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... |
@Test public void testSerializationPerformanceJavaObjects() throws Exception { HashMap map = new HashMap(10000); for (int j = 0; j < 10000; j++) { map.put("key" + j, new String[]{"adfdafs", "asdfdsafa", "sdfasdf"}); } Element element = new Element("key1", map); StopWatch stopWatch = new StopWatch(); for (int i = 0; i <... | public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return size; } catch (IOException e) { LOG.fine("Error... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... | Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.size(); return si... |
@Test public void testIsSerializable() { Element element = new Element(null, null); assertTrue(element.isSerializable()); Element elementWithNullValue = new Element("1", null); assertTrue(elementWithNullValue.isSerializable()); Element elementWithNullKey = new Element(null, "1"); assertTrue(elementWithNullValue.isSeria... | public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } } | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(Serializable key, Serializable value, long version); Element(Object key, Object value, long version); Element(Object key, Object value, long ve... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(Serializable key, Serializable value, long version); Element(Object key, Object value, long version); Element(Object key, Object value, long ve... | Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(Serializable key, Serializable value, long version); Element(Object key, Object value, long version); Element(Object key, Object value, long ve... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.