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(expected = UnsupportedOperationException.class) public void clusteredStore_putIfAbsent_throw_in_eventual_consistency() { clusteredStore.putIfAbsent(new Element("key", "value")); }
@Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsistentCacheAccessor"); } String pKey = generatePortableKeyFo...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsi...
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_replace_1_arg_throw_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value")); }
@Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a St...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_replace_2_args_throw_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value"), new Element("key", "other"), new DefaultElementValueComparator(cacheConfiguration)); }
@Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a St...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not ...
@Test(expected = UnsupportedOperationException.class) public void clusteredStore_removeElement_throw_in_eventual_consistency() { clusteredStore.removeElement(new Element("key", "value"), new DefaultElementValueComparator(cacheConfiguration)); }
@Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsistentCacheAccessor"); ...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency...
ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency...
@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 ToolkitCacheInternal<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } }
WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final ToolkitCacheInternal<K, V> delegate, final ToolkitMap<String...
WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final ToolkitCacheInternal<K, V> delegate, final ToolkitMap<String...
WanAwareToolkitCache implements ToolkitCacheInternal<K, V> { public boolean isActive() { final Serializable active = configMap.get(CACHE_ACTIVE_KEY); return (active == null) ? false : (Boolean)active; } WanAwareToolkitCache(final ToolkitCacheInternal<K, V> delegate, final ToolkitMap<String...
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
@Test public void testTryingToCreateNewClusteredCacheManagerEntityButLooseRace() { String name = "newCM"; net.sf.ehcache.config.Configuration configuration = new net.sf.ehcache.config.Configuration(); ClusteredEntityManager clusteredEntityManager = mock(ClusteredEntityManager.class); doThrow(new IllegalStateException("...
@Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
@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) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); if (clusteredCacheManager == null) { ToolkitReadWriteLock cmRWL...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { @Override public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) { ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class); ...
@Test public void testCountBasedLimitSetToSomeLimit() { configuration.setOverflowToOffHeap(false); int maxEntriesLocalHeap = 10; configuration.setMaxEntriesLocalHeap(maxEntriesLocalHeap); assertThat(loader.isInMemoryLimitReached(cache, maxEntriesLocalHeap - 2), is(false)); assertThat(loader.isInMemoryLimitReached(cache...
protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
@Test public void testLocalHeapSizeBased() { configuration.setOverflowToOffHeap(false); configuration.setMaxBytesLocalHeap(1024L); when(statisticsGateway.getLocalHeapSize()).thenReturn(0L, 1L, 4L); when(statisticsGateway.getLocalHeapSizeInBytes()).thenReturn(250L, 1000L); assertThat(loader.isInMemoryLimitReached(cache,...
protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
@Test public void testInitialiseFailures() { final String name = "testInitialiseFailures2"; Cache cache = new Cache(name, 1, false, false, 5, 1); manager.addCache(cache); try { cache.initialise(); fail("Calling cache.initialise() multiple times should fail with IllegalStateException"); } catch (IllegalStateException e)...
public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMaxBytesLocalHeap() > 0) { PoolEvictor evictor = new...
Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa...
Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa...
Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa...
Cache implements InternalEhcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } Pool onHeapPool; if (configuration.getMa...
@Test public void testTerracottaConfiguration() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals("tc", config...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised")...
public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised 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 uninitialised 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 uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
@Test public void testOffHeapSizeBased() { configuration.setOverflowToOffHeap(true); configuration.setMaxBytesLocalHeap(1024L); configuration.setMaxBytesLocalOffHeap(2048L); when(statisticsGateway.getLocalOffHeapSize()).thenReturn(0L, 1L, 4L); when(statisticsGateway.getLocalOffHeapSizeInBytes()).thenReturn(500L, 2000L)...
protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
@Test public void clusteredStore_replace_1_arg_enabled_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value")); verify(toolkitCacheInternal).replace(any(), any()); }
@Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWriteLock lock = backend.crea...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
@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 Object 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.sampled...
Cache implements Ehcache { @Override 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.liveCacheStatisticsData = new LiveCacheStatistics...
Cache implements Ehcache { @Override 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.liveCacheStatisticsData = new LiveCacheStatistics...
Cache implements Ehcache { @Override 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.liveCacheStatisticsData = new LiveCacheStatistics...
Cache implements Ehcache { @Override 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.liveCacheStatisticsData = new LiveCacheStatistics...
@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 testDeleteElement() throws Exception { long beforeCreated = System.currentTimeMillis(); Thread.sleep(10); String originalString = "The rain in Spain falls mainly on the plain"; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(originalString.getBytes()); int status = HttpUtil.put("h...
@DELETE public void deleteElement() throws NotFoundException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element " + element + " n...
ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element...
ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element...
ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element...
ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new NotFoundException("Element...
@Test public void testGetElement() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); assertEquals("application/xml", result.getContentType()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContex...
@GET public Response getElement() throws NotFoundException { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Date lastModifiedDate...
ElementResource { @GET public Response getElement() throws NotFoundException { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Dat...
ElementResource { @GET public Response getElement() throws NotFoundException { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Dat...
ElementResource { @GET public Response getElement() throws NotFoundException { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Dat...
ElementResource { @GET public Response getElement() throws NotFoundException { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Dat...
@Test public void testGetCache() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); assertEquals("application/xml", result.getContentType()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContext....
@GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() - 1); cacheAsStr...
CacheResource { @GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() ...
CacheResource { @GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() ...
CacheResource { @GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() ...
CacheResource { @GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0, cacheAsString.length() ...
@Test public void testDeleteCache() throws Exception { HttpURLConnection urlConnection = HttpUtil.put("http: urlConnection = HttpUtil.delete("http: assertEquals(200, urlConnection.getResponseCode()); if (urlConnection.getHeaderField("Server").matches("(.*)Glassfish(.*)")) { assertTrue(urlConnection.getContentType().mat...
@DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Response.ok().build(...
CacheResource { @DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Resp...
CacheResource { @DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Resp...
CacheResource { @DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Resp...
CacheResource { @DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache(cache); response = Resp...
@Test public void testCacheNames() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Caches caches = (Caches) unmarshal...
@GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
@Test public void testGetCaches() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = documentBuilder.parse(result.getInputStream()); XPath xpath = ...
@GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
@Test public void testGetCachesJaxb() throws Exception { HttpURLConnection result = HttpUtil.get("http: assertEquals(200, result.getResponseCode()); JAXBContext jaxbContext = new JAXBContextResolver().getContext(Caches.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); Caches caches = (Caches) unmars...
@GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normalize()...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).bu...
@Test public void testPutIfAbsent() { }
public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); Stri...
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); Stri...
@Test public void testPooledOffHeapSizeBased() { configuration.setOverflowToOffHeap(true); assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); }
protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
@Test(expected = IllegalArgumentException.class) public void testNullWriteMode() { CacheWriterConfiguration config = new CacheWriterConfiguration() .writeMode((CacheWriterConfiguration.WriteMode) null); }
public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } @Override CacheWriterConfiguration clone(); void setWriteMode(String writeMode); CacheWriterConfiguration writeMode(String writeMode); CacheWriterConfiguration writeMode...
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } @Override CacheWriterConfiguration clone(); void setWriteMode(String writeMode); CacheWriterConfiguration writeMode(String writeMode); CacheWriterConfiguration writeMode...
@Test(expected = IllegalArgumentException.class) public void testInvalidWriteMode() { CacheWriterConfiguration config = new CacheWriterConfiguration() .writeMode("invalid"); }
public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } }
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } @Override CacheWriterConfiguration clone(); void setWriteMode(String writeMode); CacheWriterConfiguration writeMode(String writeMode); CacheWriterConfiguration writeMode...
CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } @Override CacheWriterConfiguration clone(); void setWriteMode(String writeMode); CacheWriterConfiguration writeMode(String writeMode); CacheWriterConfiguration writeMode...
@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."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testCopyConfiguration() { File file = new File(TEST_CONFIG_DIR + "ehcache-copy.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache copyOnReadCache = configurationHelper.cr...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testElementValueComparatorConfiguration() { File file = new File(TEST_CONFIG_DIR + "ehcache-comparator.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); Ehcache cache = configur...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testMultipleDispose() { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); manager.addCache(cache); cache.dispose(); for (int i = 0; i < 10; i++) { cache.dispose(); } }
public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); registeredEventListeners.dispose(); if (cacheW...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised")...
public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } }
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); C...
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); C...
Cache implements Ehcache, StoreListener { public final void setName(String name) throws IllegalArgumentException { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(CacheConfiguration cacheConfiguration); C...
@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 (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0) { LOG.warn("Cache: " + configuration.getN...
Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)...
Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)...
Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)...
Cache implements Ehcache, StoreListener { public void initialise() { synchronized (this) { if (!cacheStatus.canInitialize()) { throw new IllegalStateException("Cannot initialise the " + configuration.getName() + " cache because its status is not STATUS_UNINITIALISED"); } if (configuration.getMaxElementsInMemory() == 0)...
@Test public void testGetDiskStoreSize() throws Exception { Cache cache = new Cache("testGetDiskStoreSize", 1, true, false, 100, 200); manager.addCache(cache); assertEquals(0, cache.getDiskStoreSize()); cache.put(new Element("key1", "value1")); Thread.sleep(100); assertEquals(0, cache.getDiskStoreSize()); assertEquals(...
public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } }
Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } }
Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi...
Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi...
Cache implements Ehcache, StoreListener { public final int getDiskStoreSize() throws IllegalStateException { checkStatus(); if (isTerracottaClustered()) { return compoundStore.getTerracottaClusteredSize(); } else { return compoundStore.getOnDiskSize(); } } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfi...
@Test public void 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 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(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowToDisk = ").append(configuration.isOverflow...
Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT...
Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT...
Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT...
Cache implements Ehcache, StoreListener { @Override public String toString() { StringBuilder dump = new StringBuilder(); dump.append("[") .append(" name = ").append(configuration.getName()) .append(" status = ").append(cacheStatus.getStatus()) .append(" eternal = ").append(configuration.isEternal()) .append(" overflowT...
@Test public void testEquals() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); Element ...
@Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); }
Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } }
Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur...
Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur...
Cache implements Ehcache, StoreListener { @Override public boolean equals(Object object) { if (object == null) { return false; } if (!(object instanceof Ehcache)) { return false; } Ehcache other = (Ehcache) object; return guid.equals(other.getGuid()); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfigur...
@Test public void testIsKeyInCache() throws CacheException, InterruptedException { Cache cache = new Cache("cache", 1, true, false, 100, 200, false, 1); manager.addCache(cache); Element element1 = new Element("1", new Date()); Element element2 = new Element("2", new Date()); cache.put(element1); cache.put(element2); as...
public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); }
Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } }
Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, Registered...
Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, Registered...
Cache implements Ehcache, StoreListener { public boolean isKeyInCache(Object key) { if (key == null) { return false; } return isElementInMemory(key) || isElementOffHeap(key) || isElementOnDisk(key); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, Registered...
@Test public void testGetQuietFromFinalize() throws InterruptedException { final Cache cache = new Cache("test", 1, true, false, 5, 2); manager.addCache(cache); cache.put(new Element("key", "value")); cache.put(new Element("key2", "value")); cache.put(new Element("key3", "value")); cache.put(new Element("key4", "value"...
public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); }
Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } }
Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, RegisteredEventListeners registere...
Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, RegisteredEventListeners registere...
Cache implements Ehcache, StoreListener { public final void put(Element element) throws IllegalArgumentException, IllegalStateException, CacheException { put(element, false); } Cache(CacheConfiguration cacheConfiguration); Cache(CacheConfiguration cacheConfiguration, RegisteredEventListeners registere...
@Test public void testGetWithLoader() { class TestCacheLoader implements CacheLoader { public Object load(Object key, Object argument) throws CacheException { LOG.info("load1 " + key); return key; } public Map loadAll(Collection keys, Object argument) throws CacheException { return null; } public String getName() { ret...
public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(key); if (element != null) { return element...
Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k...
Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k...
Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k...
Cache implements Ehcache, StoreListener { public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { Element element = get(key); if (element != null) { return element; } if (registeredCacheLoaders.size() == 0 && loader == null) { return null; } try { element = getQuiet(k...
@Test public void testAsynchronousLoad() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService(); Fu...
Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if (specificLoader == null) { if (registered...
Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if...
Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if...
Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if...
Cache implements Ehcache, StoreListener { Future asynchronousLoad(final Object key, final CacheLoader specificLoader, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() throws CacheException { try { boolean existsOnRun = isKeyInCache(key); if (!existsOnRun) { Object value; if...
@Test public void testAsynchronousLoadAll() throws InterruptedException, ExecutionException { CountingCacheLoader countingCacheLoader = new CountingCacheLoader(); Cache cache = manager.getCache("sampleCache1"); cache.registerCacheLoader(countingCacheLoader); ExecutorService executorService = cache.getExecutorService();...
Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key); } } Map map = loadWithRegisteredLoaders(...
Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)...
Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)...
Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)...
Cache implements Ehcache, StoreListener { Future asynchronousLoadAll(final Collection keys, final Object argument) { return getExecutorService().submit(new Runnable() { public void run() { try { Set<Object> nonLoadedKeys = new HashSet<Object>(); for (Object key : keys) { if (!isKeyInCache(key)) { nonLoadedKeys.add(key)...
@Test public void testForCacheManagerThreadLeak() throws CacheException, InterruptedException { int startingThreadCount = countThreads(); URL secondCacheConfiguration = this.getClass().getResource( "/ehcache-2.xml"); for (int i = 0; i < 100; i++) { instanceManager = new CacheManager(secondCacheConfiguration); instanceM...
public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManagerPeerProvider....
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag...
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag...
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag...
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null) { cacheManag...
@Test public void 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 testPooledHeapSizeBased() { assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); }
protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCacheConfiguration().getMaxEntriesLocalHeap() == 0 ? Integer.MAX_VALUE :...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
MemoryLimitedCacheLoader implements BootstrapCacheLoader, Cloneable { protected boolean isInMemoryLimitReached(final Ehcache cache, final int loadedElements) { long maxBytesInMem; long maxElementsInMem; final boolean overflowToOffHeap = cache.getCacheConfiguration().isOverflowToOffHeap(); maxElementsInMem = cache.getCa...
@Test public void testCollisionDifferentThread() throws Exception { final String diskStorePath = getTempDir("testCollisionDifferentThread"); dspm1 = new DiskStorePathManager(diskStorePath); dspm1.getFile("foo"); Thread newThread = new Thread() { @Override public void run() { dspm2 = new DiskStorePathManager(diskStorePa...
public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); boolean resolveAndLockIfExists(String file); boolean isAutoCreated(); boolean isDefault(); synchronized void releaseLock(); Fil...
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); boolean resolveAndLockIfExists(String file); boolean isAutoCreated(); boolean isDefault(); synchronized void releaseLock(); Fil...
@Test(expected = CacheException.class) public void testIllegalPath() { Assume.assumeTrue(System.getProperty("os.name").contains("Windows")); String diskStorePath = getTempDir("testIllegalPath") + "/com1"; dspm1 = new DiskStorePathManager(diskStorePath); dspm1.getFile("foo"); }
public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); }
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); boolean resolveAndLockIfExists(String file); boolean isAutoCreated(); boolean isDefault(); synchronized void releaseLock(); Fil...
DiskStorePathManager { public File getFile(String cacheName, String suffix) { return getFile(safeName(cacheName) + suffix); } DiskStorePathManager(String initialPath); DiskStorePathManager(); boolean resolveAndLockIfExists(String file); boolean isAutoCreated(); boolean isDefault(); synchronized void releaseLock(); Fil...
@Test public void testStripingDistribution() { int[] lockIndexes = new int[2048]; for (int i = 0; i < 20480 * 3; i++) { String key = "" + i * 3 / 2 + i; key += key.hashCode(); int lock = ConcurrencyUtil.selectLock(key, 2048); lockIndexes[lock]++; } int outliers = 0; for (int i = 0; i < 2048; i++) { if (20 <= lockIndexe...
public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
@Test public void testNullKey() { ConcurrencyUtil.selectLock(null, 2048); ConcurrencyUtil.selectLock("", 2048); }
public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
@Test public void testThrashBlockingCache() throws Exception { Ehcache cache = manager.getCache("sampleCache1"); blockingCache = new BlockingCache(cache); long duration = thrashCache(blockingCache, 50, 500L, 1000L); LOG.debug("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, int numberOfStripes); BlockingCache(final Ehcache cache); }
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache, int numberOfStripes); BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); @Override Object clone(); RegisteredEventListeners getCacheEven...
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache, int numberOfStripes); BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); @Override Object clone(); RegisteredEventListeners getCacheEven...
@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, int numberOfStripes); 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, int numberOfStripes); 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, int numberOfStripes); BlockingCache(final Ehcache cache); ...
@Test public void testLoadConfigurationFromFile() throws Exception { File file = new File(SRC_CONFIG_DIR + "ehcache.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals(null, configurat...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void 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."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testTerracottaConfiguration() { File file = new File(TEST_CONFIG_DIR + "terracotta/ehcache-terracotta.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); assertEquals("tc", config...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testWriterConfig() { File file = new File(TEST_CONFIG_DIR + "ehcache-writer.xml"); Configuration configuration = ConfigurationFactory.parseConfiguration(file); ConfigurationHelper configurationHelper = new ConfigurationHelper(manager, configuration); CacheWriterConfiguration defaultCacheWriterConfig =...
public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testSetCacheName() throws CacheException { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); try { cache.setName(null); fail(); } catch (IllegalArgumentException e) { } cache.setName("name/with/slash"); manager.addCache(cache); try { cache.setName("trying_to_change_name_after_initialised")...
public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised 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 uninitialised 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 uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
Cache implements Ehcache { public final void setName(String name) throws IllegalArgumentException { if (!status.equals(Status.STATUS_UNINITIALISED)) { throw new IllegalStateException("Only uninitialised caches can have their names set."); } configuration.setName(name); } Cache(String name, int maxElementsInMemory, bool...
@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); @Depreca...
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); @Depreca...
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); @Depreca...
@Test public void testEvenLockNumber() { try { ConcurrencyUtil.selectLock("anything", 100); } catch (CacheException e) { } }
public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) & (numberOfLocks -...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int hash = hash(key) ...
@Test public void 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); @Deprec...
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); @Deprec...
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); @Deprec...
@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 testPutIfAbsent() { assertEquals(testCache.get("putIfAbsent"), null); testCache.putIfAbsent(new Element("putIfAbsent", "1")); assertEquals(testCache.get("putIfAbsent").getValue(), "1"); testCache.putIfAbsent(new Element("putIfAbsent", "2")); assertEquals(testCache.get("putIfAbsent").getValue(), "1"); ...
public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); }
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); Stri...
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcache cache); Stri...
@Test public void testFallsBackToDefaultSizeOfEngine() { final SizeOfEngine sizeOfEngine = SizeOfEngineLoader.INSTANCE.createSizeOfEngine(10, true, true); assertThat(sizeOfEngine, notNullValue()); assertThat(sizeOfEngine, instanceOf(DefaultSizeOfEngine.class)); }
@Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, silent); } return new DefaultSizeOfEngine(maxObjectCoun...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
@Test public void testUsesServiceLoaderWhenItCan() { ClassLoader cl = new CheatingClassLoader(); SizeOfEngineLoader loader = new SizeOfEngineLoader(cl); assertThat(loader.createSizeOfEngine(10, true, true), sameInstance(constantSizeOfEngine)); }
@Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, silent); } return new DefaultSizeOfEngine(maxObjectCoun...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCount, abort, sil...
@Test(expected=UnsupportedOperationException.class) public void NoDefaultValueInReferenceAnnotationAndNoImplementationInCustomThrowsException_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAn...
public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler); }
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
@Test public void clusteredStore_replace_2_args_enabled_in_eventual_consistency() { clusteredStore.replace(new Element("key", "value"), new Element("key", "other"), new DefaultElementValueComparator(cacheConfiguration)); verify(toolkitCacheInternal).replace(any(), any(), any(), any(ToolkitValueComparator.class)); }
@Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(element.getKey()); ToolkitReadWriteLock lock = backend.crea...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
ClusteredStore implements TerracottaStore, StoreListener { @Override public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { if (isEventual) { return replaceEventual(old, element, comparator); } String pKey = generatePortableKeyFor(...
@Test(expected = ClassNotFoundException.class) public void contentOfTheJarNotVisibleWithNormalClassLoaderTest() throws ClassNotFoundException { Class<?> simpleClass = testCaseClassLoader.loadClass("pof.Simple"); }
@Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name,...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
@Test public void workingWithClassFromPrivateClassPathTest() throws ClassNotFoundException, NoSuchMethodException, SecurityException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException { ResourceClassLoader resourceClassLoader = new ResourceClassLoader("priv...
@Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name,...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFou...
@Test public void NoImplementationInCustomFallsBackToReferenceImplementation_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, ReferenceAnnotation.class); asser...
public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler); }
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
@Test public void testTransactionalMode() { CacheConfiguration configuration = new CacheConfiguration(); assertEquals(CacheConfiguration.TransactionalMode.OFF, configuration.getTransactionalMode()); try { configuration.setTransactionalMode(null); fail("expected IllegalArgumentException"); } catch (IllegalArgumentExcept...
public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; }
CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } }
CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); }
CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String...
CacheConfiguration implements Cloneable { public final CacheConfiguration transactionalMode(String transactionalMode) { setTransactionalMode(transactionalMode); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String...
@Test public void testMaxMemoryOffHeap() { CacheConfiguration configuration = new CacheConfiguration(); configuration.setMaxMemoryOffHeap("100m"); assertEquals("100m", configuration.getMaxMemoryOffHeap()); configuration.setMaxBytesLocalOffHeap("1G"); assertEquals("1G", configuration.getMaxMemoryOffHeap()); }
public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; }
CacheConfiguration implements Cloneable { public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } }
CacheConfiguration implements Cloneable { public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); }
CacheConfiguration implements Cloneable { public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String name); fi...
CacheConfiguration implements Cloneable { public CacheConfiguration maxMemoryOffHeap(String maxMemoryOffHeap) { setMaxMemoryOffHeap(maxMemoryOffHeap); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void setName(String name); fi...
@Test public void testSynchronousWritesPersistenceConfiguration() { CacheConfiguration configuration = new CacheConfiguration("Test", 10).persistence(new PersistenceConfiguration() .strategy(Strategy.LOCALTEMPSWAP).synchronousWrites(true)); try { cacheManager.addCache(new Cache(configuration)); fail("Expected InvalidCo...
public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); }
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void ...
CacheConfiguration implements Cloneable { public CacheConfiguration persistence(PersistenceConfiguration persistenceConfiguration) { addPersistence(persistenceConfiguration); return this; } CacheConfiguration(); CacheConfiguration(String name, int maxEntriesLocalHeap); @Override CacheConfiguration clone(); final void ...
@Test public void testGetCache() throws CacheException { CacheManager manager = new CacheManager(new Configuration().cache(new CacheConfiguration("foo", 100))); try { assertNotNull(manager.getCache("foo")); } finally { manager.shutdown(); } }
public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; }
CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } }
CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ...
CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ...
CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL ...
@Test public void IfMethodExistsInCustomAnnotationRedirectsToIt_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, ReferenceAnnotation.class); assertEquals(true,...
public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler); }
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
@Test public void IfMethodExistsInCustomAnnotationButReturnTypeIsDifferentFallsBackToReferenceImplementation_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, R...
public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler); }
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
@Test public void DifferentReturnTypesFromDifferentMethods_Test() { CustomAnnotation customAnnotation = UsingCustomAnnotation.class.getAnnotation(CustomAnnotation.class); ReferenceAnnotation annotationProxy = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, ReferenceAnnotation.class); assertEquals(Integer.cl...
public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler); }
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnn...
@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."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = null; try { input = new Bu...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
ConfigurationFactory { public static Configuration parseConfiguration(final File file) throws CacheException { if (file == null) { throw new CacheException("Attempt to configure ehcache from null file."); } LOG.debug("Configuring ehcache from file: {}", file); Configuration configuration = null; InputStream input = nul...
@Test public void testMultipleDispose() { Ehcache cache = new Cache("testCache", 1, true, false, 5, 2); manager.addCache(cache); cache.dispose(); for (int i = 0; i < 10; i++) { cache.dispose(); } }
public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); registeredEventListeners.dispose(); if (cacheW...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
Cache implements Ehcache, StoreListener { public synchronized void dispose() throws IllegalStateException { if (checkStatusAlreadyDisposed()) { return; } if (executorService != null) { executorService.shutdown(); } disposeRegisteredCacheExtensions(); disposeRegisteredCacheLoaders(); disposeRegisteredCacheWriter(); regi...
@Test public void testWalksAGraph() { final Map<String, Long> map = new HashMap<String, Long>(); ObjectGraphWalker walker = new ObjectGraphWalker( new ObjectGraphWalker.Visitor() { public long visit(final Object object) { increment(object.getClass().getName()); return 1; } public void increment(String value) { if (valu...
long walk(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... root) { StringBuilder traversalDebugMessage = null; long result = 0; boolean warned = false; try { Stack<Object> toVisit = new Stack<Object>(); IdentityHashMap<Object, Object> visited = new IdentityHashMap<Object, Object>(); if (root != null) { if (US...
ObjectGraphWalker { long walk(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... root) { StringBuilder traversalDebugMessage = null; long result = 0; boolean warned = false; try { Stack<Object> toVisit = new Stack<Object>(); IdentityHashMap<Object, Object> visited = new IdentityHashMap<Object, Object>(); if (ro...
ObjectGraphWalker { long walk(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... root) { StringBuilder traversalDebugMessage = null; long result = 0; boolean warned = false; try { Stack<Object> toVisit = new Stack<Object>(); IdentityHashMap<Object, Object> visited = new IdentityHashMap<Object, Object>(); if (ro...
ObjectGraphWalker { long walk(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... root) { StringBuilder traversalDebugMessage = null; long result = 0; boolean warned = false; try { Stack<Object> toVisit = new Stack<Object>(); IdentityHashMap<Object, Object> visited = new IdentityHashMap<Object, Object>(); if (ro...
ObjectGraphWalker { long walk(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... root) { StringBuilder traversalDebugMessage = null; long result = 0; boolean warned = false; try { Stack<Object> toVisit = new Stack<Object>(); IdentityHashMap<Object, Object> visited = new IdentityHashMap<Object, Object>(); if (ro...
@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...