- *
- * <cachePeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
- * properties="hostName=localhost, port=5000" />
- *
- *
- * @author Greg Luck
- * @version $Id: RMICacheManagerPeerListenerFactory.java 10789 2018-04-26 02:08:13Z adahanne $
- */
-public class RMICacheManagerPeerListenerFactory extends CacheManagerPeerListenerFactory {
-
- /**
- * The default timeout for cache replication for a single replication action.
- * This may need to be increased for large data transfers.
- */
- public static final Integer DEFAULT_SOCKET_TIMEOUT_MILLIS = Integer.valueOf(120000);
-
- private static final String HOSTNAME = "hostName";
- private static final String PORT = "port";
- private static final String REMOTE_OBJECT_PORT = "remoteObjectPort";
- private static final String SOCKET_TIMEOUT_MILLIS = "socketTimeoutMillis";
-
- /**
- * @param properties implementation specific properties. These are configured as comma
- * separated name value pairs in ehcache.xml
- */
- public final CacheManagerPeerListener createCachePeerListener(CacheManager cacheManager, Properties properties)
- throws CacheException {
- String hostName = PropertyUtil.extractAndLogProperty(HOSTNAME, properties);
-
- String portString = PropertyUtil.extractAndLogProperty(PORT, properties);
- Integer port = null;
- if (portString != null && portString.length() != 0) {
- port = Integer.valueOf(portString);
- } else {
- port = Integer.valueOf(0);
- }
-
- //0 means any port in UnicastRemoteObject, so it is ok if not specified to make it 0
- String remoteObjectPortString = PropertyUtil.extractAndLogProperty(REMOTE_OBJECT_PORT, properties);
- Integer remoteObjectPort = null;
- if (remoteObjectPortString != null && remoteObjectPortString.length() != 0) {
- remoteObjectPort = Integer.valueOf(remoteObjectPortString);
- } else {
- remoteObjectPort = Integer.valueOf(0);
- }
-
- String socketTimeoutMillisString = PropertyUtil.extractAndLogProperty(SOCKET_TIMEOUT_MILLIS, properties);
- Integer socketTimeoutMillis;
- if (socketTimeoutMillisString == null || socketTimeoutMillisString.length() == 0) {
- socketTimeoutMillis = DEFAULT_SOCKET_TIMEOUT_MILLIS;
- } else {
- socketTimeoutMillis = Integer.valueOf(socketTimeoutMillisString);
- }
- return doCreateCachePeerListener(hostName, port, remoteObjectPort, cacheManager, socketTimeoutMillis);
- }
-
- /**
- * A template method to actually create the factory
- *
- * @param hostName
- * @param port
- * @param remoteObjectPort
- * @param cacheManager
- * @param socketTimeoutMillis @return a crate CacheManagerPeerListener
- */
- protected CacheManagerPeerListener doCreateCachePeerListener(String hostName,
- Integer port,
- Integer remoteObjectPort,
- CacheManager cacheManager,
- Integer socketTimeoutMillis) {
- try {
- return new RMICacheManagerPeerListener(hostName, port, remoteObjectPort, cacheManager, socketTimeoutMillis);
- } catch (UnknownHostException e) {
- throw new CacheException("Unable to create CacheManagerPeerListener. Initial cause was " + e.getMessage(), e);
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CachePerfTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CachePerfTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CachePerfTest.java (revision 0)
@@ -1,766 +0,0 @@
-package net.sf.ehcache;
-
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.exceptionhandler.ExceptionHandlingDynamicCacheProxy;
-import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
-import net.sf.ehcache.store.disk.DiskStoreHelper;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Random;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicLong;
-
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.DiskStoreConfiguration;
-
-import org.junit.Rule;
-import org.junit.rules.TemporaryFolder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-//import net.sf.ehcache.loader.CountingCacheLoader;
-
-/**
- * @author Alex Snaps
- */
-public class CachePerfTest {
-
- @Rule
- public final TemporaryFolder diskFolder = new TemporaryFolder();
-
- private static final Logger LOG = LoggerFactory.getLogger(CachePerfTest.class.getName());
-
-
- /**
- * Checks the expense of checking for duplicates
- * Typical Results Duplicate Check: 8ms versus 3ms for No Duplicate Check
- *
- * 66ms for 1000, 6ms for no duplicate/expiry
- * 187565 for 100000, where 500 is the in-memory size. 964ms without checking expiry. 134ms for getKeysNoDuplicateCheckTime
- * 18795 for 100000, where 50000 is in-memory size. 873ms without checking expiry. 158ms for getKeysNoDuplicateCheckTime
- */
- @Test
- public void testGetKeysPerformance() throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testGetKeysPerformance")
- .diskStore(new DiskStoreConfiguration().path(diskFolder.getRoot().getAbsolutePath())));
- try {
- //Set size so the second element overflows to disk.
- Ehcache cache = new Cache("test4", 1000, true, true, 0, 0);
- manager.addCache(cache);
-
- for (int i = 0; i < 2000; i++) {
- cache.put(new Element("key" + i, "value"));
- }
- //let the notifiers cool down
- Thread.sleep(1000);
- StopWatch stopWatch = new StopWatch();
- List keys = cache.getKeys();
- assertTrue("Should be 2000 keys. ", keys.size() == 2000);
- long getKeysTime = stopWatch.getElapsedTime();
- cache.getKeysNoDuplicateCheck();
- long getKeysNoDuplicateCheckTime = stopWatch.getElapsedTime();
- LOG.info("Time to get 1000 keys: With Duplicate Check: " + getKeysTime
- + " Without Duplicate Check: " + getKeysNoDuplicateCheckTime);
- assertTrue("Getting keys took more than 150ms", getKeysTime < 100);
- } finally {
- manager.shutdown();
- }
- }
-
-
- /**
- * Performance tests for a range of Memory Store - Disk Store combinations.
- *
- * This demonstrates that a memory only store is approximately an order of magnitude
- * faster than a disk only store.
- *
- * It also shows that double the performance of a Disk Only store can be obtained
- * with a maximum memory size of only 1. Accordingly a Cache created without a
- * maximum memory size of less than 1 will issue a warning.
- *
- * Threading changes were made in v1.41 of DiskStore. The before and after numbers are shown.
- *
- * This test also has a cache with a CacheExceptionHandler registered. The performance effect is not detectable.
- */
- @Test
- public void testProportionMemoryAndDiskPerformance() throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testProportionMemoryAndDiskPerformance")
- .diskStore(new DiskStoreConfiguration().path(diskFolder.getRoot().getAbsolutePath())));
- try {
- StopWatch stopWatch = new StopWatch();
- long time = 0;
-
- //Memory only Typical 192ms
- Cache memoryOnlyCache = new Cache("testMemoryOnly", 5000, false, false, 5, 2);
- manager.addCache(memoryOnlyCache);
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- memoryOnlyCache.put(new Element(Integer.valueOf(i), "value"));
- memoryOnlyCache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for MemoryStore: " + time);
- assertTrue("Time to put and get 5000 entries into MemoryStore", time < 300);
-
- //Memory only Typical 192ms
- for (int j = 0; j < 10; j++) {
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- memoryOnlyCache.put(new Element(Integer.valueOf(i), "value"));
- memoryOnlyCache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for MemoryStore: " + time);
- assertTrue("Time to put and get 5000 entries into MemoryStore", time < 300);
- Thread.sleep(500);
- }
-
- //Memory only with ExceptionHandlingTypical 192ms
- manager.replaceCacheWithDecoratedCache(memoryOnlyCache, ExceptionHandlingDynamicCacheProxy.createProxy(memoryOnlyCache));
- Ehcache exceptionHandlingMemoryOnlyCache = manager.getEhcache("testMemoryOnly");
- for (int j = 0; j < 10; j++) {
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- exceptionHandlingMemoryOnlyCache.put(new Element(Integer.valueOf(i), "value"));
- exceptionHandlingMemoryOnlyCache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for exception handling MemoryStore: " + time);
- assertTrue("Time to put and get 5000 entries into exception handling MemoryStore", time < 300);
- Thread.sleep(500);
- }
-
- //Set size so that all elements overflow to disk.
- // 1245 ms v1.38 DiskStore
- // 273 ms v1.42 DiskStore
- Cache diskOnlyCache = new Cache("testDiskOnly", 1, true, false, 5, 2);
- manager.addCache(diskOnlyCache);
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- diskOnlyCache.put(new Element(key, "value"));
- diskOnlyCache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for DiskStore: " + time);
- assertTrue("Time to put and get 5000 entries into DiskStore was less than 2 sec", time < 2000);
-
- // 1 Memory, 999 Disk
- // 591 ms v1.38 DiskStore
- // 56 ms v1.42 DiskStore
- Cache m1d999Cache = new Cache("m1d999Cache", 1, true, false, 5, 2);
- manager.addCache(m1d999Cache);
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- m1d999Cache.put(new Element(key, "value"));
- m1d999Cache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for m1d999Cache: " + time);
- assertTrue("Time to put and get 5000 entries into m1d999Cache", time < 2000);
-
- // 500 Memory, 500 Disk
- // 669 ms v1.38 DiskStore
- // 47 ms v1.42 DiskStore
- Cache m500d500Cache = new Cache("m500d500Cache", 500, true, false, 5, 2);
- manager.addCache(m500d500Cache);
- time = stopWatch.getElapsedTime();
- for (int i = 0; i < 5000; i++) {
- Integer key = Integer.valueOf(i);
- m500d500Cache.put(new Element(key, "value"));
- m500d500Cache.get(key);
- }
- time = stopWatch.getElapsedTime();
- LOG.info("Time for m500d500Cache: " + time);
- assertTrue("Time to put and get 5000 entries into m500d500Cache", time < 2000);
- } finally {
- manager.shutdown();
- }
- }
-
-
- /**
- * Checks the expense of checking in-memory size
- * 3467890 bytes in 1601ms for JDK1.4.2
- */
- @Test
- public void testCalculateInMemorySizePerformanceAndReasonableness() throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testCalculateInMemorySizePerformanceAndReasonableness"));
- try {
- //Set size so the second element overflows to disk.
- Cache cache1 = new Cache("test4", 1000, false, true, 0, 0);
- manager.addCache(cache1);
- Ehcache cache = cache1;
-
- //Set up object graphs
- for (int i = 0; i < 1000; i++) {
- HashMap map = new HashMap(100);
- for (int j = 0; j < 100; j++) {
- map.put("key" + j, new String[]{"adfdafs", "asdfdsafa", "sdfasdf"});
- }
- cache.put(new Element("key" + i, map));
- }
-
- StopWatch stopWatch = new StopWatch();
- long size = cache.getStatistics().getLocalHeapSizeInBytes();
- assertTrue("Size is " + size + ". Check it for reasonableness.", size > 10000000 && size < 22000000);
- long elapsed = stopWatch.getElapsedTime();
- LOG.info("In-memory size in bytes: " + size
- + " time to calculate in ms: " + elapsed);
- assertTrue("Calculate memory size takes less than 3.5 seconds", elapsed < 3500);
- } finally {
- manager.shutdown();
- }
- }
-
- /**
- * When flushing large MemoryStores, OutOfMemory issues can happen if we are
- * not careful to move each Element to the DiskStore, rather than copy them all
- * and then delete them from the MemoryStore.
- *
- * This test manipulates a MemoryStore right on the edge of what can fit into the 64MB standard VM size.
- * An inefficient spool will cause an OutOfMemoryException.
- *
- * @throws Exception
- */
- @Test
- public void testMemoryEfficiencyOfFlushWhenOverflowToDisk() throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testMemoryEfficiencyOfFlushWhenOverflowToDisk")
- .diskStore(new DiskStoreConfiguration().path(diskFolder.getRoot().getAbsolutePath())));
- try {
- CacheConfiguration config = new CacheConfiguration("testGetMemoryStoreSize", 40000);
- config.setOverflowToDisk(true);
- config.setEternal(false);
- config.setTimeToLiveSeconds(100);
- config.setTimeToIdleSeconds(200);
- config.setDiskPersistent(false);
- config.setDiskExpiryThreadIntervalSeconds(120);
- Cache cache = new Cache(config);
-
- manager.addCache(cache);
- StopWatch stopWatch = new StopWatch();
-
- assertEquals(0, cache.getStatistics().getLocalHeapSize());
-
- for (int i = 0; i < 80000; i++) {
- cache.put(new Element("" + i, new byte[480]));
- }
- LOG.info("Put time: " + stopWatch.getElapsedTime());
- DiskStoreHelper.flushAllEntriesToDisk(cache).get();
- assertEquals(40000, cache.getStatistics().getLocalHeapSize());
- assertEquals(80000, cache.getStatistics().getLocalDiskSize());
-
- long beforeMemory = AbstractCacheTest.measureMemoryUse();
- stopWatch.getElapsedTime();
- cache.flush();
- LOG.info("Flush time: " + stopWatch.getElapsedTime());
-
- //It takes a while to write all the Elements to disk
- Thread.sleep(1000);
-
- long afterMemory = AbstractCacheTest.measureMemoryUse();
- long memoryIncrease = afterMemory - beforeMemory;
- assertTrue(memoryIncrease < 40000000);
-
- assertEquals(0, cache.getStatistics().getLocalHeapSize());
- assertEquals(80000, cache.getStatistics().getLocalDiskSize());
- } finally {
- manager.shutdown();
- }
- }
-
- /**
- * Orig.
- * INFO: Average Get Time: 0.37618342 ms
- * INFO: Average Put Time: 0.61346555 ms
- * INFO: Average Remove Time: 0.43651128 ms
- * INFO: Average Remove All Time: 0.20818481 ms
- * INFO: Average keySet Time: 0.11898771 ms
- *
- * CLHM
- * INFO: Average Get Time for 3611277 observations: 0.0043137097 ms
- * INFO: Average Put Time for 554433 obervations: 0.011824693 ms
- * INFO: Average Remove Time for 802361 obervations: 0.008200797 ms
- * INFO: Average Remove All Time for 2887862 observations: 4.685127E-4 ms
- * INFO: Average keySet Time for 2659524 observations: 0.003155828 ms
- *
- * CHM with sampling
- * INFO: Average Get Time for 5424446 observations: 0.0046010227 ms
- * INFO: Average Put Time for 358907 obervations: 0.027190888 ms
- * INFO: Average Remove Time for 971741 obervations: 0.00924732 ms
- * INFO: Average keySet Time for 466812 observations: 0.15059596 ms
- *
- * After putting back synchronized:
- *
- * INFO: Average Get Time for 7184321 observations: 0.009596036 ms
- * INFO: Average Put Time for 15853 obervations: 0.117264874 ms
- * INFO: Average Remove Time for 385518 obervations: 0.017298803 ms
- * INFO: Average Remove All Time for 456174 observations: 0.10433519 ms
- * INFO: Average keySet Time for 4042893 observations: 0.0029669348 ms
- * INFO: Total loads: 123
- *
- * Ehcache 2.0: After turning off statistics.
- * Feb 3, 2010 1:50:32 PM net.sf.ehcache.CacheTest testConcurrentReadWriteRemove
- * INFO: Average Get Time for 7251897 observations: 0.006588345 ms
- * INFO: Average Put Time for 6190 obervations: 0.07479806 ms
- * INFO: Average Remove Time for 4428 obervations: 0.7606143 ms
- * INFO: Average Remove All Time for 5183786 observations: 0.0020039408 ms
- * INFO: Average keySet Time for 4973208 observations: 0.0020630546 ms
- * INFO: Total loadAlls: 189
- *
- * Aug 10, 2011 4:43:47 PM Ehcache 2.1 Revalidation on Mac OS X Lion and same machine
- * INFO: Average Get Time for 7474731 observations: 0.0066825147 ms
- * INFO: Average Put Time for 12918 obervations: 0.6070599 ms
- * INFO: Average Remove Time for 57024 obervations: 0.06649832 ms
- * INFO: Average Remove All Time for 5147782 observations: 0.0026411375 ms
- * INFO: Average keySet Time for 4717506 observations: 0.002453627 ms
- *
- * Aug 10, 2011 4:47:16 PM 2.5 beta
- * INFO: Average Get Time for 517885 observations: 0.16877685 ms
- * INFO: Average Put Time for 52501 obervations: 0.5059332 ms
- * INFO: Average Remove Time for 30177 obervations: 0.7006329 ms
- * INFO: Average Remove All Time for 107152 observations: 0.8572775 ms
- * INFO: Average keySet Time for 98991 observations: 0.92390215 ms
- *
- * Aug 12, 2011 11:24:40 AM Java 6 Agent sizeof with "value" value
- * INFO: Average Get Time for 1378042 observations: 0.18543556 ms
- * INFO: Average Put Time for 1056477 obervations: 0.092374 ms
- * INFO: Average Remove Time for 2013940 obervations: 0.032961756 ms
- * INFO: Average Remove All Time for 894820 observations: 0.10991708 ms
- * INFO: Average keySet Time for 114488 observations: 0.8662655 ms
- *
- * Aug 12, 2011 11:32:38 AM with Java 6 Agent sizeof with list of stacktraces value
- * INFO: Average Put Time for 753610 obervations: 0.119633496 ms
- */
- @Test
- public void testConcurrentReadWriteRemoveLRU() throws Exception {
- testConcurrentReadWriteRemove(MemoryStoreEvictionPolicy.LRU);
- }
-
- /**
- *
- * Orig.
- * INFO: Average Get Time: 1.2396777 ms
- * INFO: Average Put Time: 1.4968935 ms
- * INFO: Average Remove Time: 1.3399061 ms
- * INFO: Average Remove All Time: 0.22590445 ms
- * INFO: Average keySet Time: 0.20492058 ms
- *
- * INFO: Average Get Time: 1.081209 ms
- * INFO: Average Put Time: 1.2307026 ms
- * INFO: Average Remove Time: 1.1294961 ms
- * INFO: Average Remove All Time: 0.16385451 ms
- * INFO: Average keySet Time: 0.1549516 ms
- *
- * CHM version with no sync on get.
- * INFO: Average Get Time for 2582432 observations: 0.019930825 ms
- * INFO: Average Put Time for 297 obervations: 41.40404 ms
- * INFO: Average Remove Time for 1491 obervations: 13.892018 ms
- * INFO: Average Remove All Time for 135893 observations: 0.54172766 ms
- * INFO: Average keySet Time for 112686 observations: 0.7157411 ms
- *
- * 1.6
- * INFO: Average Get Time for 4984448 observations: 0.006596317 ms
- * INFO: Average Put Time for 7266 obervations: 0.42361686 ms
- * INFO: Average Remove Time for 2024066 obervations: 0.012883473 ms
- * INFO: Average Remove All Time for 3572412 observations: 8.817572E-5 ms
- * INFO: Average keySet Time for 2653539 observations: 0.002160511 ms
- * INFO: Total loads: 38
- *
- * With iterator
- * 1.6 with 100,000 store size: puts take 45ms. keySet 7ms
- * 1.6 with 1000,000 store size: puts take 381ms. keySet 7ms
- * 1,000,000 - using FastRandom (j.u.Random was dog slow)
- * INFO: Average Get Time for 2065131 observations: 0.013553619 ms
- * INFO: Average Put Time for 46404 obervations: 0.1605034 ms
- * INFO: Average Remove Time for 20515 obervations: 0.1515964 ms
- * INFO: Average Remove All Time for 0 observations: NaN ms
- * INFO: Average keySet Time for 198 observations: 0.0 ms
- *
- * 9999 - using iterator
- * INFO: Average Get Time for 4305030 observations: 0.006000423 ms
- * INFO: Average Put Time for 3216 obervations: 0.92008704 ms
- * INFO: Average Remove Time for 5294 obervations: 0.048545524 ms
- * INFO: Average Remove All Time for 0 observations: NaN ms
- * INFO: Average keySet Time for 147342 observations: 0.5606073 ms
- * 10001 - using FastRandom
- * INFO: Average Get Time for 4815249 observations: 0.005541354 ms
- * INFO: Average Put Time for 5186 obervations: 0.49826455 ms
- * INFO: Average Remove Time for 129163 obervations: 0.015120429 ms
- * INFO: Average Remove All Time for 0 observations: NaN ms
- * INFO: Average keySet Time for 177342 observations: 0.500733 ms
- * 4999 - using iterator
- * INFO: Average Get Time for 4317409 observations: 0.0061599445 ms
- * INFO: Average Put Time for 2708 obervations: 1.0768094 ms
- * INFO: Average Remove Time for 17664 obervations: 0.11713089 ms
- * INFO: Average Remove All Time for 0 observations: NaN ms
- * INFO: Average keySet Time for 321180 observations: 0.26723954 ms
- * 5001 - using FastRandom
- * INFO: Average Get Time for 3203904 observations: 0.0053447294 ms
- * INFO: Average Put Time for 152905 obervations: 0.056616854 ms
- * INFO: Average Remove Time for 737289 obervations: 0.008854059 ms
- * INFO: Average Remove All Time for 0 observations: NaN ms
- * INFO: Average keySet Time for 272898 observations: 0.3118601 ms
- *
- * @throws Exception
- */
- @Test
- public void testConcurrentReadWriteRemoveLFU() throws Exception {
- testConcurrentReadWriteRemove(MemoryStoreEvictionPolicy.LFU);
- }
-
- /**
- * INFO: Average Get Time: 0.28684255 ms
- * INFO: Average Put Time: 0.34759903 ms
- * INFO: Average Remove Time: 0.31298608 ms
- * INFO: Average Remove All Time: 0.21396147 ms
- * INFO: Average keySet Time: 0.11740683 ms
- *
- * CLHM
- * INFO: Average Get Time for 4567959 observations: 0.005231658 ms
- * INFO: Average Put Time for 437078 obervations: 0.01527645 ms
- * INFO: Average Remove Time for 178915 obervations: 0.013335941 ms
- * INFO: Average Remove All Time for 3500724 observations: 0.0070434003 ms
- * INFO: Average keySet Time for 3207776 observations: 0.011053764 ms
- */
- @Test
- public void testConcurrentReadWriteRemoveFIFO() throws Exception {
- testConcurrentReadWriteRemove(MemoryStoreEvictionPolicy.FIFO);
- }
-
- public void testConcurrentReadWriteRemove(MemoryStoreEvictionPolicy policy) throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testConcurrentReadWriteRemove"));
- try {
- final int size = 10000;
- //set it higher for normal continuous integration so occasional higher numbes do not break tests
- final int maxTime = (int) (500 * StopWatch.getSpeedAdjustmentFactor());
- CacheConfiguration cacheConfigurationTest3Cache = new CacheConfiguration("test3cache", size)
- .eternal(true).memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU).overflowToDisk(false)
- .statistics(false);
- // CacheConfiguration cacheConfigurationTest3Cache = new CacheConfiguration()
- // .name("test3cache").maxBytesLocalHeap(40, MemoryUnit.MEGABYTES)
- // .eternal(true).memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU).overflowToDisk(false)
- // .statistics(false);
- manager.addCache(new Cache(cacheConfigurationTest3Cache));
- final Ehcache cache = manager.getEhcache("test3cache");
-
- System.gc();
- Thread.sleep(500);
- System.gc();
- Thread.sleep(500);
-
- final AtomicLong getTimeSum = new AtomicLong();
- final AtomicLong getTimeCount = new AtomicLong();
- final AtomicLong putTimeSum = new AtomicLong();
- final AtomicLong putTimeCount = new AtomicLong();
- final AtomicLong removeTimeSum = new AtomicLong();
- final AtomicLong removeTimeCount = new AtomicLong();
- final AtomicLong removeAllTimeSum = new AtomicLong();
- final AtomicLong removeAllTimeCount = new AtomicLong();
- final AtomicLong keySetTimeSum = new AtomicLong();
- final AtomicLong keySetTimeCount = new AtomicLong();
-
- // TODO : Reenable that somehow!
- // CountingCacheLoader countingCacheLoader = new CountingCacheLoader();
- // cache.registerCacheLoader(countingCacheLoader);
-
- final List executables = new ArrayList();
- final Random random = new Random();
-
- ArrayList list = new ArrayList();
- StackTraceElement[] stackTraceElements;
- try {
- throw new CacheException("test");
- } catch (CacheException e) {
- stackTraceElements = e.getStackTrace();
- }
- for (int i = 0; i < 1000; i++) {
- list.add(stackTraceElements);
- }
-
- for (int i = 0; i < size; i++) {
- cache.put(new Element("" + i, "value"));
- // cache.put(new Element("" + i, list));
- }
-
- //some of the time get data
- for (int i = 0; i < 26; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- cache.get("key" + random.nextInt(size));
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- assertTrue("Get time outside of allowed range: " + elapsed, elapsed < maxTime);
- getTimeSum.getAndAdd(elapsed);
- getTimeCount.getAndIncrement();
- }
- };
- executables.add(executable);
- }
-
- //some of the time add data
- for (int i = 0; i < 10; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- cache.put(new Element("key" + random.nextInt(size), "value"));
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- assertTrue("Put time outside of allowed range: " + elapsed, elapsed < maxTime);
- putTimeSum.getAndAdd(elapsed);
- putTimeCount.getAndIncrement();
- }
- };
- executables.add(executable);
- }
-
- //some of the time remove the data
- for (int i = 0; i < 7; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- cache.remove("key" + random.nextInt(size));
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- assertTrue("Remove time outside of allowed range: " + elapsed, elapsed < maxTime);
- removeTimeSum.getAndAdd(elapsed);
- removeTimeCount.getAndIncrement();
- }
- };
- executables.add(executable);
- }
-
-
- //some of the time removeAll the data
- for (int i = 0; i < 10; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- int randomInteger = random.nextInt(20);
- if (randomInteger == 3) {
- cache.removeAll();
- }
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- //remove all is slower
- assertTrue("RemoveAll time outside of allowed range: " + elapsed, elapsed < (maxTime * 3));
- removeAllTimeSum.getAndAdd(elapsed);
- removeAllTimeCount.getAndIncrement();
- }
- };
- executables.add(executable);
- }
-
-
- //some of the time iterate
- for (int i = 0; i < 10; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- int randomInteger = random.nextInt(20);
- if (randomInteger == 3) {
- cache.getKeys();
- }
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- //remove all is slower
- assertTrue("cache.getKeys() time outside of allowed range: " + elapsed, elapsed < (maxTime * 3));
- keySetTimeSum.getAndAdd(elapsed);
- keySetTimeCount.getAndIncrement();
- }
- };
- executables.add(executable);
- }
-
- //some of the time exercise the loaders through their various methods. Loader methods themselves make no performance
- //guarantees. They should only lock the cache when doing puts and gets, which the time limits on the other threads
- //will check for.
- for (int i = 0; i < 4; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- int randomInteger = random.nextInt(20);
- List keys = new ArrayList();
- for (int i = 0; i < 2; i++) {
- keys.add("key" + random.nextInt(size));
- }
- if (randomInteger == 1) {
- cache.load("key" + random.nextInt(size));
- } else if (randomInteger == 2) {
- cache.loadAll(keys, null);
- } else if (randomInteger == 3) {
- cache.getWithLoader("key" + random.nextInt(size), null, null);
- } else if (randomInteger == 4) {
- cache.getAllWithLoader(keys, null);
- }
- }
- };
- executables.add(executable);
- }
-
-
- try {
- int failures = AbstractCacheTest.runThreadsNoCheck(executables);
- LOG.info(failures + " failures");
- //CHM does have the occasional very slow time.
- assertTrue("Failures = " + failures, failures <= 50);
- } finally {
- LOG.info("Average Get Time for " + getTimeCount.get() + " observations: "
- + getTimeSum.floatValue() / getTimeCount.get() + " ms");
- LOG.info("Average Put Time for " + putTimeCount.get() + " obervations: "
- + putTimeSum.floatValue() / putTimeCount.get() + " ms");
- LOG.info("Average Remove Time for " + removeTimeCount.get() + " obervations: "
- + removeTimeSum.floatValue() / removeTimeCount.get() + " ms");
- LOG.info("Average Remove All Time for " + removeAllTimeCount.get() + " observations: "
- + removeAllTimeSum.floatValue() / removeAllTimeCount.get() + " ms");
- LOG.info("Average keySet Time for " + keySetTimeCount.get() + " observations: "
- + keySetTimeSum.floatValue() / keySetTimeCount.get() + " ms");
- // LOG.info("Total loads: " + countingCacheLoader.getLoadCounter());
- // LOG.info("Total loadAlls: " + countingCacheLoader.getLoadAllCounter());
- }
- } finally {
- manager.shutdown();
- }
- }
-
-
- /**
- * Multi-thread read-write test with 20 threads
- * Just use MemoryStore to put max stress on cache
- * Values that work:
- *
- * Results 3/2/09
- * Feb 3, 2009 5:57:35 PM net.sf.ehcache.CacheTest testConcurrentReadPerformanceMemoryOnly
- * INFO: 400 threads. Average Get time: 0.033715356 ms
- * INFO: 800 threads. Average Get time: 18.419634 ms
- * INFO: 1200 threads. Average Get time: 56.21161 ms
- * INFO: 1600 threads. Average Get time: 85.19998 ms
- * INFO: 2000 threads. Average Get time: 85.83994 ms
- *
- * With ConcurrentHashMap
- *
- * INFO: 1 threads. Average Get time: 0.082987554 ms
- * INFO: 401 threads. Average Get time: 0.0070842816 ms
- * INFO: 801 threads. Average Get time: 0.0066290447 ms
- * INFO: 1201 threads. Average Get time: 0.0063261427 ms
- * INFO: 1601 threads. Average Get time: 0.005570657 ms
- * INFO: 2001 threads. Average Get time: 0.015918251 ms
- *
- * v207
- * INFO: 1 threads. Average Get time: 0.051759835 ms
- * INFO: 401 threads. Average Get time: 0.0118925795 ms
- * INFO: 801 threads. Average Get time: 0.021494854 ms
- * INFO: 1201 threads. Average Get time: 0.07880102 ms
- * INFO: 1601 threads. Average Get time: 0.067811936 ms
- * INFO: 2001 threads. Average Get time: 0.12559706 ms
- *
- * Before AtomicLong
- * INFO: 1 threads. Average Get time: 0.024948025 ms
- * INFO: 401 threads. Average Get time: 0.0079776095 ms
- * INFO: 801 threads. Average Get time: 0.0049358485 ms
- * INFO: 1201 threads. Average Get time: 0.059032038 ms
- * INFO: 1601 threads. Average Get time: 0.039221533 ms
- * INFO: 2001 threads. Average Get time: 0.03138067 ms
- *
- * INFO: 1 threads. Average Get time: 0.039014373 ms
- * INFO: 401 threads. Average Get time: 0.005683447 ms
- * INFO: 801 threads. Average Get time: 0.0041153855 ms
- * INFO: 1201 threads. Average Get time: 0.02003592 ms
- * INFO: 1601 threads. Average Get time: 0.039240483 ms
- * INFO: 2001 threads. Average Get time: 0.04503215 ms
- *
- * INFO: 1 threads. Average Get time: 0.026694044 ms
- * INFO: 401 threads. Average Get time: 0.0076737576 ms
- * INFO: 801 threads. Average Get time: 0.003894474 ms
- * INFO: 1201 threads. Average Get time: 0.06022612 ms
- * INFO: 1601 threads. Average Get time: 0.03710788 ms
- * INFO: 2001 threads. Average Get time: 0.064271376 ms
- *
- * After AtomicLong counters
- * INFO: 1 threads. Average Get time: 0.02566735 ms
- * INFO: 401 threads. Average Get time: 0.0054228795 ms
- * INFO: 801 threads. Average Get time: 0.0046341107 ms
- * INFO: 1201 threads. Average Get time: 0.075431876 ms
- * INFO: 1601 threads. Average Get time: 0.10669952 ms
- * INFO: 2001 threads. Average Get time: 0.051209673 ms
- *
- * INFO: 1 threads. Average Get time: 0.028481012 ms
- * INFO: 401 threads. Average Get time: 0.003833565 ms
- * INFO: 801 threads. Average Get time: 0.005232163 ms
- * INFO: 1201 threads. Average Get time: 0.06157142 ms
- * INFO: 1601 threads. Average Get time: 0.08064302 ms
- * INFO: 2001 threads. Average Get time: 0.048335962 ms
- *
- *
- *
- */
- @Test
- public void testConcurrentReadPerformanceMemoryOnly() throws Exception {
- CacheManager manager = new CacheManager(new Configuration().name("testConcurrentReadPerformanceMemoryOnly"));
- try {
-
- final int size = 10000;
-
- manager.addCache(new Cache("test3cache", size, false, true, 1000, 1000));
- final Ehcache cache = manager.getEhcache("test3cache");
- final Vector readTimes = new Vector();
-
-
- for (int threads = 1; threads <= 2100; threads += 400) {
-
- readTimes.clear();
-
- final List executables = new ArrayList();
- final Random random = new Random();
-
- for (int i = 0; i < size; i++) {
- cache.put(new Element("" + i, "value"));
- }
-
- //some of the time get data
- for (int i = 0; i < threads; i++) {
- final AbstractCacheTest.Executable executable = new AbstractCacheTest.Executable() {
- public void execute() throws Exception {
- final StopWatch stopWatch = new StopWatch();
- long start = stopWatch.getElapsedTime();
- cache.get("key" + random.nextInt(size));
- long end = stopWatch.getElapsedTime();
- long elapsed = end - start;
- readTimes.add(elapsed);
- Thread.sleep(10);
- }
- };
- executables.add(executable);
- }
-
-
- int failures = AbstractCacheTest.runThreadsNoCheck(executables);
- LOG.info(failures + " failures");
- assertTrue(failures == 0);
- long totalReadTime = 0;
- for (Long readTime : readTimes) {
- totalReadTime += readTime;
- }
- LOG.info(threads + " threads. Average Get time: " + totalReadTime / (float) readTimes.size() + " ms");
-
- }
- } finally {
- manager.shutdown();
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTestClient.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTestClient.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTestClient.java (revision 0)
@@ -1,74 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests.servermap;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.toolkit.Toolkit;
-
-import java.util.Date;
-
-public class ServerMapL1CapacityEvictionExpressTestClient extends ServerMapClientBase {
-
- public ServerMapL1CapacityEvictionExpressTestClient(String[] args) {
- super("testWithMaxElementsInMemory", args);
- }
-
- public static void main(String[] args) {
- new ServerMapL1CapacityEvictionExpressTestClient(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
- assertLocalCache(true);
- int size = cache.getSize();
- assertEquals(0, size);
- System.out.println("Client populating cache.");
- for (int i = 0; i < 5100; i++) {
- cache.put(new Element("key-" + i, "value-" + i));
- }
-
- System.out.println("Cache populated. Sleeping for 3 secs. size: " + cache.getSize() + " inMemorySize: "
- + cache.getStatistics().getLocalHeapSize());
- Thread.sleep(3000);
-
- System.out.println("After sleeping 3 secs. size: " + cache.getSize() + " inMemorySize: "
- + cache.getStatistics().getLocalHeapSize());
- // assert range as some may have got evicted while populating cache
- assertRange(4500, 5100, cache.getSize());
- assertRange(0, 5100, cache.getStatistics().getLocalHeapSize());
-
- // add some more elements, to get eviction kicking if not already
- for (int i = 5100; i < 5200; i++) {
- cache.put(new Element("key-" + i, "value-" + i));
- }
-
- System.out.println("After adding 100 more. size: " + cache.getSize() + " inMemorySize: "
- + cache.getStatistics().getLocalHeapSize());
-
- System.out.println("Sleeping for 1.5 mins (now=" + new Date() + ") ... ");
- // Wait a bit for the capacity evictor to do its thing.
- Thread.sleep(15 * 6 * 1000);
-
- System.out.println("After sleeping for 1.5 mins. Size: " + cache.getSize() + " inMemorySize: "
- + cache.getStatistics().getLocalHeapSize());
- // l1 cacacity evicts 20% extra of maxInMemory
- assertRange(0, 5000, cache.getStatistics().getLocalHeapSize());
-
- }
-
- private void assertRange(int min, int max, long actual) {
- assertTrue("assert range failed: min: " + min + " max: " + max + " actual: " + actual, min <= actual
- && actual <= max);
- }
-
- private void assertLocalCache(boolean enabled) throws Exception {
- String expected = enabled ? "true" : "false";
- String property = System.getProperty("com.tc.ehcache.storageStrategy.dcv2.localcache.enabled");
- if (property == null || !expected.equalsIgnoreCase(property)) { throw new Exception(
- "This client needs to be run with local cache enabled"); }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentB.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentB.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentB.java (revision 0)
@@ -1,49 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.loader;
-
-/**
- * Written for Dead-lock poc
- *
- * @author Greg Luck
- * @version $Id: ComponentB.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public class ComponentB {
-
- private String name;
-
- /**
- * @param name
- */
- public ComponentB(String name) {
- this.name = name;
- }
-
- /**
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- * @return
- */
- public String toString() {
- return "B(" + name + ")";
- }
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/VersionedItem.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/VersionedItem.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/VersionedItem.java (revision 0)
@@ -1,16 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.hibernate.domain;
-
-public class VersionedItem extends Item {
- private Long version;
-
- public Long getVersion() {
- return version;
- }
-
- public void setVersion(Long version) {
- this.version = version;
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/resources/ehcache-defaultonly.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/resources/ehcache-defaultonly.xml (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/resources/ehcache-defaultonly.xml (revision 0)
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/terracotta/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/terracotta/package.html (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/terracotta/package.html (revision 0)
@@ -1,7 +0,0 @@
-
-
-
-
- This package contains the Terracotta integration functionalities.
-
-
\ No newline at end of file
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/util/TimeUtil.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/util/TimeUtil.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/util/TimeUtil.java (revision 0)
@@ -1,64 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.util;
-
-/**
- * Utilities for converting times
- * @author Greg Luck
- */
-public class TimeUtil {
-
- /**
- * Constant that contains the amount of milliseconds in a second
- */
- static final long ONE_SECOND = 1000L;
-
- /**
- * Converts milliseconds to seconds
- * @param timeInMillis
- * @return The equivalent time in seconds
- */
- public static int toSecs(long timeInMillis) {
- // Rounding the result to the ceiling, otherwise a
- // System.currentTimeInMillis that happens right before a new Element
- // instantiation will be seen as 'later' than the actual creation time
- return (int)Math.ceil((double)timeInMillis / ONE_SECOND);
- }
-
- /**
- * Converts seconds to milliseconds, with a precision of 1 second
- * @param timeInSecs the time in seconds
- * @return The equivalent time in milliseconds
- */
- public static long toMillis(int timeInSecs) {
- return timeInSecs * ONE_SECOND;
- }
-
- /**
- * Converts a long seconds value to an int seconds value and takes into account overflow
- * from the downcast by switching to Integer.MAX_VALUE.
- * @param seconds Long value
- * @return Same int value unless long {@code >} Integer.MAX_VALUE in which case MAX_VALUE is returned
- */
- public static int convertTimeToInt(long seconds) {
- if (seconds > Integer.MAX_VALUE) {
- return Integer.MAX_VALUE;
- } else {
- return (int) seconds;
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/MaxDepthExceededException.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/MaxDepthExceededException.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/MaxDepthExceededException.java (revision 0)
@@ -1,50 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.pool.sizeof;
-
-/**
- * @author Ludovic Orban
- */
-public class MaxDepthExceededException extends RuntimeException {
-
- private long measuredSize;
-
- /**
- * Constructor
- */
- public MaxDepthExceededException(String msg) {
- super(msg);
- }
-
- /**
- * Add to the partially measured size
- *
- * @param toAdd
- */
- public void addToMeasuredSize(long toAdd) {
- measuredSize += toAdd;
- }
-
- /**
- * Get the partially measured size
- *
- * @return
- */
- public long getMeasuredSize() {
- return measuredSize;
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/statistics/StatisticBuilder.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/statistics/StatisticBuilder.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/statistics/StatisticBuilder.java (revision 0)
@@ -1,141 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.statistics;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.terracotta.statistics.StatisticsManager;
-import org.terracotta.statistics.observer.OperationObserver;
-
-/**
- * The StatisticBuilder.
- *
- * @author cdennis
- */
-public final class StatisticBuilder {
-
- /**
- * Instantiates a new statistic builder.
- */
- private StatisticBuilder() {
-
- }
-
- /**
- * Operation.
- *
- * @param the generic type
- * @param type the type
- * @return the operation statistic builder
- */
- public static > OperationStatisticBuilder operation(Class type) {
- return new OperationStatisticBuilder(type);
- }
-
- /**
- * The Class OperationStatisticBuilder.
- *
- * @param the generic type
- */
- public static class OperationStatisticBuilder> extends AbstractStatisticBuilder> {
-
- /** The type. */
- private final Class type;
-
- /**
- * Instantiates a new operation statistic builder.
- *
- * @param type the type
- */
- public OperationStatisticBuilder(Class type) {
- this.type = type;
- }
-
- /**
- * Builds the.
- *
- * @return the operation observer
- */
- public OperationObserver build() {
- if (context == null || name == null) {
- throw new IllegalStateException();
- } else {
- return StatisticsManager.createOperationStatistic(context, name, tags, type);
- }
- }
- }
-
- /**
- * The Class AbstractStatisticBuilder.
- *
- * @param the generic type
- */
- static class AbstractStatisticBuilder {
-
- /** The tags. */
- protected final Set tags = new HashSet();
-
- /** The context. */
- protected Object context;
-
- /** The name. */
- protected String name;
-
- /**
- * Of.
- *
- * @param of the of
- * @return the t
- */
- public T of(Object of) {
- if (context == null) {
- context = of;
- return (T) this;
- } else {
- throw new IllegalStateException("Context already defined");
- }
- }
-
- /**
- * Named.
- *
- * @param name the name
- * @return the t
- */
- public T named(String name) {
- if (this.name == null) {
- this.name = name;
- return (T) this;
- } else {
- throw new IllegalStateException("Name already defined");
- }
- }
-
- /**
- * Tag.
- *
- * @param tags the tags
- * @return the t
- */
- public T tag(String ... tags) {
- Collections.addAll(this.tags, tags);
- return (T) this;
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/transaction/xa/XATransactionTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/transaction/xa/XATransactionTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/transaction/xa/XATransactionTest.java (revision 0)
@@ -1,230 +0,0 @@
-package net.sf.ehcache.transaction.xa;
-
-import bitronix.tm.BitronixTransaction;
-import bitronix.tm.TransactionManagerServices;
-import bitronix.tm.internal.TransactionStatusChangeListener;
-import bitronix.tm.recovery.Recoverer;
-import bitronix.tm.resource.ResourceRegistrar;
-import bitronix.tm.resource.common.XAResourceProducer;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.CacheStoreHelper;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.store.TxCopyingCacheStore;
-import net.sf.ehcache.transaction.TransactionTimeoutException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.transaction.Status;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
-/**
- * @author Ludovic Orban
- */
-public class XATransactionTest extends TestCase {
-
- private static final Logger LOG = LoggerFactory.getLogger(XATransactionTest.class);
-
- private TransactionManager tm;
- private CacheManager cacheManager;
- private Ehcache cache1;
- private Ehcache cache2;
-
- @Override
- protected void setUp() throws Exception {
- TransactionManagerServices.getConfiguration().setJournal("null").setGracefulShutdownInterval(0).setBackgroundRecoveryIntervalSeconds(1);
-
- tm = TransactionManagerServices.getTransactionManager();
- cacheManager = new CacheManager(XATransactionTest.class.getResourceAsStream("/ehcache-tx-twopc.xml"));
-
- cache1 = cacheManager.getEhcache("txCache1");
- cache2 = cacheManager.getEhcache("txCache2");
- tm.begin();
-
- cache1.removeAll();
- cache2.removeAll();
-
- tm.commit();
- }
-
- @Override
- protected void tearDown() throws Exception {
- if (tm.getTransaction() != null) {
- tm.rollback();
- }
- cacheManager.shutdown();
- TransactionManagerServices.getTransactionManager().shutdown();
- }
-
- public void testSimple() throws Exception {
- LOG.info("******* START");
-
- tm.begin();
- cache1.get(1);
- cache1.put(new Element(1, "one"));
- tm.commit();
-
- tm.begin();
- Element e = cache1.get(1);
- assertEquals("one", e.getObjectValue());
- cache1.remove(1);
- e = cache1.get(1);
- assertNull(e);
- int size = cache1.getSize();
- assertEquals(0, size);
- tm.rollback();
-
- tm.begin();
- e = cache1.get(1);
- assertEquals("one", e.getObjectValue());
-
- tm.rollback();
-
- LOG.info("******* END");
- }
-
- public void testRecoveryWhileTransactionsAreLive() throws Exception {
- tm.begin();
-
- BitronixTransaction transaction = (BitronixTransaction)tm.getTransaction();
- transaction.addTransactionStatusChangeListener(new TransactionStatusChangeListener() {
- @Override
- public void statusChanged(int oldStatus, int newStatus) {
- if (oldStatus == Status.STATUS_PREPARED) {
- try {
- //
- // the BTM recoverer must not run while we mess with the internal BTM structures
- // so cancel it and wait until it doesn't run anymore
- Recoverer recoverer = TransactionManagerServices.getRecoverer();
- TransactionManagerServices.getTaskScheduler().cancelRecovery(recoverer);
- while (recoverer.isRunning()) {
- try { Thread.sleep(100); } catch (InterruptedException e) { /* ignore */ }
- }
-
- XAResourceProducer txCache1Producer = ResourceRegistrar.get("txCache1");
- XAResource xaResource1 = txCache1Producer.startRecovery().getXAResource();
- Xid[] recoveredXids1 = xaResource1.recover(XAResource.TMSTARTRSCAN);
- txCache1Producer.endRecovery();
-
- XAResourceProducer txCache2Producer = ResourceRegistrar.get("txCache2");
- XAResource xaResource2 = txCache2Producer.startRecovery().getXAResource();
- Xid[] recoveredXids2 = xaResource2.recover(XAResource.TMSTARTRSCAN);
- txCache1Producer.endRecovery();
-
- // recover should not return XIDs of active transactions
- assertEquals(0, recoveredXids1.length);
- assertEquals(0, recoveredXids2.length);
-
- // reschedule the BTM recoverer
- //
- TransactionManagerServices.getTaskScheduler().scheduleRecovery(recoverer, new java.util.Date());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- });
-
- cache1.put(new Element(1, "one"));
- cache2.put(new Element(1, "one"));
- tm.commit();
- }
-
- public void testPutDuring2PC() throws Exception {
- tm.begin();
-
- cache1.put(new Element(1, "one"));
- // 1PC bypasses 1st phase -> enlist a 2nd resource to prevent it
- cache2.put(new Element(1, "one"));
-
- BitronixTransaction tx = (BitronixTransaction) tm.getTransaction();
-
- tx.addTransactionStatusChangeListener(new TransactionStatusChangeListener() {
- public void statusChanged(int oldStatus, int newStatus) {
- if (oldStatus == Status.STATUS_PREPARED) {
-
- TxThread t = new TxThread() {
- @Override
- public void exec() throws Exception {
- tm.setTransactionTimeout(1);
- tm.begin();
-
- try {
- cache1.put(new Element(1, "one#2"));
- fail("expected TransactionTimeoutException");
- } catch (TransactionTimeoutException e) {
- // expected
- }
- tm.rollback();
- }
- };
- t.start();
- t.joinAndAssertNotFailed();
- }
- }
- });
-
- tm.commit();
- }
-
- public void testGetOldElementFromStore() throws Exception {
- Cache txCache = (Cache)cache1;
-
- CacheStoreHelper cacheStoreHelper = new CacheStoreHelper(txCache);
- TxCopyingCacheStore store = (TxCopyingCacheStore)cacheStoreHelper.getStore();
-
- Element one = new Element(1, "one");
- tm.begin();
- txCache.put(one);
- tm.commit();
-
- Element oneUp = new Element(1, "oneUp");
- tm.begin();
- txCache.put(oneUp);
- assertEquals(one, store.getOldElement(1));
- tm.commit();
-
- assertEquals(oneUp, store.getOldElement(1));
- }
-
-
-
- private static class TxThread extends Thread {
- private volatile boolean failed;
-
- @Override
- public final void run() {
- try {
- exec();
- } catch (Throwable t) {
- t.printStackTrace();
- failed = true;
- }
- }
-
- public void exec() throws Exception {
- }
-
- public void joinAndAssertNotFailed() {
- try {
- join();
- } catch (InterruptedException e) {
- // ignore
- }
- assertNotFailed();
- }
-
- public void assertNotFailed() {
- if (failed) {
- throw new AssertionFailedError("TxThread failed");
- }
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MAttribute.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MAttribute.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MAttribute.java (revision 0)
@@ -1,179 +0,0 @@
-/**
- * Copyright Terracotta, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions and limitations under the
- * License.
- */
-package net.sf.ehcache.search.parser;
-
-import net.sf.ehcache.search.Attribute;
-import net.sf.ehcache.search.Query;
-
-public class MAttribute implements ModelElement> {
-
- /**
- * The name.
- */
- private final String name;
-
- /**
- * Is this the key.
- */
- private final boolean isKey;
-
- /**
- * Is this the value.
- */
- private final boolean isValue;
-
- private final boolean isStar;
-
- /**
- * The key.
- */
- public static MAttribute KEY = new MAttribute("key", true, false, false);
-
- /**
- * The value.
- */
- public static MAttribute VALUE = new MAttribute("value", false, true, false);
-
- /**
- * Star for doing count(*)
- */
- public static MAttribute STAR = new MAttribute("star", false, false, true);
-
- /**
- * Instantiates a new attribute.
- *
- * @param name the name
- * @param k the k
- * @param v the v
- */
- private MAttribute(String name, boolean k, boolean v, boolean isStar) {
- this.name = name;
- isKey = k;
- isValue = v;
- this.isStar = isStar;
- }
-
- /**
- * Instantiates a new named attribute.
- *
- * @param name the name
- */
- public MAttribute(String name) {
- this(name, false, false, false);
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Checks if is key.
- *
- * @return true, if is key
- */
- public boolean isKey() {
- return isKey;
- }
-
- /**
- * Checks if is value.
- *
- * @return true, if is value
- */
- public boolean isValue() {
- return isValue;
- }
-
- /**
- * Checks if is star.
- *
- * @return true, if is star
- */
- public boolean isStar() {
- return isStar;
- }
-
- /**
- * As ehcache attribute string.
- *
- * @return the string
- */
- public String asEhcacheAttributeString() {
- if (isKey() || isStar()) {
- return Query.KEY.getAttributeName();
- } else if (isValue()) {
- return Query.VALUE.getAttributeName();
- } else {
- return name;
- }
- }
-
- /**
- * Get this model attribute as an ehcache attribute.
- *
- * @return the attribute
- */
-
- @SuppressWarnings("rawtypes")
- public Attribute> asEhcacheObject(ClassLoader loader) {
- if (isKey() || isStar()) {
- return Query.KEY;
- } else if (isValue()) {
- return Query.VALUE;
- } else {
- return new Attribute(name);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- if (isKey()) {
- return name;
- } else if (isValue()) {
- return name;
- } else {
- return "'" + name + "'";
- }
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (isKey ? 1231 : 1237);
- result = prime * result + (isValue ? 1231 : 1237);
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null) return false;
- if (getClass() != obj.getClass()) return false;
- MAttribute other = (MAttribute)obj;
- if (isKey != other.isKey) return false;
- if (isValue != other.isValue) return false;
- if (name == null) {
- if (other.name != null) return false;
- } else if (!name.equals(other.name)) return false;
- return true;
-
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/Client5.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/Client5.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/Client5.java (revision 0)
@@ -1,27 +0,0 @@
-package org.terracotta.ehcache.tests.servermap;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.toolkit.Toolkit;
-
-public class Client5 extends ServerMapClientBase {
-
- public Client5(String[] args) {
- super("test", args);
- }
-
- public static void main(String[] args) {
- new Client5(args).run();
- }
-
- @Override
- protected void runTest(final Cache cache, final Toolkit clusteringToolkit) throws Throwable {
- BasicServerMapExpressTestHelper.populateCache(cache);
- cache.put(new Element("client1-exited", "true"));
-
- cache.getCacheManager().getCache("defaultStorageStrategyCache");
-
- System.out.println("Asserted different/explicit storage strategys");
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernate.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernate.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernate.java (revision 0)
@@ -1,589 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.hibernate.management.impl;
-
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.management.MBeanNotificationInfo;
-import javax.management.NotCompliantMBeanException;
-import javax.management.Notification;
-import javax.management.openmbean.TabularData;
-
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.hibernate.management.api.EhcacheHibernateMBean;
-import net.sf.ehcache.hibernate.management.api.EhcacheStats;
-import net.sf.ehcache.hibernate.management.api.HibernateStats;
-
-import org.hibernate.SessionFactory;
-
-/**
- * Implementation of the {@link EhcacheHibernateMBean}
- *
- *
- *
- * @author Abhishek Sanoujam
- *
- */
-public class EhcacheHibernate extends BaseEmitterBean implements EhcacheHibernateMBean {
- private static final MBeanNotificationInfo NOTIFICATION_INFO;
-
- private final AtomicBoolean statsEnabled = new AtomicBoolean(true);
- private EhcacheStats ehcacheStats;
- private volatile HibernateStats hibernateStats = NullHibernateStats.INSTANCE;
-
- static {
- final String[] notifTypes = new String[] {};
- final String name = Notification.class.getName();
- final String description = "Ehcache Hibernate Statistics Event";
- NOTIFICATION_INFO = new MBeanNotificationInfo(notifTypes, name, description);
- }
-
- /**
- * Constructor accepting the backing {@link CacheManager}
- *
- * @param manager
- * the backing {@link CacheManager}
- * @throws NotCompliantMBeanException
- */
- public EhcacheHibernate(CacheManager manager) throws NotCompliantMBeanException {
- super(EhcacheHibernateMBean.class);
- ehcacheStats = new EhcacheStatsImpl(manager);
- }
-
- /**
- * Enable hibernate statistics with the input session factory
- *
- */
- public void enableHibernateStatistics(SessionFactory sessionFactory) {
- try {
- hibernateStats = new HibernateStatsImpl(sessionFactory);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public boolean isHibernateStatisticsSupported() {
- return hibernateStats instanceof HibernateStatsImpl;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setStatisticsEnabled(boolean flag) {
- if (flag) {
- hibernateStats.enableStats();
- } else {
- hibernateStats.disableStats();
- }
- statsEnabled.set(flag);
- sendNotification(HibernateStats.CACHE_STATISTICS_ENABLED, flag);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isStatisticsEnabled() {
- return statsEnabled.get();
- }
-
- /**
- * {@inheritDoc}
- */
- public void clearStats() {
- hibernateStats.clearStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public void disableStats() {
- setStatisticsEnabled(false);
- }
-
- /**
- * {@inheritDoc}
- */
- public void enableStats() {
- setStatisticsEnabled(true);
- }
-
- /**
- * {@inheritDoc}
- */
- public void flushRegionCache(String region) {
- ehcacheStats.flushRegionCache(region);
- sendNotification(HibernateStats.CACHE_REGION_FLUSHED, region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void flushRegionCaches() {
- ehcacheStats.flushRegionCaches();
- sendNotification(HibernateStats.CACHE_FLUSHED);
- }
-
- /**
- * {@inheritDoc}
- */
- public String generateActiveConfigDeclaration() {
- return ehcacheStats.generateActiveConfigDeclaration();
- }
-
- /**
- * {@inheritDoc}
- */
- public String generateActiveConfigDeclaration(String region) {
- return ehcacheStats.generateActiveConfigDeclaration(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCacheHitCount() {
- return ehcacheStats.getCacheHitCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public double getCacheHitRate() {
- return ehcacheStats.getCacheHitRate();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCacheHitSample() {
- return ehcacheStats.getCacheHitSample();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCacheMissCount() {
- return ehcacheStats.getCacheMissCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public double getCacheMissRate() {
- return ehcacheStats.getCacheMissRate();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCacheMissSample() {
- return ehcacheStats.getCacheMissSample();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCachePutCount() {
- return ehcacheStats.getCachePutCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public double getCachePutRate() {
- return ehcacheStats.getCachePutRate();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCachePutSample() {
- return ehcacheStats.getCachePutSample();
- }
-
- /**
- * {@inheritDoc}
- */
- public TabularData getCacheRegionStats() {
- return hibernateStats.getCacheRegionStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getCloseStatementCount() {
- return hibernateStats.getCloseStatementCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public TabularData getCollectionStats() {
- return hibernateStats.getCollectionStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getConnectCount() {
- return hibernateStats.getConnectCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public TabularData getEntityStats() {
- return hibernateStats.getEntityStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getFlushCount() {
- return hibernateStats.getFlushCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getOptimisticFailureCount() {
- return hibernateStats.getOptimisticFailureCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getOriginalConfigDeclaration() {
- return ehcacheStats.getOriginalConfigDeclaration();
- }
-
- /**
- * {@inheritDoc}
- */
- public String getOriginalConfigDeclaration(String region) {
- return ehcacheStats.getOriginalConfigDeclaration(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public long getPrepareStatementCount() {
- return hibernateStats.getPrepareStatementCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getQueryExecutionCount() {
- return hibernateStats.getQueryExecutionCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public double getQueryExecutionRate() {
- return hibernateStats.getQueryExecutionRate();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getQueryExecutionSample() {
- return hibernateStats.getQueryExecutionSample();
- }
-
- /**
- * {@inheritDoc}
- */
- public TabularData getQueryStats() {
- return hibernateStats.getQueryStats();
- }
-
- /**
- * {@inheritDoc}
- */
- public Map> getRegionCacheAttributes() {
- return ehcacheStats.getRegionCacheAttributes();
- }
-
- /**
- * {@inheritDoc}
- */
- public Map getRegionCacheAttributes(String regionName) {
- return ehcacheStats.getRegionCacheAttributes(regionName);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getRegionCacheMaxTTISeconds(String region) {
- return ehcacheStats.getRegionCacheMaxTTISeconds(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getRegionCacheMaxTTLSeconds(String region) {
- return ehcacheStats.getRegionCacheMaxTTLSeconds(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getRegionCacheOrphanEvictionPeriod(String region) {
- return ehcacheStats.getRegionCacheOrphanEvictionPeriod(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public Map getRegionCacheSamples() {
- return ehcacheStats.getRegionCacheSamples();
- }
-
- /**
- * {@inheritDoc}
- */
- public int getRegionCacheTargetMaxInMemoryCount(String region) {
- return ehcacheStats.getRegionCacheTargetMaxInMemoryCount(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public int getRegionCacheTargetMaxTotalCount(String region) {
- return ehcacheStats.getRegionCacheTargetMaxTotalCount(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public long getSessionCloseCount() {
- return hibernateStats.getSessionCloseCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getSessionOpenCount() {
- return hibernateStats.getSessionOpenCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getSuccessfulTransactionCount() {
- return hibernateStats.getSuccessfulTransactionCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getTerracottaHibernateCacheRegionNames() {
- return ehcacheStats.getTerracottaHibernateCacheRegionNames();
- }
-
- /**
- * {@inheritDoc}
- */
- public long getTransactionCount() {
- return hibernateStats.getTransactionCount();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRegionCacheEnabled(String region) {
- return ehcacheStats.isRegionCacheEnabled(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCachesEnabled(boolean enabled) {
- ehcacheStats.setRegionCachesEnabled(enabled);
- sendNotification(HibernateStats.CACHE_ENABLED, enabled);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheEnabled(String region, boolean enabled) {
- ehcacheStats.setRegionCacheEnabled(region, enabled);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRegionCacheLoggingEnabled(String region) {
- return ehcacheStats.isRegionCacheLoggingEnabled(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRegionCacheOrphanEvictionEnabled(String region) {
- return ehcacheStats.isRegionCacheOrphanEvictionEnabled(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isRegionCachesEnabled() {
- return ehcacheStats.isRegionCachesEnabled();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isTerracottaHibernateCache(String region) {
- return ehcacheStats.isTerracottaHibernateCache(region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheLoggingEnabled(String region, boolean loggingEnabled) {
- ehcacheStats.setRegionCacheLoggingEnabled(region, loggingEnabled);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) {
- ehcacheStats.setRegionCacheMaxTTISeconds(region, maxTTISeconds);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheMaxTTLSeconds(String region, int maxTTLSeconds) {
- ehcacheStats.setRegionCacheMaxTTLSeconds(region, maxTTLSeconds);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) {
- ehcacheStats.setRegionCacheTargetMaxInMemoryCount(region, targetMaxInMemoryCount);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- */
- public void setRegionCacheTargetMaxTotalCount(String region, int targetMaxTotalCount) {
- ehcacheStats.setRegionCacheTargetMaxTotalCount(region, targetMaxTotalCount);
- sendNotification(HibernateStats.CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsInMemory(java.lang.String)
- */
- public int getNumberOfElementsInMemory(String region) {
- return ehcacheStats.getNumberOfElementsInMemory(region);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsInMemory(java.lang.String)
- */
- public int getNumberOfElementsOffHeap(String region) {
- return ehcacheStats.getNumberOfElementsOffHeap(region);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOnDisk(java.lang.String)
- */
- public int getNumberOfElementsOnDisk(String region) {
- return ehcacheStats.getNumberOfElementsOnDisk(region);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMaxGetTimeMillis()
- */
- public long getMaxGetTimeMillis() {
- return ehcacheStats.getMaxGetTimeMillis();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMaxGetTimeMillis(java.lang.String)
- */
- public long getMaxGetTimeMillis(String cacheName) {
- return ehcacheStats.getMaxGetTimeMillis(cacheName);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMinGetTimeMillis()
- */
- public long getMinGetTimeMillis() {
- return ehcacheStats.getMinGetTimeMillis();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMinGetTimeMillis(java.lang.String)
- */
- public long getMinGetTimeMillis(String cacheName) {
- return ehcacheStats.getMinGetTimeMillis(cacheName);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getAverageGetTimeMillis(java.lang.String)
- */
- public float getAverageGetTimeMillis(String region) {
- return ehcacheStats.getAverageGetTimeMillis(region);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void doDispose() {
- // no-op
- }
-
- /**
- * @see BaseEmitterBean#getNotificationInfo()
- */
- @Override
- public MBeanNotificationInfo[] getNotificationInfo() {
- return new MBeanNotificationInfo[] {NOTIFICATION_INFO};
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/MemorySizeParserTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/MemorySizeParserTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/MemorySizeParserTest.java (revision 0)
@@ -1,63 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.util;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author Ludovic Orban
- */
-public class MemorySizeParserTest {
-
- @Test
- public void testParse() {
- assertEquals(0, MemorySizeParser.parse("0"));
- assertEquals(0, MemorySizeParser.parse(""));
- assertEquals(0, MemorySizeParser.parse(null));
- assertEquals(10, MemorySizeParser.parse("10"));
- assertEquals(4096, MemorySizeParser.parse("4k"));
- assertEquals(4096, MemorySizeParser.parse("4K"));
- assertEquals(16777216, MemorySizeParser.parse("16m"));
- assertEquals(16777216, MemorySizeParser.parse("16M"));
- assertEquals(2147483648L, MemorySizeParser.parse("2g"));
- assertEquals(2147483648L, MemorySizeParser.parse("2G"));
- assertEquals(3298534883328L, MemorySizeParser.parse("3t"));
- assertEquals(3298534883328L, MemorySizeParser.parse("3T"));
- }
-
- @Test
- public void testParseErrors() {
- try {
- MemorySizeParser.parse("-1G");
- Assert.fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- // expected
- }
-
- try {
- MemorySizeParser.parse("1000y");
- Assert.fail("expected IllegalArgumentException");
- } catch (IllegalArgumentException e) {
- // expected
- }
-
-
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/DynamicAttributesExtractor.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/DynamicAttributesExtractor.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/DynamicAttributesExtractor.java (revision 0)
@@ -1,35 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.search.attribute;
-
-import java.util.Map;
-
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
-/**
- * Dynamic indexing API
- * @author vfunshte
- */
-public interface DynamicAttributesExtractor {
- /**
- * Given a particular cache element, returns a map from attribute names, to their respective values to use for indexing.
- * This method will be called once for every {@link Ehcache#put(Element)} and {@code Ehcache#replace(Element)} call.
- * @param element
- * @return
- */
- Map attributesFor(Element element);
-}
Index: rctags/ehcache-2.10.9.0.411/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/services/ElementsResourceServiceImplV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/services/ElementsResourceServiceImplV2.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/services/ElementsResourceServiceImplV2.java (revision 0)
@@ -1,61 +0,0 @@
-/*
- * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-
-package net.sf.ehcache.management.resource.services;
-
-import net.sf.ehcache.management.service.CacheServiceV2;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.terracotta.management.ServiceExecutionException;
-import org.terracotta.management.ServiceLocator;
-import org.terracotta.management.resource.exceptions.ResourceRuntimeException;
-import org.terracotta.management.resource.services.validator.RequestValidator;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-/**
- * A resource service interface for implementations interacting with cache elements.
- *
- * @author brandony
- */
-@Path("/v2/agents/cacheManagers/caches/elements")
-public final class ElementsResourceServiceImplV2 {
- private static final Logger LOG = LoggerFactory.getLogger(ElementsResourceServiceImplV2.class);
-
- private final CacheServiceV2 cacheSvc;
-
- private final RequestValidator validator;
-
- public ElementsResourceServiceImplV2() {
- this.validator = ServiceLocator.locate(RequestValidator.class);
- this.cacheSvc = ServiceLocator.locate(CacheServiceV2.class);
- }
-
- /**
- * Remove elements from the cache.
- *
- * @param info
- * for this resource request
- */
- @DELETE
- public void deleteElements(@Context UriInfo info) {
- LOG.debug(String.format("Invoking ElementsResourceServiceImpl.deleteElements: %s", info.getRequestUri()));
-
- validator.validate(info);
- String cacheManagerName = info.getPathSegments().get(2).getMatrixParameters().getFirst("names");
- String cacheName = info.getPathSegments().get(3).getMatrixParameters().getFirst("names");
-
- try {
- cacheSvc.clearCache(cacheManagerName, cacheName);
- } catch (ServiceExecutionException e) {
- throw new ResourceRuntimeException("Failed to delete element", e, Response.Status.BAD_REQUEST.getStatusCode());
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/writer/CacheWriterManager.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/writer/CacheWriterManager.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/writer/CacheWriterManager.java (revision 0)
@@ -1,65 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.writer;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheEntry;
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Element;
-
-/**
- * A {@code CacheWriterManager} coordinates how element are written to a back-end store.
- *
- * The {@code CacheWriterManager} will in its turn call the {@code CacheWriter} that belongs to the relevant cache to perform
- * the actual write logic as it's implemented by the user.
- *
- * @author Geert Bevin
- * @version $Id: CacheWriterManager.java 10789 2018-04-26 02:08:13Z adahanne $
- */
-public interface CacheWriterManager {
- /**
- * Initialize the cache writer manager.
- *
- * This method is called when the cache writer manager is registered to a cache.
- *
- * @param cache the cache with which the writer manager
- * @throws CacheException when an exception occurs during the initialisation of the cache
- */
- void init(Cache cache) throws CacheException;
-
- /**
- * Schedule a put operation for this element in the CacheWriterManager, which will call the CacheWriter when appropriate.
- *
- * @param element the element that should be used for the operation
- * @throws CacheException when an exception occurs during the writing of the element
- */
- void put(Element element) throws CacheException;
-
- /**
- * Schedule a remove operation for this key in the CacheWriterManager, which will call the CacheWriter when appropriate.
- *
- * @param entry the entry that should be used for the operation
- * @throws CacheException when an exception occurs during the removal of the element
- */
- void remove(CacheEntry entry) throws CacheException;
-
- /**
- * Cleans up the resources of the cache writer manager.
- *
- * This method is called when the manager is unregistered from a cache.
- */
- void dispose() throws CacheException;
-}
Index: rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/.settings/org.eclipse.jdt.core.prefs
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/.settings/org.eclipse.jdt.core.prefs (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/.settings/org.eclipse.jdt.core.prefs (revision 0)
@@ -1,347 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=ignore
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fatalOptionalWarning=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressOptionalWarnings=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=true
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=2
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=120
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/compressed-cache-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/compressed-cache-test.xml (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/compressed-cache-test.xml (revision 0)
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.411/management-ehcache-impl/management-ehcache-impl-v1/src/test/java/net/sf/ehcache/management/service/impl/DfltSamplerRepositoryServiceTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/management-ehcache-impl/management-ehcache-impl-v1/src/test/java/net/sf/ehcache/management/service/impl/DfltSamplerRepositoryServiceTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/management-ehcache-impl/management-ehcache-impl-v1/src/test/java/net/sf/ehcache/management/service/impl/DfltSamplerRepositoryServiceTest.java (revision 0)
@@ -1,101 +0,0 @@
-/*
- * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package net.sf.ehcache.management.service.impl;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.ClusteredInstanceFactoryAccessor;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ManagementRESTServiceConfiguration;
-import net.sf.ehcache.constructs.blocking.BlockingCache;
-import net.sf.ehcache.terracotta.ClusteredInstanceFactory;
-import net.sf.ehcache.terracotta.TerracottaClient;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Collections;
-
-import static java.util.Collections.singleton;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Ludovic Orban
- */
-public class DfltSamplerRepositoryServiceTest {
-
- private DfltSamplerRepositoryService repositoryService;
- private ClusteredInstanceFactory clusteredInstanceFactory;
- private CacheManager cacheManager;
-
- @Before
- public void setUp() throws Exception {
- ManagementRESTServiceConfiguration managementRESTServiceConfiguration = new ManagementRESTServiceConfiguration();
- managementRESTServiceConfiguration.setEnabled(true);
- RemoteAgentEndpointImpl remoteAgentEndpoint = mock(RemoteAgentEndpointImpl.class);
- repositoryService = new DfltSamplerRepositoryService(managementRESTServiceConfiguration, remoteAgentEndpoint);
-
- Configuration configuration = new Configuration();
- configuration.setName("testCacheManager");
- CacheConfiguration cacheConfiguration = new CacheConfiguration("testCache1", 12);
- configuration.addCache(cacheConfiguration);
- cacheManager = new CacheManager(configuration);
- TerracottaClient terracottaClient = mock(TerracottaClient.class);
- clusteredInstanceFactory = mock(ClusteredInstanceFactory.class);
-
- ClusteredInstanceFactoryAccessor.setTerracottaClient(cacheManager, terracottaClient);
- when(terracottaClient.getClusteredInstanceFactory()).thenReturn(clusteredInstanceFactory);
-
- repositoryService.register(cacheManager);
- }
-
- @Test
- public void testCreateCacheEntitiesDisablesNonStop() throws Exception {
- repositoryService.createCacheEntities(Collections.singleton("testCacheManager"),
- Collections.singleton("testCache1"),
- Collections.singleton("Size"));
-
- verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean());
- }
-
- @Test
- public void testCreateCacheStatisticSampleEntityDisablesNonStop() throws Exception {
- repositoryService.createCacheStatisticSampleEntity(Collections.singleton("testCacheManager"),
- Collections.singleton("testCache1"),
- Collections.singleton("Size"));
-
- verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean());
- }
-
- @Test
- public void testClearCacheDisablesNonStop() throws Exception {
- repositoryService.clearCache("testCacheManager", "testCache1");
-
- verify(clusteredInstanceFactory, times(2)).enableNonStopForCurrentThread(anyBoolean());
- }
-
- @Test
- public void testCanAddDecoratedCache() {
- String cacheName = "decoratedTestCache";
- Cache underlyingCache = new Cache(new CacheConfiguration(cacheName, 10));
- cacheManager.addCache(new BlockingCache(underlyingCache));
-
- assertThat(repositoryService.createCacheEntities(null, singleton(cacheName), null).isEmpty(), is(false));
- }
-
- @After
- public void tearDown() {
- CacheManager.getCacheManager("testCacheManager").shutdown();
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CacheManagerMockHelper.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CacheManagerMockHelper.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/CacheManagerMockHelper.java (revision 0)
@@ -1,31 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache;
-
-import net.sf.ehcache.terracotta.ClusteredInstanceFactory;
-import net.sf.ehcache.terracotta.ClusteredInstanceFactoryWrapper;
-
-import org.mockito.Mockito;
-
-public class CacheManagerMockHelper {
-
- public static void mockGetClusteredInstanceFactory(CacheManager cacheManager, Cache cache) {
- ClusteredInstanceFactory clusteredInstanceFactory = Mockito.mock(ClusteredInstanceFactoryWrapper.class);
- Mockito.when(cacheManager.getClusteredInstanceFactory()).thenReturn(clusteredInstanceFactory);
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicJTATestServlet.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicJTATestServlet.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicJTATestServlet.java (revision 0)
@@ -1,114 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests.container;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.transaction.manager.DefaultTransactionManagerLookup;
-import net.sf.ehcache.transaction.manager.TransactionManagerLookup;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-public class BasicJTATestServlet extends HttpServlet {
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- resp.setContentType("text/html");
- PrintWriter out = resp.getWriter();
- try {
- final TransactionManagerLookup lookup = new DefaultTransactionManagerLookup();
- final TransactionManager txManager = lookup.getTransactionManager();
- if(txManager == null) {
- throw new AssertionError("txnManager is null, this test container test requires a txnManager");
- }
- System.out.println("txnManager class: " + txManager);
- String cmd = req.getParameter("cmd");
- debug("Doing command: " + cmd);
- if ("insert".equals(cmd)) {
- doInsert(txManager);
- } else if ("query".equals(cmd)) {
- doQuery(txManager);
- } else {
- out.println("Unknown command: " + cmd);
- return;
- }
- } catch(Exception e) {
- throw new IOException(e);
- }
- out.println("OK");
- }
-
- private void doInsert(TransactionManager txnManager) throws IllegalStateException, SecurityException {
- CacheManager mgr = CacheManager.getInstance();
- Cache cache = mgr.getCache("test");
-
- try {
- txnManager.setTransactionTimeout(300);
- txnManager.begin();
-
- cache.put(new Element("1", "one"));
-
- Transaction tx1 = txnManager.suspend();
-
- txnManager.begin();
- cache.put(new Element("2", "two"));
-
- txnManager.rollback();
-
- txnManager.resume(tx1);
-
- if (cache.get("2") != null && "two".equals(cache.get("2").getValue()))
- cache.put(new Element("1-2", "one-two"));
-
- txnManager.commit();
-
- } catch(Exception e) {
- throw new AssertionError(e);
- }
- }
-
- private void doQuery(TransactionManager txnManager) {
- CacheManager mgr = CacheManager.getInstance();
- Cache cache = mgr.getCache("test");
- //validate
-
- try {
- txnManager.begin();
-
- Element elementOne = cache.get("1");
-
- if(elementOne == null) {
- throw new AssertionError("element one should exist!");
- }
-
- Element elementTwo = cache.get("2");
- if(elementTwo != null) {
- throw new AssertionError("element two shouldn't exist!");
- }
-
- Element elementOneTwo = cache.get("1-2");
- if(elementOneTwo != null) {
- throw new AssertionError("element one-two shouldn't exist!");
- }
-
- txnManager.commit();
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
-
- private void debug(String string) {
- System.out.println(string);
-
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareEntityRegionAccessStrategy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareEntityRegionAccessStrategy.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareEntityRegionAccessStrategy.java (revision 0)
@@ -1,268 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.hibernate.nonstop;
-
-import net.sf.ehcache.constructs.nonstop.NonStopCacheException;
-
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.EntityRegion;
-import org.hibernate.cache.access.EntityRegionAccessStrategy;
-import org.hibernate.cache.access.SoftLock;
-
-/**
- * Implementation of {@link EntityRegionAccessStrategy} that handles {@link NonStopCacheException} using
- * {@link HibernateNonstopCacheExceptionHandler}
- *
- * @author Abhishek Sanoujam
- *
- */
-public class NonstopAwareEntityRegionAccessStrategy implements EntityRegionAccessStrategy {
-
- private final EntityRegionAccessStrategy actualStrategy;
- private final HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler;
-
- /**
- * Constructor accepting the actual {@link EntityRegionAccessStrategy} and the {@link HibernateNonstopCacheExceptionHandler}
- *
- * @param actualStrategy
- * @param hibernateNonstopExceptionHandler
- */
- public NonstopAwareEntityRegionAccessStrategy(EntityRegionAccessStrategy actualStrategy,
- HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) {
- this.actualStrategy = actualStrategy;
- this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#getRegion()
- */
- public EntityRegion getRegion() {
- return actualStrategy.getRegion();
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#afterInsert(java.lang.Object, java.lang.Object, java.lang.Object)
- */
- public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
- try {
- return actualStrategy.afterInsert(key, value, version);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#afterUpdate(java.lang.Object, java.lang.Object, java.lang.Object,
- * java.lang.Object, org.hibernate.cache.access.SoftLock)
- */
- public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
- throws CacheException {
- try {
- return actualStrategy.afterUpdate(key, value, currentVersion, previousVersion, lock);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#evict(java.lang.Object)
- */
- public void evict(Object key) throws CacheException {
- try {
- actualStrategy.evict(key);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#evictAll()
- */
- public void evictAll() throws CacheException {
- try {
- actualStrategy.evictAll();
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#get(java.lang.Object, long)
- */
- public Object get(Object key, long txTimestamp) throws CacheException {
- try {
- return actualStrategy.get(key, txTimestamp);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#insert(java.lang.Object, java.lang.Object, java.lang.Object)
- */
- public boolean insert(Object key, Object value, Object version) throws CacheException {
- try {
- return actualStrategy.insert(key, value, version);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#lockItem(java.lang.Object, java.lang.Object)
- */
- public SoftLock lockItem(Object key, Object version) throws CacheException {
- try {
- return actualStrategy.lockItem(key, version);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#lockRegion()
- */
- public SoftLock lockRegion() throws CacheException {
- try {
- return actualStrategy.lockRegion();
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object,
- * boolean)
- */
- public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
- throws CacheException {
- try {
- return actualStrategy.putFromLoad(key, value, txTimestamp, version, minimalPutOverride);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object)
- */
- public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException {
- try {
- return actualStrategy.putFromLoad(key, value, txTimestamp, version);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#remove(java.lang.Object)
- */
- public void remove(Object key) throws CacheException {
- try {
- actualStrategy.remove(key);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#removeAll()
- */
- public void removeAll() throws CacheException {
- try {
- actualStrategy.removeAll();
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#unlockItem(java.lang.Object, org.hibernate.cache.access.SoftLock)
- */
- public void unlockItem(Object key, SoftLock lock) throws CacheException {
- try {
- actualStrategy.unlockItem(key, lock);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#unlockRegion(org.hibernate.cache.access.SoftLock)
- */
- public void unlockRegion(SoftLock lock) throws CacheException {
- try {
- actualStrategy.unlockRegion(lock);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.cache.access.EntityRegionAccessStrategy#update(java.lang.Object, java.lang.Object, java.lang.Object,
- * java.lang.Object)
- */
- public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
- try {
- return actualStrategy.update(key, value, currentVersion, previousVersion);
- } catch (NonStopCacheException nonStopCacheException) {
- hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException);
- return false;
- }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/PlatformExceptionUtils.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/PlatformExceptionUtils.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/PlatformExceptionUtils.java (revision 0)
@@ -1,23 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async;
-
-import org.terracotta.toolkit.rejoin.RejoinException;
-
-public class PlatformExceptionUtils {
-
- public static boolean isTCNRE(Throwable th) {
- return th.getClass().getName().equals("com.tc.exception.TCNotRunningException");
- }
-
- public static boolean isRejoinException(Throwable th) {
- if (th instanceof RejoinException) return true;
- return false;
- }
-
- public static boolean shouldIgnore(Throwable th) {
- return isTCNRE(th) || isRejoinException(th);
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheTransactionalDataRegion.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheTransactionalDataRegion.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheTransactionalDataRegion.java (revision 0)
@@ -1,260 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.hibernate.regions;
-
-import java.util.Properties;
-
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.concurrent.CacheLockProvider;
-import net.sf.ehcache.concurrent.LockType;
-import net.sf.ehcache.concurrent.StripedReadWriteLockSync;
-import net.sf.ehcache.constructs.nonstop.NonStopCacheException;
-import net.sf.ehcache.hibernate.nonstop.HibernateNonstopCacheExceptionHandler;
-import net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory;
-
-import org.hibernate.cache.CacheDataDescription;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.TransactionalDataRegion;
-import org.hibernate.cfg.Settings;
-
-/**
- * An Ehcache specific TransactionalDataRegion.
- *
- * This is the common superclass entity and collection regions.
- *
- * @author Chris Dennis
- * @author Greg Luck
- * @author Emmanuel Bernard
- * @author Abhishek Sanoujam
- */
-public class EhcacheTransactionalDataRegion extends EhcacheDataRegion implements TransactionalDataRegion {
-
- private static final int LOCAL_LOCK_PROVIDER_CONCURRENCY = 128;
-
- /**
- * Hibernate settings associated with the persistence unit.
- */
- protected final Settings settings;
-
- /**
- * Metadata associated with the objects stored in the region.
- */
- protected final CacheDataDescription metadata;
-
- private final CacheLockProvider lockProvider;
-
- /**
- * Construct an transactional Hibernate cache region around the given Ehcache instance.
- */
- EhcacheTransactionalDataRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache cache, Settings settings,
- CacheDataDescription metadata, Properties properties) {
- super(accessStrategyFactory, cache, properties);
- this.settings = settings;
- this.metadata = metadata;
-
- Object context = cache.getInternalContext();
- if (context instanceof CacheLockProvider) {
- this.lockProvider = (CacheLockProvider) context;
- } else {
- this.lockProvider = new StripedReadWriteLockSync(LOCAL_LOCK_PROVIDER_CONCURRENCY);
- }
- }
-
- /**
- * Return the hibernate settings
- *
- * @return settings
- */
- public Settings getSettings() {
- return settings;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isTransactionAware() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public CacheDataDescription getCacheDataDescription() {
- return metadata;
- }
-
- /**
- * Get the value mapped to this key, or null if no value is mapped to this key.
- */
- public final Object get(Object key) {
- try {
- Element element = cache.get(key);
- if (element == null) {
- return null;
- } else {
- return element.getObjectValue();
- }
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- return null;
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Map the given value to the given key, replacing any existing mapping for this key
- * this unpins the key in the cache should it be currently pinned
- */
- public final void put(Object key, Object value) throws CacheException {
- put(key, value, false);
- }
-
- /**
- * Map the given value to the given key, replacing any existing mapping for this key,
- * pinning the key in the cache
- */
- public final void putEternal(Object key, Object value) throws CacheException {
- put(key, value, true);
- }
-
- private void put(Object key, Object value, boolean eternal) throws CacheException {
- try {
- Element element = new Element(key, value);
- element.setEternal(eternal);
- cache.put(element);
- } catch (IllegalArgumentException e) {
- throw new CacheException(e);
- } catch (IllegalStateException e) {
- throw new CacheException(e);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Remove the mapping for this key (if any exists).
- */
- public final void remove(Object key) throws CacheException {
- try {
- cache.remove(key);
- } catch (ClassCastException e) {
- throw new CacheException(e);
- } catch (IllegalStateException e) {
- throw new CacheException(e);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Remove all mapping from this cache region.
- */
- public final void clear() throws CacheException {
- try {
- cache.removeAll();
- } catch (IllegalStateException e) {
- throw new CacheException(e);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Attempts to write lock the mapping for the given key.
- */
- public final void writeLock(Object key) {
- try {
- lockProvider.getSyncForKey(key).lock(LockType.WRITE);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Attempts to write unlock the mapping for the given key.
- */
- public final void writeUnlock(Object key) {
- try {
- lockProvider.getSyncForKey(key).unlock(LockType.WRITE);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Attempts to read lock the mapping for the given key.
- */
- public final void readLock(Object key) {
- try {
- lockProvider.getSyncForKey(key).lock(LockType.READ);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Attempts to read unlock the mapping for the given key.
- */
- public final void readUnlock(Object key) {
- try {
- lockProvider.getSyncForKey(key).unlock(LockType.READ);
- } catch (net.sf.ehcache.CacheException e) {
- if (e instanceof NonStopCacheException) {
- HibernateNonstopCacheExceptionHandler.getInstance().handleNonstopCacheException((NonStopCacheException) e);
- } else {
- throw new CacheException(e);
- }
- }
- }
-
- /**
- * Returns true if the locks used by the locking methods of this region are the independent of the cache.
- *
- * Independent locks are not locked by the cache when the cache is accessed directly. This means that for an independent lock
- * lock holds taken through a region method will not block direct access to the cache via other means.
- */
- public final boolean locksAreIndependentOfCache() {
- return lockProvider instanceof StripedReadWriteLockSync;
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/TimestamperTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/TimestamperTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/util/TimestamperTest.java (revision 0)
@@ -1,126 +0,0 @@
-package net.sf.ehcache.util;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.number.OrderingComparison.lessThan;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Alex Snaps
- */
-public class TimestamperTest {
-
- public static final int TOTAL_RUNS = 750000;
-
- private static final Logger slewClockLogger = Logger.getLogger(SlewClock.class.getName());
- private static final ConsoleHandler slewClockHandler = new ConsoleHandler();
-
- @BeforeClass
- public static void enableSlewClockDebugLogging() {
- slewClockHandler.setLevel(Level.ALL);
- slewClockLogger.setLevel(Level.ALL);
- slewClockLogger.addHandler(slewClockHandler);
- }
-
- @AfterClass
- public static void disableSlewClockDebugLogging() {
- slewClockLogger.setLevel(Level.INFO);
- slewClockLogger.removeHandler(slewClockHandler);
- }
-
- @Test
- public void testCorrectness() throws Exception {
- final int THREADS = 8;
- final ConcurrentMap values = new ConcurrentHashMap();
- final AtomicLong errors = new AtomicLong();
-
- Thread[] threads = new Thread[THREADS];
- for(int i =0; i < THREADS; i++) {
- threads[i] = new Thread() {
-
- @Override
- public void run() {
- for (int i = 0; i < (TOTAL_RUNS / THREADS); i++) {
- if(values.putIfAbsent(Timestamper.next(), 0) != null) {
- errors.incrementAndGet();
- }
- }
- }
- };
- }
- for (Thread thread : threads) {
- thread.start();
- }
- for (Thread thread : threads) {
- thread.join();
- }
- assertThat(errors.get(), is(0L));
- }
-
- @Test
- public void testLatency() throws Exception {
- final int THREADS = Runtime.getRuntime().availableProcessors();
- final AtomicBoolean stopped = new AtomicBoolean(false);
- final long[] maxima = new long[THREADS];
- final long[] maximaTimestamps = new long[THREADS];
- final int[] loops = new int[THREADS];
- Thread[] threads = new Thread[THREADS];
- for(int i =0; i < THREADS; i++) {
- final int index = i;
- threads[index] = new Thread() {
-
- @Override
- public void run() {
- long max = -1;
- long maxTimestamp = -1;
- int runs;
- for (runs = 0; !stopped.get() && runs < (TOTAL_RUNS / THREADS); runs++) {
- long start = System.nanoTime();
- Timestamper.next();
- long duration = System.nanoTime() - start;
- if (duration > max) {
- max = duration;
- maxTimestamp = System.currentTimeMillis();
- }
- /*
- * Schedulers are dumb - make sure everyone gets a fair share of cpu.
- */
- Thread.yield();
- }
- stopped.set(true);
- maxima[index] = max;
- maximaTimestamps[index] = maxTimestamp;
- loops[index] = runs;
- }
- };
- }
- final long timestampOrigin = System.currentTimeMillis();
- for (Thread thread : threads) {
- thread.start();
- }
- for (Thread thread : threads) {
- thread.join();
- }
-
- for (int i = 0; i < THREADS; i++) {
- System.out.println(threads[i] + " " + loops[i] + " runs, maximum latency " + TimeUnit.NANOSECONDS.toMillis(maxima[i]) + "ms [@ " + (maximaTimestamps[i] - timestampOrigin) + "ms]");
- }
-
- for (int i = 0; i < THREADS; i++) {
- Assert.assertThat(maxima[i], lessThan(TimeUnit.MILLISECONDS.toNanos(200)));
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/eventual-cache-explicit-locking-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/eventual-cache-explicit-locking-test.xml (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/eventual-cache-explicit-locking-test.xml (revision 0)
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/pool/SizeOfEngineLoaderTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/pool/SizeOfEngineLoaderTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/pool/SizeOfEngineLoaderTest.java (revision 0)
@@ -1,91 +0,0 @@
-package net.sf.ehcache.pool;
-
-import net.sf.ehcache.pool.impl.ConstantSizeOfEngine;
-import net.sf.ehcache.pool.impl.DefaultSizeOfEngine;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.SecureClassLoader;
-import java.util.Enumeration;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Alex Snaps
- */
-public class SizeOfEngineLoaderTest {
-
- private static SizeOfEngine constantSizeOfEngine = new ConstantSizeOfEngine();
-
- @Test
- public void testFallsBackToDefaultSizeOfEngine() {
- final SizeOfEngine sizeOfEngine = SizeOfEngineLoader.INSTANCE.createSizeOfEngine(10, true, true);
- assertThat(sizeOfEngine, notNullValue());
- assertThat(sizeOfEngine, instanceOf(DefaultSizeOfEngine.class));
- }
-
- @Test
- public void testUsesServiceLoaderWhenItCan() {
- ClassLoader cl = new CheatingClassLoader();
- SizeOfEngineLoader loader = new SizeOfEngineLoader(cl);
- assertThat(loader.createSizeOfEngine(10, true, true), sameInstance(constantSizeOfEngine));
- }
-
- @Test
- public void testLoadsSpecificType() {
- SizeOfEngineLoader loader = new SizeOfEngineLoader(new CheatingClassLoader());
- assertThat(loader.load(MyRealFactory.class, false), is(true));
- assertThat(loader.createSizeOfEngine(10, true, true), sameInstance(constantSizeOfEngine));
- }
-
- @Test
- public void testLoadsMatchingSuperType() {
- SizeOfEngineLoader loader = new SizeOfEngineLoader(new CheatingClassLoader());
- assertThat(loader.load(MyFactory.class, false), is(true));
- assertThat(loader.createSizeOfEngine(10, true, true), sameInstance(constantSizeOfEngine));
- }
-
- @Test
- public void testFalseBackToDefaultWhenNotMatchLoaded() {
- SizeOfEngineLoader loader = new SizeOfEngineLoader(new CheatingClassLoader());
- assertThat(loader.load(NoFactory.class, true), is(false));
- assertThat(loader.createSizeOfEngine(10, true, true), instanceOf(DefaultSizeOfEngine.class));
- }
-
- public static interface MyFactory extends SizeOfEngineFactory {
-
- }
-
- public static final class MyRealFactory implements MyFactory {
-
- @Override
- public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) {
- return constantSizeOfEngine;
- }
- }
-
- public static interface NoFactory extends SizeOfEngineFactory {
-
- }
-
- private static class CheatingClassLoader extends SecureClassLoader {
-
- public CheatingClassLoader() {
- super(SizeOfEngineLoader.class.getClassLoader());
- }
-
- @Override
- public Enumeration getResources(final String name) throws IOException {
- final String className = SizeOfEngineFactory.class.getName();
- if (name.equals("META-INF/services/" + className)) {
- return super.getResources("services/" + className + ".txt");
- }
- return super.getResources(name);
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheAndServerTopologyTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheAndServerTopologyTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheAndServerTopologyTest.java (revision 0)
@@ -1,28 +0,0 @@
-/*
- * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-import com.tc.test.config.model.TestConfig;
-
-public class BasicStandaloneCacheAndServerTopologyTest extends AbstractCacheTestBase {
-
- int dsoPort;
-
- public BasicStandaloneCacheAndServerTopologyTest(TestConfig testConfig) {
- super("basic-cache-test-different-server-topology.xml", testConfig);
- testConfig.getClientConfig().setParallelClients(false);
- }
-
- @Override
- protected void startClients() throws Throwable {
- getTestConfig().getClientConfig().addExtraClientJvmArg("-Dmy.tc.server.topology=127.0.0.1:"
- + getGroupData(0).getTsaPort(0));
- getTestConfig().getClientConfig().addExtraClientJvmArg("-Dtc.server.topology=127.0.0.1:"
- + getGroupData(0).getTsaPort(0));
-
- runClient(Client3.class);
- runClient(Client4.class);
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/com/terracotta/ehcache/special/annotation/IgnoreSizeOffff.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/com/terracotta/ehcache/special/annotation/IgnoreSizeOffff.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/com/terracotta/ehcache/special/annotation/IgnoreSizeOffff.java (revision 0)
@@ -1,28 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.terracotta.ehcache.special.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE })
-public @interface IgnoreSizeOffff {
-
-}
Index: rctags/ehcache-2.10.9.0.411/distribution/events/src/assemble/bin/start-db.sh
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/distribution/events/src/assemble/bin/start-db.sh (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/distribution/events/src/assemble/bin/start-db.sh (revision 0)
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-cygwin=false
-if [ `uname | grep CYGWIN` ]; then
- cygwin=true
-fi
-
-if [ "$JAVA_HOME" = "" ]; then
- echo "JAVA_HOME is not defined"
- exit 1
-fi
-
-unset CDPATH
-root=`dirname $0`/..
-root=`cd $root && pwd`
-h2_jar=$root/src/main/webapp/WEB-INF/lib/h2-1.1.116.jar
-
-if $cygwin; then
- h2_jar=`cygpath -w -p $h2_jar`
-fi
-
-$JAVA_HOME/bin/java -cp $h2_jar org.h2.tools.Server -tcp -tcpAllowOthers&
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/CacheConfigError.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/CacheConfigError.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/CacheConfigError.java (revision 0)
@@ -1,48 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.config;
-
-/**
- * Represents a config error in a cache configuration
- * @author Alex Snaps
- */
-public class CacheConfigError extends ConfigError {
- private final String cacheName;
-
- /**
- * Constructor
- * @param error the error message
- * @param cacheName the cache name for which this error occured
- */
- public CacheConfigError(final String error, final String cacheName) {
- super(error);
- this.cacheName = cacheName;
- }
-
- /**
- * Returns the cache name
- * @return cache name
- */
- public String getCacheName() {
- return cacheName;
- }
-
- @Override
- public String toString() {
- return "Cache '" + cacheName + "' error: " + getError();
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/commands/AbstractStoreCommand.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/commands/AbstractStoreCommand.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/commands/AbstractStoreCommand.java (revision 0)
@@ -1,121 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.transaction.xa.commands;
-
-import net.sf.ehcache.Element;
-import net.sf.ehcache.store.ElementValueComparator;
-import net.sf.ehcache.store.Store;
-import net.sf.ehcache.transaction.SoftLock;
-import net.sf.ehcache.transaction.SoftLockManager;
-import net.sf.ehcache.transaction.SoftLockID;
-import net.sf.ehcache.transaction.xa.OptimisticLockFailureException;
-import net.sf.ehcache.transaction.xa.XidTransactionID;
-
-/**
- * @author Ludovic Orban
- */
-public abstract class AbstractStoreCommand implements Command {
-
- private final Element oldElement;
- private final Element newElement;
-
- private Element softLockedElement;
-
- /**
- * Create a Store Command
- * @param oldElement the element in the underlying store at the time this command is created
- * @param newElement the new element to put in the underlying store
- */
- public AbstractStoreCommand(final Element oldElement, final Element newElement) {
- this.newElement = newElement;
- this.oldElement = oldElement;
- }
-
- /**
- * Get the element in the underlying store at the time this command is created
- * @return the old element
- */
- protected Element getOldElement() {
- return oldElement;
- }
-
- /**
- * Get the new element to put in the underlying store
- * @return the new element to put in the underlying store
- */
- protected Element getNewElement() {
- return newElement;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean prepare(Store store, SoftLockManager softLockManager, XidTransactionID transactionId,
- ElementValueComparator comparator) {
- Object objectKey = getObjectKey();
-
- SoftLockID softLockId = softLockManager.createSoftLockID(transactionId, objectKey, newElement, oldElement);
- SoftLock softLock = softLockManager.findSoftLockById(softLockId);
- softLockedElement = createElement(objectKey, softLockId, store, false);
- softLock.lock();
- softLock.freeze();
-
- if (oldElement == null) {
- Element previousElement = store.putIfAbsent(softLockedElement);
- if (previousElement != null) {
- softLock.unfreeze();
- softLock.unlock();
- softLockedElement = null;
- throw new OptimisticLockFailureException();
- }
- } else {
- boolean replaced = store.replace(oldElement, softLockedElement, comparator);
- if (!replaced) {
- softLock.unfreeze();
- softLock.unlock();
- softLockedElement = null;
- throw new OptimisticLockFailureException();
- }
- }
-
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void rollback(Store store, SoftLockManager softLockManager) {
- if (oldElement == null) {
- store.remove(getObjectKey());
- } else {
- store.put(oldElement);
- }
-
- SoftLockID softLockId = (SoftLockID) softLockedElement.getObjectValue();
- SoftLock softLock = softLockManager.findSoftLockById(softLockId);
-
- softLock.unfreeze();
- softLock.unlock();
- softLockedElement = null;
- }
-
- private Element createElement(Object key, SoftLockID softLockId, Store store, boolean wasPinned) {
- Element element = new Element(key, softLockId);
- element.setEternal(true);
- return element;
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/AnnotationProxyFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/AnnotationProxyFactory.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/AnnotationProxyFactory.java (revision 0)
@@ -1,114 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.pool.sizeof.filter;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-/**
- *
- * Allows you to transform the type of your custom annotation to a reference annotation type.
- * It can come handy when you want to allow the consumers of your library not to depend on your API because of the annotations, still allowing them to use the original annotation methods.
- *
- * Example :
- *
- * getting a custom annotation from a class
- * {@code my.Annotation customAnnotation = klazz.getAnnotation(my.Annotation.class);}
- * if this annotation is "similar" (duck-typing, same methods) to the reference one, I can get a proxy to it, whose type is the reference annotation
- * {@code ehcache.Annotation annotation = AnnotationProxyFactory.getAnnotationProxy(customAnnotation, ehcache.Annotation.class);}
- *
- * so my library can apply the behavior when the default annotation is used
- * {@code @ehcache.Annotation(action="true")
- * public class UserClass {}}
- *
- * or when a custom one is used, since all calls to action() will be caught and redirected to the custom annotation action method, if it exists,
- * or fall back to the reference action method
- * {@code @my.Annotation(action="true")
- * public class UserClass {}}
- *
- *
- * @author Anthony Dahanne
- *
- */
-public final class AnnotationProxyFactory {
-
-
- private AnnotationProxyFactory() {
- //not to instantiate
- }
-
- /**
- * Returns a proxy on the customAnnotation, having the same type than the referenceAnnotation
- *
- * @param customAnnotation
- * @param referenceAnnotation
- * @return proxied customAnnotation with the type of referenceAnnotation
- */
- public static T getAnnotationProxy(Annotation customAnnotation, Class referenceAnnotation) {
- InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation);
- return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[] {referenceAnnotation}, handler);
- }
-
- /**
- *
- * Invocation handler implementing an invoke method that redirects every method call to the custom annotation method
- * when possible; if not returns the reference annotation method default value
- *
- */
- private static class AnnotationInvocationHandler implements InvocationHandler {
-
- private final Annotation customAnnotation;
-
- public AnnotationInvocationHandler(Annotation customAnnotation) {
- this.customAnnotation = customAnnotation;
- }
-
- public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
- //trying to call the method on the custom annotation, if it exists
- Method methodOnCustom = getMatchingMethodOnGivenAnnotation(method);
- if (methodOnCustom != null) {
- return methodOnCustom.invoke(customAnnotation, args);
- } else {
- //otherwise getting the default value of the reference annotation method
- Object defaultValue = method.getDefaultValue();
- if (defaultValue != null) {
- return defaultValue;
- }
- throw new UnsupportedOperationException(
- "The method \""
- + method.getName()
- + "\" does not exist in the custom annotation, and there is no default value for"
- + " it in the reference annotation, please implement this method in your custom annotation.");
- }
- }
-
- private Method getMatchingMethodOnGivenAnnotation(Method method) {
- try {
- Method customMethod = customAnnotation.getClass().getDeclaredMethod(method.getName(), method.getParameterTypes());
- if (customMethod.getReturnType().isAssignableFrom(method.getReturnType())) {
- return customMethod;
- }
- return null;
- } catch (NoSuchMethodException e) {
- return null;
- }
- }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL1CapacityEvictionExpressTest.java (revision 0)
@@ -1,31 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests.servermap;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.util.Iterator;
-
-public class ServerMapL1CapacityEvictionExpressTest extends AbstractCacheTestBase {
-
- public ServerMapL1CapacityEvictionExpressTest(TestConfig testConfig) {
- super("/servermap/servermap-l1-capacity-test.xml", testConfig, ServerMapL1CapacityEvictionExpressTestClient.class);
-
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=600000");
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true");
- final Iterator iter = testConfig.getClientConfig().getExtraClientJvmArgs().iterator();
- while (iter.hasNext()) {
- final String prop = iter.next();
- if (prop.contains("ehcache.storageStrategy.dcv2.localcache.enabled")) {
- // remove it and always enable localcache for this test
- iter.remove();
- }
- }
- // always enable local cache
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.storageStrategy.dcv2.localcache.enabled=true");
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/RMICacheReplicatorFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/RMICacheReplicatorFactory.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/RMICacheReplicatorFactory.java (revision 0)
@@ -1,268 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.distribution;
-
-import net.sf.ehcache.event.CacheEventListener;
-import net.sf.ehcache.event.CacheEventListenerFactory;
-import net.sf.ehcache.util.PropertyUtil;
-
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * Creates an RMICacheReplicator using properties. Config lines look like:
- *
- *
- * @author Greg Luck
- * @version $Id: RMICacheReplicatorFactory.java 10789 2018-04-26 02:08:13Z adahanne $
- */
-public class RMICacheReplicatorFactory extends CacheEventListenerFactory {
-
- /**
- * A default for the amount of time the replication thread sleeps after it detects the replicationQueue is empty
- * before checking again.
- */
- protected static final int DEFAULT_ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS = 1000;
-
- /**
- * A default for the maximum number of operations in an RMI message.
- */
- protected static final int DEFAULT_ASYNCHRONOUS_REPLICATION_MAXIMUM_BATCH_SIZE = 1000;
-
- private static final Logger LOG = LoggerFactory.getLogger(RMICacheReplicatorFactory.class.getName());
- private static final String REPLICATE_PUTS = "replicatePuts";
- private static final String REPLICATE_PUTS_VIA_COPY = "replicatePutsViaCopy";
- private static final String REPLICATE_UPDATES = "replicateUpdates";
- private static final String REPLICATE_UPDATES_VIA_COPY = "replicateUpdatesViaCopy";
- private static final String REPLICATE_REMOVALS = "replicateRemovals";
- private static final String REPLICATE_ASYNCHRONOUSLY = "replicateAsynchronously";
- private static final String ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS = "asynchronousReplicationIntervalMillis";
- private static final String ASYNCHRONOUS_REPLICATION_MAXIMUM_BATCH_SIZE = "asynchronousReplicationMaximumBatchSize";
- private static final int MINIMUM_REASONABLE_INTERVAL = 10;
-
- /**
- * Create a CacheEventListener which is also a CacheReplicator.
- *
- * The defaults if properties are not specified are:
- *
- *
replicatePuts=true
- *
replicatePutsViaCopy=true
- *
replicateUpdates=true
- *
replicateUpdatesViaCopy=true
- *
replicateRemovals=true;
- *
replicateAsynchronously=true
- *
asynchronousReplicationIntervalMillis=1000
- *
- *
- * @param properties implementation specific properties. These are configured as comma
- * separated name value pairs in ehcache.xml e.g.
- *
- *
- * <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
- * properties="
- * replicateAsynchronously=true,
- * replicatePuts=true
- * replicateUpdates=true
- * replicateUpdatesViaCopy=true
- * replicateRemovals=true
- * asynchronousReplicationIntervalMillis=1000
- * "/>
- * @return a constructed CacheEventListener
- */
- public final CacheEventListener createCacheEventListener(Properties properties) {
- boolean replicatePuts = extractReplicatePuts(properties);
- boolean replicatePutsViaCopy = extractReplicatePutsViaCopy(properties);
- boolean replicateUpdates = extractReplicateUpdates(properties);
- boolean replicateUpdatesViaCopy = extractReplicateUpdatesViaCopy(properties);
- boolean replicateRemovals = extractReplicateRemovals(properties);
- boolean replicateAsynchronously = extractReplicateAsynchronously(properties);
- int replicationIntervalMillis = extractReplicationIntervalMilis(properties);
- int maximumBatchSize = extractMaximumBatchSize(properties);
-
- if (replicateAsynchronously) {
- return new RMIAsynchronousCacheReplicator(
- replicatePuts,
- replicatePutsViaCopy,
- replicateUpdates,
- replicateUpdatesViaCopy,
- replicateRemovals,
- replicationIntervalMillis,
- maximumBatchSize);
- } else {
- return new RMISynchronousCacheReplicator(
- replicatePuts,
- replicatePutsViaCopy,
- replicateUpdates,
- replicateUpdatesViaCopy,
- replicateRemovals);
- }
- }
-
- /**
- * Extracts the value of asynchronousReplicationIntervalMillis. Sets it to 1000ms if
- * either not set or there is a problem parsing the number
- * @param properties
- */
- protected int extractReplicationIntervalMilis(Properties properties) {
- int asynchronousReplicationIntervalMillis;
- String asynchronousReplicationIntervalMillisString =
- PropertyUtil.extractAndLogProperty(ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS, properties);
- if (asynchronousReplicationIntervalMillisString != null) {
- try {
- int asynchronousReplicationIntervalMillisCandidate =
- Integer.parseInt(asynchronousReplicationIntervalMillisString);
- if (asynchronousReplicationIntervalMillisCandidate < MINIMUM_REASONABLE_INTERVAL) {
- LOG.debug("Trying to set the asynchronousReplicationIntervalMillis to an unreasonable number." +
- " Using the default instead.");
- asynchronousReplicationIntervalMillis = DEFAULT_ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS;
- } else {
- asynchronousReplicationIntervalMillis = asynchronousReplicationIntervalMillisCandidate;
- }
- } catch (NumberFormatException e) {
- LOG.warn("Number format exception trying to set asynchronousReplicationIntervalMillis. " +
- "Using the default instead. String value was: '" + asynchronousReplicationIntervalMillisString + "'");
- asynchronousReplicationIntervalMillis = DEFAULT_ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS;
- }
- } else {
- asynchronousReplicationIntervalMillis = DEFAULT_ASYNCHRONOUS_REPLICATION_INTERVAL_MILLIS;
- }
- return asynchronousReplicationIntervalMillis;
- }
-
- /**
- * Extracts the value of maximumBatchSize. Sets it to 1024 if
- * either not set or there is a problem parsing the number
- * @param properties
- */
- protected int extractMaximumBatchSize(Properties properties) {
- String maximumBatchSizeString =
- PropertyUtil.extractAndLogProperty(ASYNCHRONOUS_REPLICATION_MAXIMUM_BATCH_SIZE, properties);
- if (maximumBatchSizeString == null) {
- return DEFAULT_ASYNCHRONOUS_REPLICATION_MAXIMUM_BATCH_SIZE;
- } else {
- try {
- return Integer.parseInt(maximumBatchSizeString);
- } catch (NumberFormatException e) {
- LOG.warn("Number format exception trying to set maximumBatchSize. " +
- "Using the default instead. String value was: '" + maximumBatchSizeString + "'");
- return DEFAULT_ASYNCHRONOUS_REPLICATION_MAXIMUM_BATCH_SIZE;
- }
- }
- }
-
- /**
- * Extracts the value of replicateAsynchronously from the properties
- * @param properties
- */
- protected boolean extractReplicateAsynchronously(Properties properties) {
- boolean replicateAsynchronously;
- String replicateAsynchronouslyString = PropertyUtil.extractAndLogProperty(REPLICATE_ASYNCHRONOUSLY, properties);
- if (replicateAsynchronouslyString != null) {
- replicateAsynchronously = PropertyUtil.parseBoolean(replicateAsynchronouslyString);
- } else {
- replicateAsynchronously = true;
- }
- return replicateAsynchronously;
- }
-
- /**
- * Extracts the value of replicateRemovals from the properties
- * @param properties
- */
- protected boolean extractReplicateRemovals(Properties properties) {
- boolean replicateRemovals;
- String replicateRemovalsString = PropertyUtil.extractAndLogProperty(REPLICATE_REMOVALS, properties);
- if (replicateRemovalsString != null) {
- replicateRemovals = PropertyUtil.parseBoolean(replicateRemovalsString);
- } else {
- replicateRemovals = true;
- }
- return replicateRemovals;
- }
-
- /**
- * Extracts the value of replicateUpdatesViaCopy from the properties
- * @param properties
- */
- protected boolean extractReplicateUpdatesViaCopy(Properties properties) {
- boolean replicateUpdatesViaCopy;
- String replicateUpdatesViaCopyString = PropertyUtil.extractAndLogProperty(REPLICATE_UPDATES_VIA_COPY, properties);
- if (replicateUpdatesViaCopyString != null) {
- replicateUpdatesViaCopy = PropertyUtil.parseBoolean(replicateUpdatesViaCopyString);
- } else {
- replicateUpdatesViaCopy = true;
- }
- return replicateUpdatesViaCopy;
- }
-
- /**
- * Extracts the value of replicatePutsViaCopy from the properties
- * @param properties
- */
- protected boolean extractReplicatePutsViaCopy(Properties properties) {
- boolean replicatePutsViaCopy;
- String replicatePutsViaCopyString = PropertyUtil.extractAndLogProperty(REPLICATE_PUTS_VIA_COPY, properties);
- if (replicatePutsViaCopyString != null) {
- replicatePutsViaCopy = PropertyUtil.parseBoolean(replicatePutsViaCopyString);
- } else {
- replicatePutsViaCopy = true;
- }
- return replicatePutsViaCopy;
- }
-
- /**
- * Extracts the value of replicateUpdates from the properties
- * @param properties
- */
- protected boolean extractReplicateUpdates(Properties properties) {
- boolean replicateUpdates;
- String replicateUpdatesString = PropertyUtil.extractAndLogProperty(REPLICATE_UPDATES, properties);
- if (replicateUpdatesString != null) {
- replicateUpdates = PropertyUtil.parseBoolean(replicateUpdatesString);
- } else {
- replicateUpdates = true;
- }
- return replicateUpdates;
- }
-
- /**
- * Extracts the value of replicatePuts from the properties
- * @param properties
- */
- protected boolean extractReplicatePuts(Properties properties) {
- boolean replicatePuts;
- String replicatePutsString = PropertyUtil.extractAndLogProperty(REPLICATE_PUTS, properties);
- if (replicatePutsString != null) {
- replicatePuts = PropertyUtil.parseBoolean(replicatePutsString);
- } else {
- replicatePuts = true;
- }
- return replicatePuts;
- }
-
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/SharedClientMBeanTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/SharedClientMBeanTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/SharedClientMBeanTest.java (revision 0)
@@ -1,113 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.TerracottaClientConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration;
-
-import org.terracotta.test.util.JMXUtils;
-import org.terracotta.tests.base.AbstractClientBase;
-import org.terracotta.toolkit.ToolkitFactory;
-
-import com.tc.test.config.model.TestConfig;
-import com.tc.util.concurrent.ThreadUtil;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.remote.JMXConnector;
-
-import junit.framework.Assert;
-
-public class SharedClientMBeanTest extends AbstractCacheTestBase {
-
- public SharedClientMBeanTest(TestConfig testConfig) {
- super(testConfig, SharedClientMBeanTestClient.class);
-
- }
-
- public static class SharedClientMBeanTestClient extends AbstractClientBase {
-
- public SharedClientMBeanTestClient(String[] args) {
- super(args);
- }
-
- @Override
- protected void doTest() throws Throwable {
- String tcUrl = getTerracottaUrl();
-
- // first create a toolkit
- ToolkitFactory.createToolkit("toolkit:terracotta://" + tcUrl);
-
- // create ehcache cacheManager - will be shared client
- Configuration configuration = new Configuration().name("cm").terracotta(new TerracottaClientConfiguration()
- .rejoin(false).url(tcUrl));
-
- configuration.addCache(new CacheConfiguration().name("mbeanCache")
- .terracotta(new TerracottaConfiguration().clustered(true)).maxEntriesLocalHeap(100));
- CacheManager.newInstance(configuration);
-
- checkEhcacheMBeansRegistered(getGroupData(0).getJmxPort(0), false);
-
- }
-
- private void checkEhcacheMBeansRegistered(int jmxPort, boolean afterRejoin) throws Exception {
-
- MBeanServerConnection mbs = getOrWaitForServerMbeanConnection("localhost", jmxPort);
- ObjectName name = new ObjectName("net.sf.ehcache:*");
- Set queryMBeans = mbs.queryMBeans(name, null);
- System.out.println("=======================================");
- System.out.println("List of objectNames registered in L2");
- for (ObjectInstance oname : queryMBeans) {
- System.out.println(oname.getObjectName().getCanonicalName());
- }
- System.out.println("=======================================");
-
- Map mbeanNames = new HashMap();
- ObjectName cacheMgrMbeanName = null;
-
- for (ObjectInstance oi : queryMBeans) {
- ObjectName objectName = oi.getObjectName();
- String type = objectName.getKeyProperty("type");
- if ("SampledCache".equals(type)) {
- if (objectName.getKeyProperty("name").equals("mbeanCache")) {
- mbeanNames.put("exception", objectName);
- }
- }
- if ("SampledCacheManager".equals(type)) {
- cacheMgrMbeanName = objectName;
- }
- }
- Assert.assertNotNull("CacheManager mbean is not tunneled", cacheMgrMbeanName);
- Assert.assertEquals("Some mbeans for cache are missing", 1, mbeanNames.size());
- for (Entry entry : mbeanNames.entrySet()) {
- Assert.assertNotNull("Mbean should be present for cache type : " + entry.getKey(), entry.getValue());
- }
- }
-
- private MBeanServerConnection getOrWaitForServerMbeanConnection(String host, int port) {
- MBeanServerConnection mbs = null;
- while (mbs == null) {
- try {
- final JMXConnector jmxConnector = JMXUtils.getJMXConnector(host, port);
- mbs = jmxConnector.getMBeanServerConnection();
- } catch (IOException e) {
- System.err.println("XXX getOrWaitForServerMbeanConnection " + host + ":" + port + " - " + e);
- }
- ThreadUtil.reallySleep(3000);
- }
- return mbs;
- }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/JmxThreadDumper.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/JmxThreadDumper.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/JmxThreadDumper.java (revision 0)
@@ -1,61 +0,0 @@
-/*
- * All content copyright (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright
- * notice. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-import java.io.IOException;
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
-
-import javax.management.MBeanServerConnection;
-
-public class JmxThreadDumper {
- private ThreadMXBean threadMxBean;
-
- public JmxThreadDumper(MBeanServerConnection server) throws IOException {
- this.threadMxBean = ManagementFactory.newPlatformMXBeanProxy(server, ManagementFactory.THREAD_MXBEAN_NAME, ThreadMXBean.class);
- }
-
- /**
- * Prints the thread dump information to System.out.
- */
- public void threadDump() {
- System.out.println("Full Java thread dump");
- long[] threadIds = threadMxBean.getAllThreadIds();
- ThreadInfo[] threadInfos = threadMxBean.getThreadInfo(threadIds, Integer.MAX_VALUE);
- for (ThreadInfo threadInfo : threadInfos) {
- printThreadInfo(threadInfo);
- }
- }
-
- private void printThreadInfo(ThreadInfo threadInfo) {
- printThread(threadInfo);
-
- StackTraceElement[] stackTrace = threadInfo.getStackTrace();
- for (StackTraceElement stackTraceElement : stackTrace) {
- System.out.println(" at " + stackTraceElement.toString());
- }
- System.out.println();
- }
-
- private void printThread(ThreadInfo threadInfo) {
- StringBuilder sb = new StringBuilder("\"" + threadInfo.getThreadName() + "\"" + " Id=" + threadInfo.getThreadId() +
- " in " + threadInfo.getThreadState());
- if (threadInfo.getLockName() != null) {
- sb.append(" on lock=").append(threadInfo.getLockName());
- }
- if (threadInfo.isSuspended()) {
- sb.append(" (suspended)");
- }
- if (threadInfo.isInNative()) {
- sb.append(" (running in native)");
- }
- System.out.println(sb.toString());
- if (threadInfo.getLockOwnerName() != null) {
- System.out.println(" owned by " + threadInfo.getLockOwnerName() + " Id=" + threadInfo.getLockOwnerId());
- }
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheReplicator.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheReplicator.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheReplicator.java (revision 0)
@@ -1,46 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.distribution;
-
-import net.sf.ehcache.event.CacheEventListener;
-
-/**
- * Replicates cache entries to peers of the CacheManager
- * @author Greg Luck
- * @version $Id: CacheReplicator.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public interface CacheReplicator extends CacheEventListener {
-
- /**
- * Returns whether update is through copy or invalidate
- * @return true if update is via copy, else false if invalidate
- */
- boolean isReplicateUpdatesViaCopy();
-
- /**
- * Returns whether the replicator is not active.
- * @return true if the status is not STATUS_ALIVE
- */
- boolean notAlive();
-
- /**
- * Checks that the replicator is is STATUS_ALIVE.
- * @return true if the replicator is is STATUS_ALIVE, else false.
- */
- boolean alive();
-
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/NodeAttribute.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/NodeAttribute.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/NodeAttribute.java (revision 0)
@@ -1,98 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.config.generator.model;
-
-/**
- * Interface that abstracts the idea of an attribute. An attribute has a name, a value, boolean indicating if its an optional attribute and
- * a default value
- *
- * @author Abhishek Sanoujam
- *
- */
-public interface NodeAttribute {
-
- /**
- * Name of the attribute
- *
- * @return Name of the attribute
- */
- String getName();
-
- /**
- * Value of the attribute
- *
- * @return value of the attribute
- */
- String getValue();
-
- /**
- * Returns true if the attribute is optional, otherwise false
- *
- * @return Returns true if the attribute is optional, otherwise false
- */
- boolean isOptional();
-
- /**
- * Returns the default value of the attribute
- *
- * @return default value of the attribute
- */
- String getDefaultValue();
-
- /**
- * Sets this attribute to optional or not
- *
- * @param optional
- * true if this attribute is optional
- */
- public void setOptional(boolean optional);
-
- /**
- * Default value setter
- *
- * @param defaultValue
- * the default value
- */
- public void setDefaultValue(String defaultValue);
-
- /**
- * Setter for value
- *
- * @param value
- * the new value
- */
- public void setValue(String value);
-
- /**
- * Builder convenience method for setting optional
- *
- * @param optional
- * true if optional
- * @return the same attribute instance
- */
- NodeAttribute optional(boolean optional);
-
- /**
- * Builder convenience method for setting defaultValue
- *
- * @param defaultValue
- * the default value
- * @return the same attribute instance
- */
- NodeAttribute defaultValue(String defaultValue);
-
-}
Index: rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/ToolkitInstanceFactoryImpl.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/ToolkitInstanceFactoryImpl.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/ToolkitInstanceFactoryImpl.java (revision 0)
@@ -1,954 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache;
-
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.ConfigurationFactory;
-import net.sf.ehcache.config.PinningConfiguration;
-import net.sf.ehcache.config.TerracottaClientConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration.Consistency;
-import net.sf.ehcache.config.generator.ConfigurationUtil;
-import net.sf.ehcache.search.attribute.AttributeExtractor;
-import net.sf.ehcache.transaction.Decision;
-import net.sf.ehcache.transaction.TransactionID;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.terracotta.modules.ehcache.async.AsyncConfig;
-import org.terracotta.modules.ehcache.collections.SerializationHelper;
-import org.terracotta.modules.ehcache.collections.SerializedToolkitCache;
-import org.terracotta.modules.ehcache.event.CacheDisposalNotification;
-import org.terracotta.modules.ehcache.event.CacheEventNotificationMsg;
-import org.terracotta.modules.ehcache.store.CacheConfigChangeNotificationMsg;
-import org.terracotta.modules.ehcache.store.TerracottaClusteredInstanceFactory;
-import org.terracotta.modules.ehcache.store.ToolkitNonStopConfiguration;
-import org.terracotta.modules.ehcache.store.nonstop.ToolkitNonstopDisableConfig;
-import org.terracotta.modules.ehcache.transaction.ClusteredSoftLockIDKey;
-import org.terracotta.modules.ehcache.transaction.SerializedReadCommittedClusteredSoftLock;
-import org.terracotta.modules.ehcache.wan.WANUtil;
-import org.terracotta.modules.ehcache.wan.Watchable;
-import org.terracotta.modules.ehcache.wan.Watchdog;
-import org.terracotta.toolkit.Toolkit;
-import org.terracotta.toolkit.ToolkitFeatureType;
-import org.terracotta.toolkit.ToolkitObjectType;
-import org.terracotta.toolkit.builder.ToolkitCacheConfigBuilder;
-import org.terracotta.toolkit.builder.ToolkitStoreConfigBuilder;
-import org.terracotta.toolkit.cache.ToolkitCache;
-import org.terracotta.toolkit.collections.ToolkitMap;
-import org.terracotta.toolkit.concurrent.locks.ToolkitLock;
-import org.terracotta.toolkit.concurrent.locks.ToolkitReadWriteLock;
-import org.terracotta.toolkit.config.Configuration;
-import org.terracotta.toolkit.events.ToolkitNotifier;
-import org.terracotta.toolkit.internal.ToolkitInternal;
-import org.terracotta.toolkit.internal.ToolkitLogger;
-import org.terracotta.toolkit.internal.cache.BufferingToolkitCache;
-import org.terracotta.toolkit.internal.cache.ToolkitCacheInternal;
-import org.terracotta.toolkit.internal.collections.ToolkitListInternal;
-import org.terracotta.toolkit.internal.store.ConfigFieldsInternal;
-import org.terracotta.toolkit.nonstop.NonStopConfigurationRegistry;
-import org.terracotta.toolkit.store.ToolkitConfigFields;
-
-import com.terracotta.entity.ClusteredEntityManager;
-import com.terracotta.entity.ehcache.ClusteredCache;
-import com.terracotta.entity.ehcache.ClusteredCacheConfiguration;
-import com.terracotta.entity.ehcache.ClusteredCacheManager;
-import com.terracotta.entity.ehcache.ClusteredCacheManagerConfiguration;
-import com.terracotta.entity.ehcache.EhcacheEntitiesNaming;
-import com.terracotta.entity.ehcache.ToolkitBackedClusteredCache;
-import com.terracotta.entity.ehcache.ToolkitBackedClusteredCacheManager;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Serializable;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import static java.lang.String.format;
-
-public class ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory {
-
- public static final Logger LOGGER = LoggerFactory
- .getLogger(ToolkitInstanceFactoryImpl.class);
- private static final String CONFIG_LOGGER_NAME = "com.terracotta.ehcache.config";
-
- public static final String DELIMITER = "|";
- private static final String EVENT_NOTIFIER_SUFFIX = "event-notifier";
- private static final String DISPOSAL_NOTIFIER_SUFFIX = "disposal-notifier";
- private static final String EHCACHE_NAME_PREFIX = "__tc_clustered-ehcache";
- private static final String CONFIG_NOTIFIER_SUFFIX = "config-notifier";
- private static final String EHCACHE_TXNS_DECISION_STATE_MAP_NAME = EHCACHE_NAME_PREFIX + DELIMITER
- + "txnsDecision";
- private static final String ALL_SOFT_LOCKS_MAP_SUFFIX = "softLocks";
- private static final String NEW_SOFT_LOCKS_LIST_SUFFIX = "newSoftLocks";
-
- private static final String LOCK_TAG = "::LOCK";
-
- static final String CLUSTERED_STORE_CONFIG_MAP = EHCACHE_NAME_PREFIX + DELIMITER + "configMap";
-
- private static final String EHCACHE_TXNS_SOFTLOCK_WRITE_LOCK_NAME = EHCACHE_NAME_PREFIX + DELIMITER
- + "softWriteLock";
-
- private static final String EHCACHE_TXNS_SOFTLOCK_FREEZE_LOCK_NAME = EHCACHE_NAME_PREFIX + DELIMITER
- + "softFreezeLock";
- private static final String EHCACHE_TXNS_SOFTLOCK_NOTIFIER_LOCK_NAME = EHCACHE_NAME_PREFIX + DELIMITER
- + "softNotifierLock";
- public static final int RETRY_MARK_IN_USE_AFTER_REJOIN = 5;
-
- protected final Toolkit toolkit;
- private final WANUtil wanUtil;
- private final ClusteredEntityManager clusteredEntityManager;
- private volatile ClusteredCacheManager clusteredCacheManagerEntity;
- private final EntityNamesHolder entityNames;
- private final Watchdog wanWatchdog;
-
- public ToolkitInstanceFactoryImpl(final TerracottaClientConfiguration terracottaClientConfiguration,
- final String productId, ClassLoader loader) {
- this.toolkit = createTerracottaToolkit(terracottaClientConfiguration, productId, loader);
- updateDefaultNonStopConfig(toolkit);
- this.clusteredEntityManager = new ClusteredEntityManager(toolkit);
- this.entityNames = new EntityNamesHolder();
- this.wanUtil = new WANUtil(this);
- this.wanWatchdog = Watchdog.create();
- }
-
- public ToolkitInstanceFactoryImpl(final TerracottaClientConfiguration terracottaClientConfiguration,
- ClassLoader loader) {
- this(terracottaClientConfiguration, null, loader);
- }
-
- // Constructor to enable unit testing
- ToolkitInstanceFactoryImpl(final Toolkit toolkit, final ClusteredEntityManager clusteredEntityManager) {
- this.toolkit = toolkit;
- this.clusteredEntityManager = clusteredEntityManager;
- this.entityNames = new EntityNamesHolder();
- this.wanUtil = new WANUtil(this);
- this.wanWatchdog = Watchdog.create();
- }
-
- ToolkitInstanceFactoryImpl(final Toolkit toolkit, final ClusteredEntityManager clusteredEntityManager,
- final WANUtil util, final Watchdog wanWatchdog) {
- this.toolkit = toolkit;
- this.clusteredEntityManager = clusteredEntityManager;
- this.entityNames = new EntityNamesHolder();
- this.wanUtil = util;
- this.wanWatchdog = wanWatchdog;
- }
-
- private void updateDefaultNonStopConfig(Toolkit toolkitParam) {
- ToolkitNonstopDisableConfig disableNonStop = new ToolkitNonstopDisableConfig();
- NonStopConfigurationRegistry nonStopConfigurationRegistry = toolkitParam.getFeature(ToolkitFeatureType.NONSTOP)
- .getNonStopConfigurationRegistry();
- for (ToolkitObjectType t : ToolkitObjectType.values()) {
- try {
- nonStopConfigurationRegistry.registerForType(disableNonStop, t);
- } catch (UnsupportedOperationException e) {
- // expected for Barrier and BlockingQueue.
- if (!(t == ToolkitObjectType.BARRIER || t == ToolkitObjectType.BLOCKING_QUEUE)) { throw e; }
- }
- }
- }
-
- private static Toolkit createTerracottaToolkit(TerracottaClientConfiguration terracottaClientConfiguration,
- String productId, ClassLoader loader) {
- TerracottaToolkitBuilder terracottaClientBuilder = new TerracottaToolkitBuilder();
- EhcacheTcConfig ehcacheTcConfig = EhcacheTcConfig.create(terracottaClientConfiguration);
- switch (ehcacheTcConfig.type) {
- case URL:
- terracottaClientBuilder.setTCConfigUrl(ehcacheTcConfig.tcConfigUrlOrSnippet);
- break;
- case EMBEDDED_TC_CONFIG:
- case FILE:
- terracottaClientBuilder.setTCConfigSnippet(ehcacheTcConfig.tcConfigUrlOrSnippet);
- break;
- }
- terracottaClientBuilder.addTunnelledMBeanDomain("net.sf.ehcache");
- terracottaClientBuilder.addTunnelledMBeanDomain("net.sf.ehcache.hibernate");
- terracottaClientBuilder.addTunnelledMBeanDomain("org.terracotta.wan");
- terracottaClientBuilder.setRejoinEnabled(terracottaClientConfiguration.isRejoin());
- terracottaClientBuilder.setProductId(productId);
- terracottaClientBuilder.setClassLoader(loader);
- return terracottaClientBuilder.buildToolkit();
- }
-
- @Override
- public void waitForOrchestrator(String cacheManagerName) {
- wanUtil.waitForOrchestrator(cacheManagerName);
- }
-
- @Override
- public void markCacheWanDisabled(String cacheManagerName, String cacheName) {
- wanUtil.markCacheWanDisabled(cacheManagerName, cacheName);
- }
-
- @Override
- public Toolkit getToolkit() {
- return toolkit;
- }
-
- @Override
- public ToolkitCacheInternal getOrCreateToolkitCache(final Ehcache cache) {
- final String cacheManagerName = getCacheManagerName(cache);
- final String cacheName = cache.getName();
-
- ToolkitCacheInternal toolkitCache = getOrCreateRegularToolkitCache(
- cacheManagerName, cacheName, cache.getCacheConfiguration());
- if(wanUtil.isWanEnabledCache(cacheManagerName, cacheName)) {
- final boolean replicaCache = wanUtil.isCacheReplica(cacheManagerName, cacheName);
- final boolean bidirectional = wanUtil.isCacheBidirectional(cacheManagerName, cacheName);
- toolkitCache = createWanAwareToolkitCache(cacheManagerName, cacheName, toolkitCache,
- cache.getCacheConfiguration(), !replicaCache, bidirectional);
-
- if (replicaCache) {
- LOGGER.info("Pinning the Cache '{}' belonging to Cache Manager '{}' " +
- "and setting its TTI and TTL values to zero as it is a WAN Replica Cache. " +
- "This cache's capacity will be controlled by its Master cache.",
- cacheName, cacheManagerName);
- PinningConfiguration pinningConfiguration = new PinningConfiguration();
- pinningConfiguration.setStore(PinningConfiguration.Store.INCACHE.toString());
- cache.getCacheConfiguration().addPinning(pinningConfiguration);
- cache.getCacheConfiguration().setMaxEntriesInCache(0);
- cache.getCacheConfiguration().setTimeToLiveSeconds(0);
- cache.getCacheConfiguration().setTimeToIdleSeconds(0);
- }
-
- cache.getCacheConfiguration().freezeConfiguration();
-
- wanWatchdog.watch((Watchable) toolkitCache);
- }
-
- return toolkitCache;
- }
-
- @Override
- public WanAwareToolkitCache getOrCreateWanAwareToolkitCache(final String cacheManagerName,
- final String cacheName,
- final CacheConfiguration ehcacheConfig,
- final boolean masterCache,
- final boolean bidirectional) {
- final ToolkitCacheInternal toolkitCache =
- getOrCreateRegularToolkitCache(cacheManagerName, cacheName, ehcacheConfig);
- return createWanAwareToolkitCache(cacheManagerName, cacheName, toolkitCache, ehcacheConfig, masterCache, bidirectional);
- }
-
- private WanAwareToolkitCache createWanAwareToolkitCache(final String cacheManagerName,
- final String cacheName,
- final ToolkitCacheInternal toolkitCache,
- final CacheConfiguration cacheConfiguration,
- final boolean masterCache,
- final boolean bidirectional) {
- final String fullyQualifiedCacheName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName);
- final ToolkitMap configMap = getOrCreateConfigMap(fullyQualifiedCacheName);
- return new WanAwareToolkitCache((BufferingToolkitCache)toolkitCache, configMap,
- toolkit.getFeature(ToolkitFeatureType.NONSTOP),
- toolkit.getLock(toolkitCache.getName() + LOCK_TAG),
- cacheConfiguration, masterCache, bidirectional);
- }
-
- private ToolkitCacheInternal getOrCreateRegularToolkitCache(final String cacheManagerName,
- final String cacheName,
- final CacheConfiguration ehcacheConfig) {
- final Configuration toolkitCacheConfig = createClusteredCacheConfig(ehcacheConfig, cacheManagerName);
- final String fullyQualifiedCacheName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName);
- addNonStopConfigForCache(ehcacheConfig, fullyQualifiedCacheName);
- ToolkitCacheInternal toolkitCache = getOrCreateToolkitCache(fullyQualifiedCacheName, toolkitCacheConfig);
- addCacheEntityInfo(cacheName, ehcacheConfig, fullyQualifiedCacheName);
- return toolkitCache;
- }
-
- private ToolkitCacheInternal getOrCreateToolkitCache(final String fullyQualifiedCacheName,
- final Configuration toolkitCacheConfig) {
- return (ToolkitCacheInternal) toolkit.getCache(fullyQualifiedCacheName, toolkitCacheConfig,
- Serializable.class);
- }
-
- @Override
- public ToolkitNotifier getOrCreateConfigChangeNotifier(Ehcache cache) {
- return getOrCreateConfigChangeNotifier(cache.getCacheManager().getName(), cache.getName());
- }
-
- private ToolkitNotifier getOrCreateConfigChangeNotifier(String cacheManagerName, String cacheName) {
- String notifierName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + CONFIG_NOTIFIER_SUFFIX;
- ToolkitNotifier notifier = toolkit
- .getNotifier(notifierName, CacheConfigChangeNotificationMsg.class);
- addCacheMetaInfo(cacheName, ToolkitObjectType.NOTIFIER, notifierName);
- return notifier;
- }
-
- @Override
- public ToolkitNotifier getOrCreateCacheEventNotifier(Ehcache cache) {
- return getOrCreateCacheEventNotifier(cache.getCacheManager().getName(), cache.getName());
- }
-
- @Override
- public ToolkitNotifier getOrCreateCacheDisposalNotifier(Ehcache cache) {
- return toolkit.getNotifier(EhcacheEntitiesNaming.getToolkitCacheNameFor(cache.getCacheManager().getName(), cache.getName())
- + DELIMITER + DISPOSAL_NOTIFIER_SUFFIX, CacheDisposalNotification.class);
- }
-
- private ToolkitNotifier getOrCreateCacheEventNotifier(String cacheManagerName, String cacheName) {
- String notifierName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + EVENT_NOTIFIER_SUFFIX;
- ToolkitNotifier notifier = toolkit.getNotifier(notifierName,
- CacheEventNotificationMsg.class);
- addCacheMetaInfo(cacheName, ToolkitObjectType.NOTIFIER, notifierName);
- return notifier;
- }
-
- private static Configuration createClusteredCacheConfig(final CacheConfiguration ehcacheConfig,
- final String cacheManagerName) {
- ToolkitCacheConfigBuilder builder = new ToolkitCacheConfigBuilder();
- final TerracottaConfiguration terracottaConfiguration = ehcacheConfig.getTerracottaConfiguration();
- builder.maxTTISeconds((int) ehcacheConfig.getTimeToIdleSeconds());
- builder.maxTTLSeconds((int) ehcacheConfig.getTimeToLiveSeconds());
- builder.localCacheEnabled(terracottaConfiguration.isLocalCacheEnabled());
-
- // Fix for Dev-9223. Dont set anything incase of Default value. Assuming tookit and ehcache defaults are aligned.
- if (ehcacheConfig.getMaxEntriesInCache() != CacheConfiguration.DEFAULT_MAX_ENTRIES_IN_CACHE) {
- if (ehcacheConfig.getMaxEntriesInCache() > Integer.MAX_VALUE) {
- throw new IllegalArgumentException("Values greater than Integer.MAX_VALUE are not currently supported.");
- } else {
- builder.maxTotalCount((int) ehcacheConfig.getMaxEntriesInCache());
- }
- }
-
- if (terracottaConfiguration.isSynchronousWrites()) {
- builder.consistency(org.terracotta.toolkit.store.ToolkitConfigFields.Consistency.SYNCHRONOUS_STRONG);
- } else if (terracottaConfiguration.getConsistency() == Consistency.EVENTUAL) {
- builder.consistency(org.terracotta.toolkit.store.ToolkitConfigFields.Consistency.EVENTUAL);
- } else {
- builder.consistency(org.terracotta.toolkit.store.ToolkitConfigFields.Consistency.STRONG);
- }
-
- if (terracottaConfiguration.getConcurrency() == TerracottaConfiguration.DEFAULT_CONCURRENCY) {
- builder.concurrency(calculateCorrectConcurrency(ehcacheConfig));
- } else {
- builder.concurrency(terracottaConfiguration.getConcurrency());
- }
-
- builder.localCacheEnabled(terracottaConfiguration.isLocalCacheEnabled());
- builder.configField(ConfigFieldsInternal.LOCAL_STORE_MANAGER_NAME_NAME, cacheManagerName);
- builder.pinnedInLocalMemory(isPinnedInLocalMemory(ehcacheConfig));
- builder.evictionEnabled(!isPinnedInCache(ehcacheConfig));
- builder.maxCountLocalHeap((int) ehcacheConfig.getMaxEntriesLocalHeap());
- builder.maxBytesLocalHeap(ehcacheConfig.getMaxBytesLocalHeap());
- builder.maxBytesLocalOffheap(ehcacheConfig.getMaxBytesLocalOffHeap());
- builder.offheapEnabled(ehcacheConfig.isOverflowToOffHeap());
- builder.compressionEnabled(terracottaConfiguration.isCompressionEnabled());
- builder.copyOnReadEnabled(ehcacheConfig.isCopyOnRead());
-
- return builder.build();
- }
-
- private static boolean isPinnedInCache(final CacheConfiguration ehcacheConfig) {
- return ehcacheConfig.getPinningConfiguration() != null
- && ehcacheConfig.getPinningConfiguration().getStore() == PinningConfiguration.Store.INCACHE;
- }
-
- private static int calculateCorrectConcurrency(CacheConfiguration cacheConfiguration) {
- int maxElementOnDisk = cacheConfiguration.getMaxElementsOnDisk();
- if (maxElementOnDisk <= 0 || maxElementOnDisk >= ToolkitConfigFields.DEFAULT_CONCURRENCY) { return ToolkitConfigFields.DEFAULT_CONCURRENCY; }
- int concurrency = 1;
- while (concurrency * 2 <= maxElementOnDisk) {// this while loop is not very time consuming, maximum it will do 8
- // iterations
- concurrency *= 2;
- }
- return concurrency;
- }
-
- private static boolean isPinnedInLocalMemory(CacheConfiguration ehcacheConfig) {
- return ehcacheConfig.getPinningConfiguration() != null
- && ehcacheConfig.getPinningConfiguration().getStore() == PinningConfiguration.Store.LOCALMEMORY;
- }
-
- @Override
- public String getFullyQualifiedCacheName(Ehcache cache) {
- return EhcacheEntitiesNaming.getToolkitCacheNameFor(getCacheManagerName(cache), cache.getName());
- }
-
- private static String getCacheManagerName(Ehcache cache) {
- final String cacheMgrName;
- if (cache.getCacheManager().isNamed()) {
- cacheMgrName = cache.getCacheManager().getName();
- } else {
- cacheMgrName = TerracottaClusteredInstanceFactory.DEFAULT_CACHE_MANAGER_NAME;
- }
- return cacheMgrName;
- }
-
- @Override
- public ToolkitLock getOrCreateStoreLock(Ehcache cache) {
- return toolkit.getLock(getFullyQualifiedCacheName(cache) + DELIMITER + "storeRWLock");
- }
-
- @Override
- public ToolkitMap getOrCreateExtractorsMap(final String cacheManagerName, String cacheName) {
- // implemented in ee version
- throw new UnsupportedOperationException();
- }
-
- @Override
- public ToolkitMap getOrCreateAttributeMap(final String cacheManagerName, String cacheName) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public void shutdown() {
- if (clusteredCacheManagerEntity != null) {
- try {
- clusteredCacheManagerEntity.releaseUse();
- } catch (Exception e) {
- // Ignore - will be shutting down toolkit anyway
- LOGGER.debug("Exception occurred while releasing clustered cache manager entity use", e);
- }
- }
- clusteredEntityManager.dispose();
- toolkit.shutdown();
- }
-
- @Override
- public SerializedToolkitCache getOrCreateAllSoftLockMap(String cacheManagerName,
- String cacheName) {
- // TODO: what should be the local cache config for the map?
- Configuration config = new ToolkitStoreConfigBuilder()
- .consistency(org.terracotta.toolkit.store.ToolkitConfigFields.Consistency.STRONG).build();
- String softLockCacheName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + ALL_SOFT_LOCKS_MAP_SUFFIX;
- ToolkitCache map = toolkit
- .getCache(softLockCacheName, config, SerializedReadCommittedClusteredSoftLock.class);
- addCacheMetaInfo(cacheName, ToolkitObjectType.CACHE, softLockCacheName);
- return new SerializedToolkitCache(map);
-
- }
-
- @Override
- public ToolkitMap getOrCreateNewSoftLocksSet(String cacheManagerName,
- String cacheName) {
- String softLockMapName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + NEW_SOFT_LOCKS_LIST_SUFFIX;
- ToolkitMap softLockMap = toolkit
- .getMap(softLockMapName, SerializedReadCommittedClusteredSoftLock.class, Integer.class);
- addCacheMetaInfo(cacheName, ToolkitObjectType.MAP, softLockMapName);
- return softLockMap;
- }
-
- @Override
- public ToolkitMap getOrCreateAsyncConfigMap() {
- return toolkit.getMap(EhcacheEntitiesNaming.getAsyncConfigMapName(), String.class, AsyncConfig.class);
- }
-
- @Override
- public ToolkitMap> getOrCreateAsyncListNamesMap(String fullAsyncName, String cacheName) {
- ToolkitMap asyncListNames = toolkit.getMap(fullAsyncName, String.class, Set.class);
- addCacheMetaInfo(cacheName, ToolkitObjectType.MAP, fullAsyncName);
- addKeyRemoveInfo(cacheName, EhcacheEntitiesNaming.getAsyncConfigMapName(), fullAsyncName);
- return asyncListNames;
- }
-
- @Override
- public ToolkitListInternal getAsyncProcessingBucket(String bucketName, String cacheName) {
- ToolkitListInternal toolkitList = (ToolkitListInternal) toolkit.getList(bucketName, null);
- addCacheMetaInfo(cacheName, ToolkitObjectType.LIST, bucketName);
- return toolkitList;
- }
-
- @Override
- public ToolkitMap getOrCreateClusteredStoreConfigMap(String cacheManagerName, String cacheName) {
- String configMapName = EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName);
- ToolkitMap configMap = getOrCreateConfigMap(configMapName);
- addCacheMetaInfo(cacheName, ToolkitObjectType.MAP, configMapName);
- return configMap;
- }
-
- private ToolkitMap getOrCreateConfigMap(final String fullyQualifiedCacheName) {
- // TODO: what should be the local cache config for the map?
- return toolkit.getMap(EhcacheEntitiesNaming.getToolkitCacheConfigMapName(fullyQualifiedCacheName), String.class, Serializable.class);
- }
-
- @Override
- public SerializedToolkitCache getOrCreateTransactionCommitStateMap(String cacheManagerName) {
- // TODO: what should be the local cache config for the map?
- Configuration config = new ToolkitStoreConfigBuilder()
- .consistency(org.terracotta.toolkit.store.ToolkitConfigFields.Consistency.SYNCHRONOUS_STRONG).build();
- ToolkitCache map = toolkit.getCache(cacheManagerName + DELIMITER
- + EHCACHE_TXNS_DECISION_STATE_MAP_NAME, config,
- Decision.class);
- return new SerializedToolkitCache(map);
- }
-
- @Override
- public ToolkitLock getSoftLockWriteLock(String cacheManagerName, String cacheName, TransactionID transactionID,
- Object key) {
-
- return toolkit.getLock(EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + serializeToString(transactionID) + DELIMITER + serializeToString(key) + DELIMITER
- + EHCACHE_TXNS_SOFTLOCK_WRITE_LOCK_NAME);
- }
-
- @Override
- public ToolkitLock getLockForCache(Ehcache cache, String lockName) {
- return toolkit.getLock(getFullyQualifiedCacheName(cache) + DELIMITER + lockName);
- }
-
-
-
- private static String serializeToString(Object serializable) {
- try {
- return SerializationHelper.serializeToString(serializable);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public ToolkitReadWriteLock getSoftLockFreezeLock(String cacheManagerName, String cacheName,
- TransactionID transactionID, Object key) {
-
- return toolkit.getReadWriteLock(EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + serializeToString(transactionID) + DELIMITER + serializeToString(key) + DELIMITER
- + EHCACHE_TXNS_SOFTLOCK_FREEZE_LOCK_NAME);
- }
-
- @Override
- public ToolkitReadWriteLock getSoftLockNotifierLock(String cacheManagerName, String cacheName,
- TransactionID transactionID, Object key) {
-
- return toolkit.getReadWriteLock(EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName) + DELIMITER
- + serializeToString(transactionID) + DELIMITER + serializeToString(key) + DELIMITER
- + EHCACHE_TXNS_SOFTLOCK_NOTIFIER_LOCK_NAME);
- }
-
- @Override
- public boolean destroy(final String cacheManagerName, final String cacheName) {
- getOrCreateAllSoftLockMap(cacheManagerName, cacheName).destroy();
- getOrCreateNewSoftLocksSet(cacheManagerName, cacheName).destroy();
- getOrCreateCacheEventNotifier(cacheManagerName, cacheName).destroy();
- getOrCreateConfigChangeNotifier(cacheManagerName, cacheName).destroy();
- getOrCreateToolkitCache(EhcacheEntitiesNaming.getToolkitCacheNameFor(cacheManagerName, cacheName),
- new ToolkitCacheConfigBuilder().maxCountLocalHeap(1).maxBytesLocalOffheap(0).build())
- .destroy();
-
- // We always write the transactional mode into this config map, so theoretically if the cache existed, this map
- // won't be empty.
- ToolkitMap clusteredStoreConfigMap = getOrCreateClusteredStoreConfigMap(cacheManagerName, cacheName);
- boolean existed = !clusteredStoreConfigMap.isEmpty();
- clusteredStoreConfigMap.destroy();
-
- return existed;
- }
-
- protected void addNonStopConfigForCache(final CacheConfiguration ehcacheConfig, final String fullyQualifiedCacheName) {
- final TerracottaConfiguration terracottaConfiguration = ehcacheConfig.getTerracottaConfiguration();
- ToolkitNonStopConfiguration nonstopConfiguration = new ToolkitNonStopConfiguration(
- terracottaConfiguration
- .getNonstopConfiguration());
- toolkit.getFeature(ToolkitFeatureType.NONSTOP).getNonStopConfigurationRegistry()
- .registerForInstance(nonstopConfiguration, fullyQualifiedCacheName, ToolkitObjectType.CACHE);
- }
-
- @Override
- public void removeNonStopConfigforCache(Ehcache cache) {
- toolkit.getFeature(ToolkitFeatureType.NONSTOP).getNonStopConfigurationRegistry()
- .deregisterForInstance(getFullyQualifiedCacheName(cache), ToolkitObjectType.CACHE);
-
- }
-
- protected void addCacheMetaInfo(String cacheName, ToolkitObjectType type, String dsName) {
- ToolkitBackedClusteredCacheManager tbccm = (ToolkitBackedClusteredCacheManager) clusteredCacheManagerEntity;
- tbccm.addCacheMetaInfo(cacheName, type, dsName);
- }
-
- private void addKeyRemoveInfo(String cacheName, String toolkitMapName, String keytoBeRemoved) {
- ToolkitBackedClusteredCacheManager tbccm = (ToolkitBackedClusteredCacheManager) clusteredCacheManagerEntity;
- tbccm.addKeyRemoveInfo(cacheName, toolkitMapName, keytoBeRemoved);
- }
-
- @Override
- public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) {
- Objects.requireNonNull(cacheManagerName);
- if (clusteredCacheManagerEntity == null) {
- try {
- logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration);
-
- ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName,
- ClusteredCacheManager.class);
- ToolkitReadWriteLock cmRWLock = clusteredEntityManager.getEntityLock(EhcacheEntitiesNaming
- .getCacheManagerLockNameFor(cacheManagerName));
- ToolkitLock cmWriteLock = cmRWLock.writeLock();
- while (clusteredCacheManager == null) {
- if (cmWriteLock.tryLock()) {
- try {
- clusteredCacheManager = createClusteredCacheManagerEntity(cacheManagerName, configuration);
- } finally {
- cmWriteLock.unlock();
- }
- } else {
- clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);
- }
- }
- clusteredCacheManagerEntity = clusteredCacheManager;
- entityNames.setCacheManagerName(cacheManagerName);
- } catch (RuntimeException re) {
- entityNames.linkFailure = re;
- throw re;
- }
- }
- }
-
- private void logCacheManagerConfigInTerracottaClientLogs(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) {
- ToolkitLogger logger = ((ToolkitInternal)toolkit).getLogger(CONFIG_LOGGER_NAME);
- if (logger.isInfoEnabled()) {
- try {
- logger.info("Configuration for clustered cache manager " + cacheManagerName + ":\n" +
- convertConfigurationToXMLString(configuration, cacheManagerName, true));
- } catch (Exception e) {
- logger.warn("Exception while trying to log configuration for clustered cache manager " + cacheManagerName, e);
- }
- }
- }
-
- private ClusteredCacheManager createClusteredCacheManagerEntity(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) {
- ClusteredCacheManager clusteredCacheManager;
- String xmlConfig = convertConfigurationToXMLString(configuration, cacheManagerName, true);
- clusteredCacheManager = new ToolkitBackedClusteredCacheManager(cacheManagerName,
- new ClusteredCacheManagerConfiguration(xmlConfig));
- ClusteredCacheManager existing = clusteredEntityManager.addRootEntityIfAbsent(cacheManagerName, ClusteredCacheManager.class, clusteredCacheManager);
- if (existing != null) {
- clusteredCacheManager = existing;
- }
- return clusteredCacheManager;
- }
-
- @Override
- public ToolkitMap getOrCreateCacheManagerMetaInfoMap(String cacheManagerName) {
- String configMapName = EhcacheEntitiesNaming.getCacheManagerConfigMapName(cacheManagerName);
- ToolkitMap configMap = toolkit.getMap(configMapName, String.class, Serializable.class);
- return configMap;
- }
-
- void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) {
- if (clusteredCacheManagerEntity == null) {
- throw new IllegalStateException(format("ClusteredCacheManger entity not configured for cache %s", cacheName));
- }
-
- logCacheConfigInTerracottaClientLogs(cacheName, ehcacheConfig);
-
- ClusteredCache cacheEntity = clusteredCacheManagerEntity.getCache(cacheName);
- if (cacheEntity == null) {
- ToolkitReadWriteLock cacheRWLock = clusteredCacheManagerEntity.getCacheLock(cacheName);
- ToolkitLock cacheWriteLock = cacheRWLock.writeLock();
- while (cacheEntity == null) {
- if (cacheWriteLock.tryLock()) {
- try {
- cacheEntity = createClusteredCacheEntity(cacheName, ehcacheConfig, toolkitCacheName);
- } finally {
- cacheWriteLock.unlock();
- }
- } else {
- cacheEntity = clusteredCacheManagerEntity.getCache(cacheName);
- }
- }
- }
- // TODO check some config elements
- clusteredCacheManagerEntity.markCacheInUse(cacheEntity);
- entityNames.addCacheName(cacheName);
- }
-
- private void logCacheConfigInTerracottaClientLogs(String cacheName, CacheConfiguration ehcacheConfig) {
- ToolkitLogger logger = ((ToolkitInternal)toolkit).getLogger(CONFIG_LOGGER_NAME);
- if (logger.isInfoEnabled()) {
- try {
- logger.info("Client configuration for clustered cache named " + cacheName + ":\n(clustered properties may differ in runtime cache depending on configuration used at creation time)\n" +
- convertCacheConfigurationToXMLString(ehcacheConfig));
- } catch (Exception e) {
- logger.warn("Exception while trying to log configuration for clustered cache " + cacheName, e);
- }
- }
- }
-
- private ClusteredCache createClusteredCacheEntity(String cacheName, CacheConfiguration ehcacheConfig, String toolkitCacheName) {
- ClusteredCacheConfiguration clusteredConfiguration = createClusteredCacheConfiguration(ehcacheConfig);
- ClusteredCache cacheEntity = new ToolkitBackedClusteredCache(cacheName, clusteredConfiguration, toolkitCacheName);
-
- ClusteredCache existing = clusteredCacheManagerEntity.addCacheIfAbsent(cacheName, cacheEntity);
- if (existing != null) {
- cacheEntity = existing;
- }
- return cacheEntity;
- }
-
- private ClusteredCacheConfiguration createClusteredCacheConfiguration(CacheConfiguration ehcacheConfig) {
- String xmlConfig = convertCacheConfigurationToXMLString(ehcacheConfig);
- return new ClusteredCacheConfiguration(xmlConfig);
- }
-
- private String convertCacheConfigurationToXMLString(CacheConfiguration ehcacheConfig) {
- net.sf.ehcache.config.Configuration configuration = parseCacheManagerConfiguration(clusteredCacheManagerEntity.getConfiguration()
- .getConfigurationAsText());
- return ConfigurationUtil.generateCacheConfigurationText(configuration, ehcacheConfig);
- }
-
- @Override
- public void unlinkCache(String cacheName) {
- entityNames.removeCacheName(cacheName);
- ClusteredCache cacheEntity = clusteredCacheManagerEntity.getCache(cacheName);
- clusteredCacheManagerEntity.releaseCacheUse(cacheEntity);
- }
-
- @Override
- public void clusterRejoined() {
- synchronized (entityNames) {
- String cacheManagerName = entityNames.cacheManagerName;
- /*
- * There's tricky race condition in the cache manager's initialization that requires a perfectly timed disconnection event plus a rejoin event to happen at the exact right moment.
- *
- * In a normal scenario, here is what happens when a clustered cache manager gets initialized:
- *
- * CacheManager.doInit() is called
- * then terracottaClient.createClusteredInstanceFactory() is called
- * then terracottaClient.getClusteredInstanceFactory().linkClusteredCacheManager(getName(), configuration) is called
- *
- * If any call in doInit() fails, the ClusteredInstanceFactory gets cleaned up which tears down the L1 (plus other local cleanups).
- *
- * The linkClusteredCacheManager() call initializes a cacheManagerName variable in ToolkitInstanceFactoryImpl, which is then used later on during a rejoin to tell the entity manager that this cache manager is being released then re-used.
- *
- *
- * Now imagine what would happen in the following scenario:
- *
- * CacheManager.doInit() is called
- * then terracottaClient.createClusteredInstanceFactory() is called and succeeds
- * then a disconnection happens
- * then terracottaClient.getClusteredInstanceFactory().linkClusteredCacheManager(getName(), configuration) is called and fails, the cacheManagerName variable in ToolkitInstanceFactoryImpl is left to null
- * then rejoin happens
- * then the clusterRejoined() notification that tries to read the cacheManagerName variable gets called before the doInit() teardown happens
- *
- * -> you get a NPE from clusterRejoined()
- *
- * Hence, this null check is about catching this exact event, log it clearly and force shutting down the L1.
- */
- if (cacheManagerName == null) {
- LOGGER.error("Cache Manager {} linking to the entity manager failed - shutting down to prevent any further use of clustered features", cacheManagerName, entityNames.linkFailure);
- shutdown();
- return;
- }
-
- ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName,
- ClusteredCacheManager.class);
- if (clusteredCacheManager == null) {
- LOGGER.error("Cache Manager {} has been destroyed by some other node - shutting down to prevent any further use of clustered features", cacheManagerName);
- shutdown();
- } else {
- // release Cache Manager lock after rejoin
- try {
- clusteredCacheManager.releaseUse();
- } catch (Exception e) {
- // Ignore - just trying to clean up
- LOGGER.trace("Exception trying to release cache manager {} after rejoin", entityNames.cacheManagerName);
- }
-
- // release cache read lock after rejoin
- for (String cacheName : entityNames.getCacheNames()) {
- ClusteredCache cacheEntity = clusteredCacheManagerEntity.getCache(cacheName);
- if (cacheEntity != null) {
- try {
- clusteredCacheManagerEntity.releaseCacheUse(cacheEntity);
- } catch (Exception e) {
- // Ignore - just trying to clean up
- LOGGER.trace("Exception trying to release cache {} after rejoin", cacheName);
- }
- }
- }
-
- int retryCount = 0;
- boolean success = false;
- while (retryCount < RETRY_MARK_IN_USE_AFTER_REJOIN) {
- // grab Cache Manager read lock after rejoin
- try {
- clusteredCacheManager.markInUse();
- success = (clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class) != null);
- break;
- } catch (Exception e) {
- try {
- TimeUnit.SECONDS.sleep(1);
- } catch (InterruptedException e1) {
- // Do nothing
- }
- retryCount++;
- }
- }
- if (!success) {
- LOGGER.error("Unable to mark cache manager {} in use - shutting down to prevent any further use of clustered features", cacheManagerName);
- shutdown();
- } else {
- // grab cache read lock after rejoin
- for (String cacheName : entityNames.getCacheNames()) {
- boolean successCache = false;
- int retryCountCache = 0;
- while (!successCache && retryCountCache < RETRY_MARK_IN_USE_AFTER_REJOIN) {
- ClusteredCache cacheEntity = clusteredCacheManagerEntity.getCache(cacheName);
- if (cacheEntity == null) {
- LOGGER.error("Cache " + cacheName + " has been destroyed by some other node");
- successCache = true;
- } else {
- try {
- clusteredCacheManagerEntity.markCacheInUse(cacheEntity);
- successCache = true;
- } catch (Exception e) {
- try {
- TimeUnit.SECONDS.sleep(1);
- } catch (InterruptedException e1) {
- // Do nothing
- }
- retryCountCache++;
- }
- }
- }
- }
- }
- }
- }
- }
-
- private String convertConfigurationToXMLString(net.sf.ehcache.config.Configuration configuration, String cacheManagerName, boolean stripCacheConfigs) {
- net.sf.ehcache.config.Configuration targetConfiguration = cloneConfiguration(configuration);
- targetConfiguration.setName(cacheManagerName);
- if (stripCacheConfigs) {
- targetConfiguration.getCacheConfigurations().clear();
- }
- return ConfigurationUtil.generateCacheManagerConfigurationText(targetConfiguration);
- }
-
- private net.sf.ehcache.config.Configuration cloneConfiguration(net.sf.ehcache.config.Configuration configuration) {
- String tmp = ConfigurationUtil.generateCacheManagerConfigurationText(configuration);
- net.sf.ehcache.config.Configuration targetConfiguration;
- targetConfiguration = parseCacheManagerConfiguration(tmp);
- return targetConfiguration;
- }
-
- private net.sf.ehcache.config.Configuration parseCacheManagerConfiguration(String xmlCacheManagerConfig) {
- net.sf.ehcache.config.Configuration targetConfiguration;
- targetConfiguration = ConfigurationFactory.parseConfiguration(new BufferedInputStream(new ByteArrayInputStream(xmlCacheManagerConfig
- .getBytes())));
- return targetConfiguration;
- }
-
- private class EntityNamesHolder {
- volatile RuntimeException linkFailure;
-
- private String cacheManagerName;
- private final Set cacheNames;
-
- private EntityNamesHolder() {
- cacheNames = new HashSet();
- }
-
- private synchronized void setCacheManagerName(String cacheMgrName) {
- if (cacheManagerName == null) {
- cacheManagerName = cacheMgrName;
- ToolkitInstanceFactoryImpl.this.clusteredCacheManagerEntity.markInUse();
- }
- }
-
- private synchronized void addCacheName(String cacheName) {
- cacheNames.add(cacheName);
- }
-
- private synchronized void removeCacheName(String cacheName) {
- cacheNames.remove(cacheName);
- }
-
- private Set getCacheNames() {
- return Collections.unmodifiableSet(cacheNames);
- }
- }
-
- private static class EhcacheTcConfig {
- private enum Type {
- URL, EMBEDDED_TC_CONFIG, FILE
- }
-
- private final Type type;
- private final String tcConfigUrlOrSnippet;
-
- private EhcacheTcConfig(Type type, String config) {
- this.type = type;
- this.tcConfigUrlOrSnippet = config;
- }
-
- public static EhcacheTcConfig create(TerracottaClientConfiguration config) {
- if (config.isUrlConfig()) {
- String urlOrFilePath = config.getUrl();
- if (isFile(urlOrFilePath)) {
- return new EhcacheTcConfig(Type.FILE, slurpFile(urlOrFilePath));
- } else if (isValidURL(urlOrFilePath)) {
- return new EhcacheTcConfig(Type.EMBEDDED_TC_CONFIG, fetchConfigFromURL(urlOrFilePath));
- } else {
- return new EhcacheTcConfig(Type.URL, urlOrFilePath);
- }
- } else {
- return new EhcacheTcConfig(Type.EMBEDDED_TC_CONFIG, config.getEmbeddedConfig());
- }
- }
-
- private static String slurpFile(String urlOrFilePath) {
- try {
- return fetchConfigFromStream(new FileInputStream(urlOrFilePath));
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static boolean isFile(String urlOrFilePath) {
- File file = new File(urlOrFilePath);
- return file.exists() && file.isFile();
- }
-
- private static String fetchConfigFromURL(String urlOrFilePath) {
- try {
- return fetchConfigFromStream(new URL(urlOrFilePath).openStream());
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static String fetchConfigFromStream(InputStream inputStream) {
- try {
- StringBuilder builder = new StringBuilder();
- BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
- String line = null;
- while ((line = br.readLine()) != null) {
- builder.append(line);
- }
- return builder.toString();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static boolean isValidURL(String urlOrFilePath) {
- try {
- new URL(urlOrFilePath);
- return true;
- } catch (MalformedURLException e) {
- return false;
- }
- }
-
- }
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/GetKeysClient.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/GetKeysClient.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/ehcache/tests/GetKeysClient.java (revision 0)
@@ -1,58 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.toolkit.Toolkit;
-
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author Chris Dennis
- */
-public class GetKeysClient extends ClientBase {
-
- public static void main(String[] args) {
- new GetKeysClient(args).run();
- }
-
- public GetKeysClient(String[] args) {
- super("test", args);
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit toolkit) {
- cache.put(new Element(new Date(), "now"));
-
- List keys = cache.getKeys();
- boolean interrupted = false;
- try {
- long end = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);
- while (System.nanoTime() < end && keys.isEmpty()) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- interrupted = true;
- }
- keys = cache.getKeys();
- }
- } finally {
- if (interrupted) {
- Thread.currentThread().interrupt();
- }
- }
- if (keys.isEmpty()) {
- throw new AssertionError();
- }
- for (Object key : keys) {
- if (!(key instanceof Date)) {
- throw new AssertionError("Expected Date type for key");
- }
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/statistics/PassThroughStatisticsTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/statistics/PassThroughStatisticsTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/statistics/PassThroughStatisticsTest.java (revision 0)
@@ -1,82 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package net.sf.ehcache.statistics;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.statistics.extended.ExtendedStatistics;
-
-import org.junit.Test;
-
-import static org.hamcrest.core.Is.*;
-import static org.hamcrest.number.OrderingComparison.*;
-import static org.junit.Assert.assertThat;
-
-/**
- *
- * @author cdennis
- */
-public class PassThroughStatisticsTest {
-
- @Test
- public void testGetSize() {
- CacheManager manager = new CacheManager(new Configuration().name("foo-manager"));
- try {
- Cache foo = new Cache(new CacheConfiguration().name("foo").maxEntriesLocalHeap(1000));
- manager.addCache(foo);
-
- ExtendedStatistics extendedStats = foo.getStatistics().getExtended();
-
- assertThat(extendedStats.size().value().longValue(), is(0L));
-
- foo.put(new Element("foo", "foo"));
-
- assertThat(extendedStats.size().value().longValue(), is(1L));
- } finally {
- manager.shutdown();
- }
- }
-
- @Test
- public void testGetLocalHeapSize() {
- CacheManager manager = new CacheManager(new Configuration().name("foo-manager"));
- try {
- Cache foo = new Cache(new CacheConfiguration().name("foo").maxEntriesLocalHeap(1000));
- manager.addCache(foo);
-
- ExtendedStatistics extendedStats = foo.getStatistics().getExtended();
-
- assertThat(extendedStats.localHeapSize().value().longValue(), is(0L));
-
- foo.put(new Element("foo", "foo"));
-
- assertThat(extendedStats.localHeapSize().value().longValue(), is(1L));
- } finally {
- manager.shutdown();
- }
- }
-
- @Test
- public void testGetLocalHeapSizeInBytes() {
- CacheManager manager = new CacheManager(new Configuration().name("foo-manager"));
- try {
- Cache foo = new Cache(new CacheConfiguration().name("foo").maxEntriesLocalHeap(1000));
- manager.addCache(foo);
-
- ExtendedStatistics extendedStats = foo.getStatistics().getExtended();
-
- assertThat(extendedStats.localHeapSize().value().longValue(), is(0L));
-
- foo.put(new Element("foo", "foo"));
-
- assertThat(extendedStats.localHeapSizeInBytes().value().longValue(), greaterThan(1L));
- } finally {
- manager.shutdown();
- }
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache/src/test/resources/serializedforms/ElementSerializationTest.testBasic.ser
===================================================================
diff -u -N -r11412 -r11530
Binary files differ
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/distribution/PayloadUtilPerfTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/distribution/PayloadUtilPerfTest.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/distribution/PayloadUtilPerfTest.java (revision 0)
@@ -1,94 +0,0 @@
-package net.sf.ehcache.distribution;
-
-import net.sf.ehcache.StopWatch;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Set;
-
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ConfigurationFactory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Alex Snaps
- */
-public class PayloadUtilPerfTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(PayloadUtilPerfTest.class.getName());
-
- /**
- * 376 µs per one gzipping each time.
- * .1 µs if we compare hashCodes on the String and only gzip as necessary.
- *
- * @throws java.io.IOException
- * @throws InterruptedException
- */
- @Test
- public void testGzipSanityAndPerformance() throws IOException, InterruptedException {
- String payload = createReferenceString();
- // warmup vm
- for (int i = 0; i < 10; i++) {
- byte[] compressed = PayloadUtil.gzip(payload.getBytes());
- // make sure we don't forget to close the stream
- assertTrue(compressed.length > 300);
- Thread.sleep(20);
- }
- int hashCode = payload.hashCode();
- StopWatch stopWatch = new StopWatch();
- for (int i = 0; i < 10000; i++) {
- if (hashCode != payload.hashCode()) {
- PayloadUtil.gzip(payload.getBytes());
- }
- }
- long elapsed = stopWatch.getElapsedTime();
- LOG.info("Gzip took " + elapsed / 10F + " µs");
- }
-
- /**
- * 169 µs per one.
- *
- * @throws IOException
- * @throws InterruptedException
- */
- @Test
- public void testUngzipPerformance() throws IOException, InterruptedException {
- String payload = createReferenceString();
- int length = payload.toCharArray().length;
- byte[] original = payload.getBytes();
- int byteLength = original.length;
- assertEquals(length, byteLength);
- byte[] compressed = PayloadUtil.gzip(original);
- // warmup vm
- for (int i = 0; i < 10; i++) {
- byte[] uncompressed = PayloadUtil.ungzip(compressed);
- uncompressed.hashCode();
- assertEquals(original.length, uncompressed.length);
- Thread.sleep(20);
- }
- StopWatch stopWatch = new StopWatch();
- for (int i = 0; i < 10000; i++) {
- PayloadUtil.ungzip(compressed);
- }
- long elapsed = stopWatch.getElapsedTime();
- LOG.info("Ungzip took " + elapsed / 10000F + " µs");
- }
-
- private String createReferenceString() {
- Configuration config = ConfigurationFactory.parseConfiguration(PayloadUtilPerfTest.class.getResource("/cachemanager-perf.xml"));
- Set names = config.getCacheConfigurations().keySet();
- String urlBase = "//localhost.localdomain:12000/";
- StringBuilder buffer = new StringBuilder();
- for (String name : names) {
- buffer.append(urlBase);
- buffer.append(name);
- buffer.append("|");
- }
- String payload = buffer.toString();
- return payload;
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/UuidItem.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/UuidItem.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/UuidItem.java (revision 0)
@@ -1,29 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.hibernate.domain;
-
-public class UuidItem {
- private String id;
- private String name;
- private String description;
-
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/EventManager.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/EventManager.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/EventManager.java (revision 0)
@@ -1,249 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.hibernate.domain;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-public class EventManager {
-
- private final SessionFactory sessionFactory;
-
- public EventManager(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
-
- public List listEmailsOfEvent(Long eventId) {
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- List emailList = new ArrayList();
- Event event = (Event) session.load(Event.class, eventId);
- for (Iterator it = event.getParticipants().iterator(); it.hasNext();) {
- Person person = (Person) it.next();
- emailList.addAll(person.getEmailAddresses());
- }
-
- session.getTransaction().commit();
- return emailList;
- }
-
- public Long createAndStoreEvent(String title, Person organizer, Date theDate) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- Event theEvent = new Event();
- theEvent.setTitle(title);
- theEvent.setDate(theDate);
- theEvent.setOrganizer(organizer);
-
- Long eventId = (Long) session.save(theEvent);
-
- session.getTransaction().commit();
- return eventId;
- }
-
- public Long createAndStorePerson(String firstName, String lastName) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- Person person = new Person();
- person.setFirstname(firstName);
- person.setLastname(lastName);
-
- Long personId = (Long) session.save(person);
-
- session.getTransaction().commit();
- return personId;
- }
-
- public Long createAndStorePerson(Person person) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- Long personId = (Long) session.save(person);
-
- session.getTransaction().commit();
- return personId;
- }
-
- public List listEvents() {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- List result = session.createQuery("from Event").setCacheable(true).list();
-
- session.getTransaction().commit();
-
- return result;
- }
-
- /**
- * Call setEntity() on a cacheable query - see FORGE-265
- */
- public List listEventsOfOrganizer(Person organizer) {
-
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- Query query = session.createQuery("from Event ev where ev.organizer = :organizer");
-
- query.setCacheable(true);
- query.setEntity("organizer", organizer);
- List result = query.list();
-
- session.getTransaction().commit();
-
- return result;
- }
-
- /**
- * Use a Criteria query - see FORGE-247
- */
- public List listEventsWithCriteria() {
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- List result = session.createCriteria(Event.class)
- .setCacheable(true)
- .list();
-
- session.getTransaction().commit();
-
- return result;
- }
-
- public void addPersonToEvent(Long personId, Long eventId) {
-
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Person aPerson = (Person) session.load(Person.class, personId);
- Event anEvent = (Event) session.load(Event.class, eventId);
-
- aPerson.getEvents().add(anEvent);
-
- session.getTransaction().commit();
- }
-
- public Long addPersonToAccount(Long personId, Account account) {
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Person aPerson = (Person) session.load(Person.class, personId);
- account.setPerson(aPerson);
-
- Long accountId = (Long) session.save(account);
-
- session.getTransaction().commit();
- return accountId;
- }
-
- public Account getAccount(Long accountId) {
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Account account = (Account) session.load(Account.class, accountId);
-
- session.getTransaction().commit();
- return account;
- }
-
- public void addEmailToPerson(Long personId, String emailAddress) {
-
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Person aPerson = (Person) session.load(Person.class, personId);
-
- // The getEmailAddresses() might trigger a lazy load of the collection
- aPerson.getEmailAddresses().add(emailAddress);
-
- session.getTransaction().commit();
- }
-
- public void addPhoneNumberToPerson(Long personId, PhoneNumber pN) {
-
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Person aPerson = (Person) session.load(Person.class, personId);
- pN.setPersonId(personId.longValue());
- aPerson.getPhoneNumbers().add(pN);
-
- session.getTransaction().commit();
- }
-
- public void addTalismanToPerson(Long personId, String talisman) {
-
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- Person aPerson = (Person) session.load(Person.class, personId);
- aPerson.addTalisman(talisman);
-
- session.getTransaction().commit();
- }
-
- public Long createHolidayCalendar() {
-
- Session session = sessionFactory.getCurrentSession();
- session.beginTransaction();
-
- // delete all existing calendars
- List calendars = session.createQuery("from HolidayCalendar").setCacheable(true).list();
- for (ListIterator li = calendars.listIterator(); li.hasNext();) {
- session.delete(li.next());
- }
-
- HolidayCalendar calendar = new HolidayCalendar();
- calendar.init();
-
- Long calendarId = (Long) session.save(calendar);
-
- session.getTransaction().commit();
- return calendarId;
- }
-
- public HolidayCalendar getHolidayCalendar() {
- Session session = sessionFactory.getCurrentSession();
-
- session.beginTransaction();
-
- List calendars = session.createQuery("from HolidayCalendar").setCacheable(true).list();
-
- session.getTransaction().commit();
-
- return calendars.isEmpty() ? null : (HolidayCalendar) calendars.get(0);
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/config/generator/AttributeIgnoringXMLGenerator.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/config/generator/AttributeIgnoringXMLGenerator.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/test/java/net/sf/ehcache/config/generator/AttributeIgnoringXMLGenerator.java (revision 0)
@@ -1,45 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.config.generator;
-
-import java.io.PrintWriter;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.ehcache.config.generator.model.NodeAttribute;
-import net.sf.ehcache.config.generator.model.NodeElement;
-import net.sf.ehcache.config.generator.model.XMLGeneratorVisitor;
-
-public class AttributeIgnoringXMLGenerator extends XMLGeneratorVisitor {
-
- private final Set ignoredAttributes;
-
- public AttributeIgnoringXMLGenerator(PrintWriter out, String... ignoredAttributes) {
- super(out);
- this.ignoredAttributes = new HashSet(Arrays.asList(ignoredAttributes));
- }
-
- @Override
- protected void visitAttribute(NodeElement element, NodeAttribute attribute) {
- if (ignoredAttributes.contains(attribute.getName())) {
- return;
- }
- super.visitAttribute(element, attribute);
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/http-url-config-cache-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/http-url-config-cache-test.xml (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/system-tests/src/test/resources/http-url-config-cache-test.xml (revision 0)
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.9.0.411/ehcache-scheduled-refresh/src/main/java/net/sf/ehcache/constructs/scheduledrefresh/ScheduledRefreshCacheExtensionFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-scheduled-refresh/src/main/java/net/sf/ehcache/constructs/scheduledrefresh/ScheduledRefreshCacheExtensionFactory.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-scheduled-refresh/src/main/java/net/sf/ehcache/constructs/scheduledrefresh/ScheduledRefreshCacheExtensionFactory.java (revision 0)
@@ -1,48 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.ehcache.constructs.scheduledrefresh;
-
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.extension.CacheExtension;
-import net.sf.ehcache.extension.CacheExtensionFactory;
-
-import java.util.Properties;
-
-/**
- * Factory class for generating instances of
- * {@link ScheduledRefreshCacheExtension}. This is the class used in the
- * ehcache.xml file to add and extension to a cache.
- *
- * @author cschanck
- */
-public class ScheduledRefreshCacheExtensionFactory extends CacheExtensionFactory {
- /**
- * No arg constructor.
- */
- public ScheduledRefreshCacheExtensionFactory() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public CacheExtension createCacheExtension(Ehcache cache, Properties properties) {
- ScheduledRefreshConfiguration config = new ScheduledRefreshConfiguration().fromProperties(properties).build();
- return new ScheduledRefreshCacheExtension(config, cache);
- }
-
-}
Index: rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/exceptions/ProcessingException.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/exceptions/ProcessingException.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/exceptions/ProcessingException.java (revision 0)
@@ -1,11 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async.exceptions;
-
-
-public class ProcessingException extends AsyncException {
- public ProcessingException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
Index: rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/constructs/EhcacheDecoratorAdapter.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/constructs/EhcacheDecoratorAdapter.java (revision 11412)
+++ rctags/ehcache-2.10.9.0.411/ehcache-core/src/main/java/net/sf/ehcache/constructs/EhcacheDecoratorAdapter.java (revision 0)
@@ -1,857 +0,0 @@
-/**
- * Copyright Terracotta, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.sf.ehcache.constructs;
-
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.bootstrap.BootstrapCacheLoader;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.event.RegisteredEventListeners;
-import net.sf.ehcache.exceptionhandler.CacheExceptionHandler;
-import net.sf.ehcache.extension.CacheExtension;
-import net.sf.ehcache.loader.CacheLoader;
-import net.sf.ehcache.search.Attribute;
-import net.sf.ehcache.search.Query;
-import net.sf.ehcache.search.attribute.DynamicAttributesExtractor;
-import net.sf.ehcache.statistics.StatisticsGateway;
-import net.sf.ehcache.terracotta.InternalEhcache;
-import net.sf.ehcache.terracotta.TerracottaNotRunningException;
-import net.sf.ehcache.transaction.manager.TransactionManagerLookup;
-import net.sf.ehcache.writer.CacheWriter;
-import net.sf.ehcache.writer.CacheWriterManager;
-import org.terracotta.statistics.StatisticsManager;
-
-/**
- * Adapter class for Ehcache interface decorators. Implements all method in {@link Ehcache} by delegating all calls to the decorated
- * {@link Ehcache}. This class is provided as a convenience for easily creating {@link Ehcache} decorators by extending this class and
- * overriding only the methods of interest.
- *
- * @author Abhishek Sanoujam
- *
- */
-public class EhcacheDecoratorAdapter implements InternalEhcache {
-
- /**
- * The decorated {@link Ehcache}, has protected visibility so that sub-classes can have access to it.
- */
- protected final Ehcache underlyingCache;
-
- /**
- * Constructor accepting the cache to be decorated
- *
- * @param underlyingCache
- */
- public EhcacheDecoratorAdapter(Ehcache underlyingCache) {
- if (underlyingCache == null) {
- throw new NullPointerException("Underlying cache cannot be null");
- }
- StatisticsManager.associate(this).withParent(underlyingCache);
- this.underlyingCache = underlyingCache;
- }
-
- /**
- * {@inheritDoc}
- */
- public Element get(Object key) throws IllegalStateException, CacheException {
- return underlyingCache.get(key);
- }
-
- /**
- * {@inheritDoc}
- */
- public Map