source) {
- this.source = source;
- }
-
- private void complete(V value) {
- synchronized (this) {
- this.value = value;
- this.complete = true;
- notifyAll();
- }
- }
-
- private V get() {
- synchronized (this) {
- if (!complete) {
- try {
- complete(source.call());
- } catch (Throwable e) {
- fail(e);
- }
- }
- }
-
- return throwOrReturn();
- }
-
- private V throwOrReturn() {
- if (throwable != null) {
- if (throwable instanceof RuntimeException) {
- throw (RuntimeException) throwable;
- }
- throw new CacheException("Faulting from repository failed", throwable);
- }
- return value;
- }
-
- private void fail(final Throwable t) {
- synchronized (this) {
- this.throwable = t;
- this.complete = true;
- notifyAll();
- }
- throwOrReturn();
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/terracotta/.settings/org.eclipse.jdt.ui.prefs
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/.settings/org.eclipse.jdt.ui.prefs (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/.settings/org.eclipse.jdt.ui.prefs (revision 0)
@@ -1,66 +0,0 @@
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Terracotta profile
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=org;com;java;javax;
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * \r\n */ /**\r\n * \r\n */ /*\r\n * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.\r\n */\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration} throw ${exception_var}; throw new ImplementMe();\r\n${body_statement} ${body_statement} return ${field}; ${field} \= ${param}; /**\r\n * ${tags}\r\n * ${see_to_target}\r\n */ \r\n \r\n \r\n \r\n /**\r\n * @return the ${bare_field_name}\r\n */ /**\r\n * @param ${param} the ${bare_field_name} to set\r\n */ /**\r\n * ${tags}\r\n */ /**\r\n * \r\n */ /**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */ /**\r\n * \r\n */ /**\r\n * ${tags}\r\n */ /* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */ /**\r\n * ${tags}\r\n * ${see_to_target}\r\n */ ${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration} \r\n // ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace(); // ${todo} Auto-generated function stub\r\n${body_statement} ${body_statement}\r\n// ${todo} Auto-generated constructor stub return ${field}; ${field} \= ${param};
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=true
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=false
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=true
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java (revision 0)
@@ -1,334 +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.management.sampled;
-
-import java.util.Map;
-
-import net.sf.ehcache.util.ManagementAttribute;
-
-/**
- * An abstraction for sampled cache manager usage statistics.
- *
- * @author Abhishek Sanoujam
- * @author byoukste
- */
-public interface CacheManagerSampler {
- /**
- * Gets the actual name of the cache manager.
- */
- @ManagementAttribute
- String getName();
-
- /**
- * Gets the cluster uuid if applicable.
- *
- * @return the cluster uuid
- */
- @ManagementAttribute
- String getClusterUUID();
-
- /**
- * Gets the status attribute of the Ehcache
- *
- * @return The status value, as a String from the Status enum class
- */
- @ManagementAttribute
- String getStatus();
-
- /**
- * Enables/disables each cache contained by this CacheManager
- *
- * @param enabled
- */
- void setEnabled(boolean enabled);
-
- /**
- * Returns if each cache is enabled.
- *
- * @return boolean indicating that each cache is enabled
- */
- @ManagementAttribute
- boolean isEnabled();
-
- /**
- * Shuts down the CacheManager.
- *
- * If the shutdown occurs on the singleton, then the singleton is removed, so that if a singleton access method is called, a new
- * singleton will be created.
- */
- void shutdown();
-
- /**
- * Clears the contents of all caches in the CacheManager, but without
- * removing any caches.
- *
- * This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the
- * {@link net.sf.ehcache.Ehcache#removeAll()} mehod on each cache is called.
- */
- void clearAll();
-
- /**
- * Gets the cache names managed by the CacheManager
- */
- @ManagementAttribute
- String[] getCacheNames() throws IllegalStateException;
-
- /**
- * Get a map of cache name to performance metrics (hits, misses).
- *
- * @return a map of cache metrics
- */
- Map getCacheMetrics();
-
- /**
- * @return aggregate hit rate
- */
- long getCacheHitRate();
-
- /**
- * @return aggregate in-memory hit rate
- */
- long getCacheInMemoryHitRate();
-
- /**
- * @return aggregate off-heap hit rate
- */
- long getCacheOffHeapHitRate();
-
- /**
- * @return aggregate on-disk hit rate
- */
- long getCacheOnDiskHitRate();
-
- /**
- * @return aggregate miss rate
- */
- long getCacheMissRate();
-
- /**
- * @return aggregate in-memory miss rate
- */
- long getCacheInMemoryMissRate();
-
- /**
- * @return aggregate off-heap miss rate
- */
- long getCacheOffHeapMissRate();
-
- /**
- * @return aggregate on-disk miss rate
- */
- long getCacheOnDiskMissRate();
-
- /**
- * @return aggregate put rate
- */
- long getCachePutRate();
-
- /**
- * @return aggregate update rate
- */
- long getCacheUpdateRate();
-
- /**
- * @return aggregate remove rate
- */
- long getCacheRemoveRate();
-
- /**
- * @return aggregate eviction rate
- */
- long getCacheEvictionRate();
-
- /**
- * @return aggregate expiration rate
- */
- long getCacheExpirationRate();
-
- /**
- * @return aggregate average get time (ms.)
- */
- float getCacheAverageGetTime();
-
- /**
- * @return if any contained caches are configured for search
- */
- @ManagementAttribute
- boolean getSearchable();
-
- /**
- * @return aggregate search rate
- */
- long getCacheSearchRate();
-
- /**
- * @return aggregate search time
- */
- long getCacheAverageSearchTime();
-
- /**
- * generateActiveConfigDeclaration
- *
- * @return CacheManager configuration as String
- */
- String generateActiveConfigDeclaration();
-
- /**
- * generateActiveConfigDeclaration
- *
- * @param cacheName
- * @return Cache configuration as String
- */
- String generateActiveConfigDeclaration(String cacheName);
-
- /**
- * Are any of the caches transactional
- *
- * @see net.sf.ehcache.config.CacheConfiguration.TransactionalMode
- */
- @ManagementAttribute
- boolean getTransactional();
-
- /**
- * Get the committed transactions count
- *
- * @return the committed transactions count
- */
- long getTransactionCommittedCount();
-
- /**
- * @return aggregate Xa commit rate
- */
- long getTransactionCommitRate();
-
- /**
- * Get the rolled back transactions count
- *
- * @return the rolled back transactions count
- */
- long getTransactionRolledBackCount();
-
- /**
- * @return aggregate Xa rollback rate
- */
- long getTransactionRollbackRate();
-
- /**
- * Get the timed out transactions count. Note that only transactions which failed to
- * commit due to a timeout are taken into account
- *
- * @return the timed out transactions count
- */
- long getTransactionTimedOutCount();
-
- /**
- * Returns whether any caches are configured for write-behind
- */
- @ManagementAttribute
- boolean getHasWriteBehindWriter();
-
- /**
- * Returns the total length of all write-behind queues across all caches
- *
- * @return aggregate writer-behind queue length
- */
- long getWriterQueueLength();
-
- /**
- * Maximum elements that can be queued for processing by the write-behind writer
- *
- * @return aggregate of the maximum elements that can be waiting to be processed
- * by the write-behind writer across all caches
- */
- @ManagementAttribute
- int getWriterMaxQueueSize();
-
- /**
- * Maximum number of bytes of entries in the disk stores of all caches that
- * did not declare their own max size.
- *
- * @return maximum number of bytes in the disk stores of all caches that
- * did not declare their own max size.
- */
- @ManagementAttribute
- long getMaxBytesLocalDisk();
-
- /**
- * @param maxBytes
- */
- void setMaxBytesLocalDisk(long maxBytes);
-
- /**
- * @param maxBytes
- */
- void setMaxBytesLocalDiskAsString(String maxBytes);
-
- /**
- * @return Original input for maxBytesLocalDisk
- */
- @ManagementAttribute
- String getMaxBytesLocalDiskAsString();
-
- /**
- * Maximum number of bytes of entries in the heap memory stores of all caches that
- * did not declare their own max size.
- *
- * @return maximum number of bytes in the heap memory stores of all caches that
- * did not declare their own max size.
- */
- @ManagementAttribute
- long getMaxBytesLocalHeap();
-
- /**
- * @return Original input for maxBytesLocalHeap
- */
- @ManagementAttribute
- String getMaxBytesLocalHeapAsString();
-
- /**
- * @param maxBytes
- */
- void setMaxBytesLocalHeap(long maxBytes);
-
- /**
- * @param maxBytes
- */
- void setMaxBytesLocalHeapAsString(String maxBytes);
-
- /**
- * Maximum number of bytes of entries in the off-heap stores of all caches that
- * did not declare their own max size.
- *
- * @return maximum number of bytes in the off-heap stores of all caches that
- * did not declare their own max size.
- */
- @ManagementAttribute
- long getMaxBytesLocalOffHeap();
-
- /**
- * @return Original input for maxBytesLocalOffHeap
- */
- @ManagementAttribute
- String getMaxBytesLocalOffHeapAsString();
-
- /**
- * Execute a BMSQL query against the CacheManager and return result grid.
- *
- * @param queryString
- * @return query result grid
- */
- Object[][] executeQuery(String queryString);
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 0)
@@ -1,125 +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.ccs;
-
-import java.util.Comparator;
-
-import org.hibernate.cache.CacheException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.hibernate.cache.access.SoftLock;
-
-/**
- * Ehcache specific read-only cache concurrency strategy.
- *
- * This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache.
- *
- * @author Chris Dennis
- */
-@Deprecated
-public class EhcacheReadOnlyCache extends AbstractEhcacheConcurrencyStrategy {
-
- private static final Logger LOG = LoggerFactory.getLogger(EhcacheReadOnlyCache.class);
-
- /**
- * {@inheritDoc}
- */
- public Object get(Object key, long timestamp) throws CacheException {
- return cache.get(key);
- }
-
- /**
- * Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
- *
- * @throws UnsupportedOperationException always
- */
- public SoftLock lock(Object key, Object version) throws UnsupportedOperationException {
- LOG.error("Application attempted to edit read only item: " + key);
- throw new UnsupportedOperationException("Can't write to a readonly object");
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean put(Object key, Object value, long timestamp, Object version,
- Comparator versionComparator, boolean minimalPut) throws CacheException {
- if (minimalPut && cache.get(key) != null) {
- return false;
- } else {
- cache.put(key, value);
- return true;
- }
- }
-
- /**
- * Logs an error since items in a read-only cache should not be mutated.
- */
- public void release(Object key, SoftLock lock) {
- LOG.error("Application attempted to edit read only item: " + key);
- //throw new UnsupportedOperationException("Can't write to a readonly object");
- }
-
- /**
- * Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
- *
- * @throws UnsupportedOperationException always
- */
- public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException {
- LOG.error("Application attempted to edit read only item: " + key);
- throw new UnsupportedOperationException("Can't write to a readonly object");
- }
-
- /**
- * Inserts the specified item into the cache.
- */
- public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
- cache.update(key, value);
- return true;
- }
-
- /**
- * A No-Op, since we are an asynchronous cache concurrency strategy.
- */
- public void evict(Object key) throws CacheException {
- }
-
- /**
- * A No-Op, since we are an asynchronous cache concurrency strategy.
- */
- public boolean insert(Object key, Object value, Object currentVersion) {
- return false;
- }
-
- /**
- * Throws UnsupportedOperationException since items in a read-only cache should not be mutated.
- *
- * @throws UnsupportedOperationException always
- */
- public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException {
- LOG.error("Application attempted to edit read only item: " + key);
- throw new UnsupportedOperationException("Can't write to a readonly object");
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return cache + "(read-only)";
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/store/CachePinningFaultInvalidatedEntriesTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/store/CachePinningFaultInvalidatedEntriesTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/store/CachePinningFaultInvalidatedEntriesTest.java (revision 0)
@@ -1,107 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.store;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.test.util.WaitUtil;
-import org.terracotta.toolkit.Toolkit;
-
-import com.tc.properties.TCPropertiesConsts;
-import com.tc.test.config.model.TestConfig;
-
-import java.util.concurrent.Callable;
-
-import junit.framework.Assert;
-
-public class CachePinningFaultInvalidatedEntriesTest extends AbstractCacheTestBase {
-
- private static final int ELEMENT_COUNT = 1000;
-
- public CachePinningFaultInvalidatedEntriesTest(TestConfig testConfig) {
- super("cache-pinning-test.xml", testConfig, App.class, App.class);
- testConfig.getClientConfig()
- .addExtraClientJvmArg("-Dcom.tc." + TCPropertiesConsts.L1_SERVERMAPMANAGER_FAULT_INVALIDATED_PINNED_ENTRIES
- + "=true");
- }
-
- public static class App extends ClientBase {
- public App(String[] args) {
- super("pinned", args);
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
-
- System.out.println("Testing with Eventual tier pinned cache");
- basicTestInvalidatedEntriesFaulted(cacheManager.getCache("pinnedEventual"), true);
- System.out.println("Testing with Strong tier pinned cache");
- basicTestInvalidatedEntriesFaulted(cacheManager.getCache("pinned"), true);
-
- }
-
- private void basicTestInvalidatedEntriesFaulted(final Cache cache, boolean tierPinned) throws Exception {
- int index = getBarrierForAllClients().await();
- if (index == 0) {
- for (int i = 0; i < ELEMENT_COUNT; i++) {
- cache.put(new Element(getKey(i), getValue(i)));
- }
- Assert.assertEquals(ELEMENT_COUNT, cache.getSize());
- for (int i = 0; i < ELEMENT_COUNT; i++) {
- assertNotNull(cache.get(getKey(i)));
- assertEquals(cache.get(getKey(i)).getValue(), getValue(i));
- }
- // All the gets on both the clients should be local as the pinned entries would have been faulted.
- Assert.assertEquals(ELEMENT_COUNT, cache.getMemoryStoreSize());
- Assert.assertEquals(ELEMENT_COUNT * 2, cache.getStatistics().localHeapHitCount());
- Assert.assertEquals(0, cache.getStatistics().cacheEvictedCount());
- }
- getBarrierForAllClients().await();
- if (index == 1) {
- // Update elements, invalidate entries on other client
- for (int i = 0; i < ELEMENT_COUNT; i++) {
- cache.put(new Element(getKey(i), getValue(i + 1)));
- }
- Assert.assertEquals(ELEMENT_COUNT, cache.getSize());
- }
-
- getBarrierForAllClients().await();
- WaitUtil.waitUntilCallableReturnsTrue(new Callable() {
-
- @Override
- public Boolean call() throws Exception {
- // wait until the client repopulates the local cache after receiving invalidations.
- long localsize = cache.getMemoryStoreSize();
- System.out.println("Local cache Size = " + localsize);
- return localsize == ELEMENT_COUNT;
- }
- });
-
- getBarrierForAllClients().await();
- for (int i = 0; i < ELEMENT_COUNT; i++) {
- assertNotNull(cache.get(getKey(i)));
- assertEquals(cache.get(getKey(i)).getValue(), getValue(i + 1));
- }
- // All the gets on both the clients should be local as the pinned entries would have been faulted.
- if (index == 0) {
- Assert.assertEquals(ELEMENT_COUNT, cache.getMemoryStoreSize());
- // Assert.assertEquals(ELEMENT_COUNT * 4, cache.getStatistics().localHeapHitCount());
- Assert.assertEquals(0, cache.getStatistics().cacheEvictedCount());
- }
- getBarrierForAllClients().await();
- }
-
- private Object getKey(int i) {
- return String.valueOf(i);
- }
-
- private Object getValue(int i) {
- return i;
- }
-
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 0)
@@ -1,36 +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 net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-
-import org.terracotta.toolkit.Toolkit;
-
-import com.tc.test.config.model.TestConfig;
-
-import junit.framework.Assert;
-
-public class HttpUrlConfigCacheTest extends AbstractCacheTestBase {
-
- public HttpUrlConfigCacheTest(TestConfig testConfig) {
- super("http-url-config-cache-test.xml", testConfig, Client.class);
- }
-
- public static class Client extends ClientBase {
-
- public Client(String[] args) {
- super("test", args);
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable {
- cache.put(new Element("key", "value"));
- Assert.assertEquals("value", cache.get("key").getObjectValue());
- }
-
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0)
@@ -1,233 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.bulkops;
-
-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.TerracottaConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration.Consistency;
-
-import org.junit.Assert;
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.toolkit.Toolkit;
-import org.terracotta.toolkit.concurrent.ToolkitBarrier;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.TimeUnit;
-
-public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase {
- private static final int NODE_COUNT = 2;
-
- public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) {
- super(testConfig, App.class, App.class);
- }
-
- public static class App extends ClientBase {
- private final ToolkitBarrier barrier;
-
- public App(String[] args) {
- super(args);
- this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT);
- }
-
- public static void main(String[] args) {
- new App(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
- Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG);
- testBulkOpsSanity(dcv2StrongSerialization);
- barrier.await();
-
- Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL);
- testBulkOpsSanity(dcv2EventualSerialization);
- barrier.await();
-
- barrier.await();
-
- }
-
- private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException {
- int index = barrier.await();
- int numOfElements = 100;
- Set elements = new HashSet();
- for (int i = 0; i < numOfElements; i++) {
- elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i)));
- }
- if (index == 0) {
- cache.putAll(elements);
- }
-
- barrier.await();
- while (cache.getSize() != numOfElements) {
- Thread.sleep(1000);
- }
- Assert.assertEquals(numOfElements, cache.getSize());
-
- Set keySet1 = new HashSet();
- for (int i = 0; i < numOfElements; i++) {
- keySet1.add(new Key("key" + i, i));
- }
-
- Map rv = cache.getAll(keySet1);
- Assert.assertEquals(numOfElements, rv.size());
-
- Collection values = new HashSet();
- for (Entry entry : rv.entrySet()) {
- Assert.assertTrue(elements.contains(entry.getValue()));
- values.add(entry.getValue());
- }
-
- for (Element element : elements) {
- Assert.assertTrue(values.contains(element));
- }
-
- Set keySet2 = new HashSet();
- for (int i = 0; i < numOfElements; i++) {
- if (i % 2 == 0) {
- keySet2.add(new Key("key" + i, i));
- }
- }
-
- rv = cache.getAll(keySet2);
- Assert.assertEquals(keySet2.size(), rv.size());
-
- for (Entry entry : rv.entrySet()) {
- Assert.assertTrue(elements.contains(entry.getValue()));
- }
-
- Assert.assertEquals(keySet2, rv.keySet());
- System.out.println("verified by client now waiting for others...");
- barrier.await();
-
- if (index != 0) {
- cache.removeAll(keySet2);
- System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName()
- + ". Now waiting for others...");
- // sleep for 60 seconds for eventual caches
- if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) {
- Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS));
- }
- }
- index = barrier.await();
- while (cache.getSize() != numOfElements - keySet2.size()) {
- Thread.sleep(1000);
- }
-
- Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize());
- System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client");
- for (Object key : keySet2) {
- Assert.assertNull(cache.get(key));
- }
- System.out.println("client " + index + " done with " + cache.getName());
- }
-
- private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) {
- CacheConfiguration cacheConfiguration = new CacheConfiguration();
- cacheConfiguration.setName(cacheName);
- cacheConfiguration.setMaxElementsInMemory(100000);
- cacheConfiguration.setEternal(false);
- cacheConfiguration.setTimeToLiveSeconds(100000);
- cacheConfiguration.setTimeToIdleSeconds(200000);
-
- TerracottaConfiguration tcConfiguration = new TerracottaConfiguration();
- tcConfiguration.setConsistency(consistency);
- cacheConfiguration.addTerracotta(tcConfiguration);
-
- Cache cache = new Cache(cacheConfiguration);
- cm.addCache(cache);
- System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency);
- return cache;
- }
- }
-
- private static class Key implements Serializable {
- private final String stringKey;
- private final int intKey;
-
- public Key(String stringKey, int intKey) {
- super();
- this.stringKey = stringKey;
- this.intKey = intKey;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + intKey;
- result = prime * result + ((stringKey == null) ? 0 : stringKey.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;
- Key other = (Key) obj;
- if (intKey != other.intKey) return false;
- if (stringKey == null) {
- if (other.stringKey != null) return false;
- } else if (!stringKey.equals(other.stringKey)) return false;
- return true;
- }
-
- @Override
- public String toString() {
- return stringKey;
- }
-
- }
-
- private static class Value implements Serializable {
- private final String keyVal;
- private final int intVal;
-
- public Value(String keyVal, int intVal) {
- this.keyVal = keyVal;
- this.intVal = intVal;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + intVal;
- result = prime * result + ((keyVal == null) ? 0 : keyVal.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;
- Value other = (Value) obj;
- if (intVal != other.intVal) return false;
- if (keyVal == null) {
- if (other.keyVal != null) return false;
- } else if (!keyVal.equals(other.keyVal)) return false;
- return true;
- }
-
- @Override
- public String toString() {
- return keyVal;
- }
-
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 0)
@@ -1,43 +0,0 @@
-package org.terracotta.ehcache.tests;
-
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.constructs.EhcacheDecoratorAdapter;
-
-import java.io.Serializable;
-
-/**
- * This decorator class intercepts cache gets and acts as a cache read through during or before a cache load and acts as a system of record
- * after the cache has been loaded. Cache read through: get the object from the cache, if not in cache, get object from database, load in to
- * cache and return object. System of Record (SOR): only get the object from the cache.
- *
- * @author sdalto2
- *
- */
-public class NonHibernateCacheDecorator extends EhcacheDecoratorAdapter {
-
- private Ehcache cache;
- public NonHibernateCacheDecorator(Ehcache cache) {
- super(cache);
- this.cache=cache;
- }
-
- /**
- * This get method will always call Element get(Serializable key) So a serializable key is mandatory.
- */
- @Override
- public Element get(Object key) throws IllegalStateException, CacheException {
- return get((Serializable) key);
- }
-
- @Override
- public Element get(Serializable key) throws IllegalStateException, CacheException {
- return new Element(1,"dummy");
- }
- @Override
- public void removeAll(boolean doNotNotifyListeners) throws IllegalStateException, CacheException {
- cache.removeAll(doNotNotifyListeners);
- }
-
-}
\ No newline at end of file
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/KeySnapshotter.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/KeySnapshotter.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/KeySnapshotter.java (revision 0)
@@ -1,228 +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.terracotta;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.CacheStoreHelper;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.store.Store;
-import net.sf.ehcache.store.TerracottaStore;
-import net.sf.ehcache.util.WeakIdentityConcurrentMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * A class that will snapshot the local keySet of a Terracotta clustered cache to disk
- *
- * @author Alex Snaps
- */
-class KeySnapshotter implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(KeySnapshotter.class.getName());
- private static final int POOL_SIZE = Integer.getInteger("net.sf.ehcache.terracotta.KeySnapshotter.threadPoolSize", 10);
-
- private static final WeakIdentityConcurrentMap INSTANCES =
- new WeakIdentityConcurrentMap(
- new WeakIdentityConcurrentMap.CleanUpTask() {
- public void cleanUp(final ScheduledExecutorService executor) {
- executor.shutdownNow();
- }
- });
-
- private final String cacheName;
- private volatile TerracottaStore tcStore;
- private final RotatingSnapshotFile rotatingWriter;
- private final Thread thread;
-
- private volatile Runnable onSnapshot;
- private final ScheduledFuture> scheduledFuture;
-
- /**
- * Default Constructor
- *
- * @param cache the Terracotta clustered Cache to snapshot
- * @param interval the interval to do the snapshots on
- * @param doKeySnapshotOnDedicatedThread whether the snapshots have to be done on a dedicated thread
- * @param rotatingWriter the RotatingSnapshotFile to write to
- * @throws IllegalArgumentException if interval is less than or equal to zero
- */
- KeySnapshotter(final Ehcache cache, final long interval,
- final boolean doKeySnapshotOnDedicatedThread,
- final RotatingSnapshotFile rotatingWriter)
- throws IllegalArgumentException {
- final Store store = new CacheStoreHelper((Cache)cache).getStore();
- if (!(store instanceof TerracottaStore)) {
- throw new IllegalArgumentException("Cache '" + cache.getName() + "' isn't backed by a " + TerracottaStore.class.getSimpleName()
- + " but uses a " + store.getClass().getName() + " instead");
- }
-
- if (interval <= 0) {
- throw new IllegalArgumentException("Interval needs to be a positive & non-zero value");
- }
-
- if (rotatingWriter == null) {
- throw new NullPointerException();
- }
-
- this.cacheName = cache.getName();
- this.rotatingWriter = rotatingWriter;
- this.tcStore = (TerracottaStore)store;
-
- if (doKeySnapshotOnDedicatedThread) {
- scheduledFuture = null;
- thread = new SnapShottingThread(this, interval, "KeySnapshotter for cache " + cacheName);
- thread.start();
- } else {
- scheduledFuture = getScheduledExecutorService(cache.getCacheManager())
- .scheduleWithFixedDelay(this, interval, interval, TimeUnit.SECONDS);
- thread = null;
- }
- }
-
- private ScheduledExecutorService getScheduledExecutorService(final CacheManager cacheManager) {
- ScheduledExecutorService scheduledExecutorService = INSTANCES.get(cacheManager);
- if (scheduledExecutorService == null) {
- scheduledExecutorService = new ScheduledThreadPoolExecutor(POOL_SIZE);
- final ScheduledExecutorService previous = INSTANCES.putIfAbsent(cacheManager, scheduledExecutorService);
- if (previous != null) {
- scheduledExecutorService.shutdownNow();
- scheduledExecutorService = previous;
- }
- }
- return scheduledExecutorService;
- }
-
- /**
- * Shuts down the writer thread and cleans up resources
- *
- * @param immediately whether to leave the writer finish or shut down immediately
- */
- void dispose(boolean immediately) {
- if (thread != null) {
- rotatingWriter.setShutdownOnThreadInterrupted(immediately);
- thread.interrupt();
- try {
- thread.join();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- }
- } else {
- scheduledFuture.cancel(immediately);
- }
- tcStore = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public void run() {
- try {
- INSTANCES.cleanUp();
- rotatingWriter.writeAll(tcStore.getLocalKeys());
- onSnapshot();
- } catch (Throwable e) {
- LOG.error("Couldn't snapshot local keySet for Cache {}", cacheName, e);
- }
- }
-
- private void onSnapshot() {
- if (onSnapshot != null) {
- try {
- onSnapshot.run();
- } catch (Exception e) {
- LOG.warn("Error occurred in onSnapshot callback", e);
- }
- }
- }
-
- /**
- * Accessor to all known cacheManagers (which are also bound to a ScheduledExecutorService)
- *
- * @return the collection of known CacheManagers
- */
- static Collection getKnownCacheManagers() {
- return INSTANCES.keySet();
- }
-
- /**
- * Calling this method will result in a snapshot being taken or wait for the one in progress to finish
- *
- * @throws IOException On exception being thrown while doing the snapshot
- */
- void doSnapshot() throws IOException {
- rotatingWriter.snapshotNowOrWaitForCurrentToFinish(tcStore.getLocalKeys());
- onSnapshot();
- }
-
- /**
- * Let register a Runnable that will be called on every snapshot happening
- * @param onSnapshot the runnable
- */
- void setOnSnapshot(final Runnable onSnapshot) {
- this.onSnapshot = onSnapshot;
- }
-
- /**
- * Returns the name of the underlying cache for which this snapshots
- * @return The name of the cache
- */
- public String getCacheName() {
- return cacheName;
- }
-
- /**
- * Thread doing background snapshots of the local key set
- */
- private static class SnapShottingThread extends Thread {
-
- private long lastRun;
- private final long interval;
-
- public SnapShottingThread(final Runnable runnable, final long interval, final String threadName) {
- super(runnable, threadName);
- this.interval = interval;
- lastRun = System.currentTimeMillis();
- this.setDaemon(true);
- }
-
- @Override
- public void run() {
- while (!isInterrupted()) {
- final long nextTime = lastRun + TimeUnit.SECONDS.toMillis(interval);
- final long now = System.currentTimeMillis();
- if (nextTime <= now) {
- super.run();
- lastRun = System.currentTimeMillis();
- } else {
- try {
- sleep(nextTime - now);
- } catch (InterruptedException e) {
- interrupt();
- }
- }
- }
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/OrderComparator.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/OrderComparator.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/OrderComparator.java (revision 0)
@@ -1,137 +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.impl;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-import net.sf.ehcache.store.StoreQuery.Ordering;
-
-/**
- * Compound sort ordering comparactor
- *
- * @author teck
- * @param
- */
-public class OrderComparator implements Comparator {
-
- private final List> comparators;
-
- /**
- * Constructor
- *
- * @param orderings
- */
- public OrderComparator(List orderings) {
- comparators = new ArrayList>();
- int pos = 0;
- for (Ordering ordering : orderings) {
- switch (ordering.getDirection()) {
- case ASCENDING: {
- comparators.add(new AscendingComparator(pos));
- break;
- }
- case DESCENDING: {
- comparators.add(new DescendingComparator(pos));
- break;
- }
- default: {
- throw new AssertionError(ordering.getDirection());
- }
- }
-
- pos++;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public int compare(T o1, T o2) {
- for (Comparator c : comparators) {
- int cmp = c.compare(o1, o2);
- if (cmp != 0) {
- return cmp;
- }
- }
- return 0;
- }
-
- /**
- * Simple ascending comparator
- */
- private class AscendingComparator implements Comparator, Serializable {
-
- private final int pos;
-
- AscendingComparator(int pos) {
- this.pos = pos;
- }
-
- public int compare(T o1, T o2) {
- Object attr1 = o1.getSortAttribute(pos);
- Object attr2 = o2.getSortAttribute(pos);
-
- if ((attr1 == null) && (attr2 == null)) {
- return 0;
- }
-
- if (attr1 == null) {
- return -1;
- }
-
- if (attr2 == null) {
- return 1;
- }
-
- return ((Comparable) attr1).compareTo(attr2);
- }
- }
-
- /**
- * Simple descending comparator
- */
- private class DescendingComparator implements Comparator, Serializable {
-
- private final int pos;
-
- DescendingComparator(int pos) {
- this.pos = pos;
- }
-
- public int compare(T o1, T o2) {
- Object attr1 = o1.getSortAttribute(pos);
- Object attr2 = o2.getSortAttribute(pos);
-
- if ((attr1 == null) && (attr2 == null)) {
- return 0;
- }
-
- if (attr1 == null) {
- return 1;
- }
-
- if (attr2 == null) {
- return -1;
- }
-
- return ((Comparable) attr2).compareTo(attr1);
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/Size.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/Size.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/Size.java (revision 0)
@@ -1,58 +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;
-
-/**
- * Holder for the size calculated by the SizeOf engine
- *
- * @author Ludovic Orban
- */
-public final class Size {
-
- private final long calculated;
- private final boolean exact;
-
- /**
- * Constructor
- *
- * @param calculated the calculated size
- * @param exact true if the calculated size is exact, false if it's an estimate or known to be inaccurate in some way
- */
- public Size(long calculated, boolean exact) {
- this.calculated = calculated;
- this.exact = exact;
- }
-
- /**
- * Get the calculated size
- *
- * @return the calculated size
- */
- public long getCalculated() {
- return calculated;
- }
-
- /**
- * Check if the calculated size is exact
- *
- * @return true if the calculated size is exact, false if it's an estimate or known to be inaccurate in some way
- */
- public boolean isExact() {
- return exact;
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinator.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinator.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinator.java (revision 0)
@@ -1,43 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async;
-
-import org.terracotta.modules.ehcache.async.scatterpolicies.ItemScatterPolicy;
-
-import java.io.Serializable;
-
-public interface AsyncCoordinator {
-
- /**
- * @throws IllegalArgumentException if processingConcurrency is less than 1 OR processor is null
- */
- public void start(final ItemProcessor processor, final int processingConcurrency,
- ItemScatterPolicy super E> policy);
-
- /**
- * @param item null item are ignored.
- */
- public void add(E item);
-
- /**
- * Stops and waits for the current processing to finish.
- * Calling this multiple times will result in {@link IllegalStateException}
- */
- public void stop();
-
- /**
- * Sets a filter to filter out the items.
- */
- public void setOperationsFilter(ItemsFilter filter);
-
- /**
- * @return the current items to be processed
- */
- public long getQueueSize();
-
- /**
- * Destroy all clustered state associated with the given async coordinator.
- */
- void destroy();
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 0)
@@ -1,218 +0,0 @@
-package net.sf.ehcache.util.concurrent;
-
-import net.sf.ehcache.Element;
-import org.junit.Test;
-
-import java.util.HashSet;
-import java.util.Random;
-import java.util.UUID;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Alex Snaps
- */
-public class ConcurrentHashMapTest {
-
- private static final int ENTRIES = 10000;
-
- @Test
- public void testRandomValuesWithObjects() {
-
- ConcurrentHashMap> map = new ConcurrentHashMap>();
-
- for(int i = 0; i < ENTRIES; i++) {
- final Object o = new Object();
- map.put(o, new KeyHolder(o));
- }
-
- assertThings(map);
- }
-
- @Test
- public void testRandomValuesWithComparable() {
- ConcurrentHashMap> map = new ConcurrentHashMap>();
-
- for(int i = 0; i < ENTRIES; i++) {
- final EvilComparableKey o = new EvilComparableKey(UUID.randomUUID().toString());
- map.put(o, new KeyHolder(o));
- }
-
- assertThings(map);
- }
-
- @Test
- public void testReplaceWithWeirdBehavior() {
- ConcurrentHashMap elementMap = new ConcurrentHashMap();
- final Element initialElement = new Element("key", "foo");
- elementMap.put("key", initialElement);
- assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(true));
- assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(false));
-
- ConcurrentHashMap stringMap = new ConcurrentHashMap();
- final String initialString = "foo";
- stringMap.put("key", initialString);
- assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true));
- assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true));
- }
-
- @Test
- public void testRandomValues() {
- ConcurrentHashMap> map = new ConcurrentHashMap>();
- final long seed = System.nanoTime();
- System.out.println("SEED: " + seed);
- final Random random = new Random(seed);
-
- for(int i = 0; i < ENTRIES; i++) {
- final Object o;
- switch(i % 4) {
- case 0:
- final int hashCode = random.nextInt();
- o = new Object() {
- @Override
- public int hashCode() {
- return hashCode;
- }
- };
- break;
- case 1:
- o = new EvilKey(Integer.toString(i));
- break;
- default:
- o = new EvilComparableKey(Integer.toString(i));
-
- }
- assertThat(map.put(o, new KeyHolder(o)) == null, is(true));
- }
-
- for (Object o : map.keySet()) {
- assertThat(o.toString(), map.containsKey(o), is(true));
- assertThat(o.toString(), map.get(o), notNullValue());
- }
-
- assertThings(map);
- }
-
- @Test
- public void testRandomValuesWithCollisions() {
- ConcurrentHashMap> map = new ConcurrentHashMap>();
-
- for(int i = 0; i < ENTRIES; i++) {
- final EvilKey o = new EvilKey(UUID.randomUUID().toString());
- map.put(o, new KeyHolder(o));
- }
-
- assertThings(map);
- }
-
- @Test
- public void testUsesObjectIdentityForElementsOnly() {
-
- final String key = "ourKey";
-
- ConcurrentHashMap map = new ConcurrentHashMap();
-
- String value = new String("key");
- String valueAgain = new String("key");
- map.put(key, value);
- assertThat(map.replace(key, valueAgain, valueAgain), is(true));
- assertThat(map.replace(key, value, valueAgain), is(true));
-
- Element elementValue = new Element(key, value);
- Element elementValueAgain = new Element(key, value);
- map.put(key, elementValue);
- assertThat(map.replace(key, elementValueAgain, elementValue), is(false));
- assertThat(map.replace(key, elementValue, elementValueAgain), is(true));
- assertThat(map.replace(key, elementValue, elementValueAgain), is(false));
- assertThat(map.replace(key, elementValueAgain, elementValue), is(true));
- }
-
- @Test
- public void testActuallyWorks() throws InterruptedException {
- final long top = 100000000;
- final String key = "counter";
- final ConcurrentHashMap map = new ConcurrentHashMap();
- map.put(key, 0L);
-
- final Runnable runnable = new Runnable() {
- @Override
- public void run() {
- for(Long val = map.get(key); val < top && map.replace(key, val, val + 1); val = map.get(key));
- }
- };
-
- Thread[] threads = new Thread[Runtime.getRuntime().availableProcessors() * 2];
- for (int i = 0, threadsLength = threads.length; i < threadsLength; ) {
- threads[i] = new Thread(runnable);
- threads[i].setName("Mutation thread #" + ++i);
- threads[i - 1].start();
- }
-
- for (Thread thread : threads) {
- thread.join();
- }
-
- assertThat(map.get(key), is(top));
-
- }
-
- private void assertThings(final ConcurrentHashMap, ?> map) {
- assertThat(map.size(), is(ENTRIES));
-
- for(int i = 0; i < 100; i ++) {
- final HashSet randomValues = new HashSet(map.getRandomValues(ENTRIES));
- assertThat(randomValues.size(), is(ENTRIES));
- for (Object randomValue : randomValues) {
- assertThat(randomValue, instanceOf(KeyHolder.class));
- final Object key = ((KeyHolder)randomValue).key;
- assertThat("Missing " + key, map.containsKey(key), is(true));
- }
- }
- }
-}
-
-class KeyHolder {
- final K key;
-
- KeyHolder(final K key) {
- this.key = key;
- }
-}
-
-class EvilKey {
- final String value;
-
- EvilKey(final String value) {
- this.value = value;
- }
-
- @Override
- public int hashCode() {
- return this.value.hashCode() & 1;
- }
-
- @Override
- public boolean equals(final Object obj) {
- return obj != null && obj.getClass() == this.getClass() && ((EvilKey)obj).value.equals(value);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName() + " { " + value + " }";
- }
-}
-
-class EvilComparableKey extends EvilKey implements Comparable {
-
- EvilComparableKey(final String value) {
- super(value);
- }
-
- @Override
- public int compareTo(final EvilComparableKey o) {
- return value.compareTo(o != null ? o.value : null);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 0)
@@ -1,242 +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;
-
-import net.sf.ehcache.config.MemoryUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.instrument.Instrumentation;
-import java.lang.management.ManagementFactory;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This will try to load the agent using the Attach API of JDK6.
- * If you are on an older JDK (v5) you can still use the agent by adding the -javaagent:[pathTojar] to your VM
- * startup script
- *
- * @author Alex Snaps
- */
-final class AgentLoader {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(AgentLoader.class);
-
- private static final String INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME = "net.sf.ehcache.sizeof.agent.instrumentation";
- private static final String SIZEOF_AGENT_CLASSNAME = "net.sf.ehcache.pool.sizeof.SizeOfAgent";
- private static final String VIRTUAL_MACHINE_CLASSNAME = "com.sun.tools.attach.VirtualMachine";
- private static final Method VIRTUAL_MACHINE_ATTACH;
- private static final Method VIRTUAL_MACHINE_DETACH;
- private static final Method VIRTUAL_MACHINE_LOAD_AGENT;
-
- private static volatile Instrumentation instrumentation;
-
- static {
- Method attach = null;
- Method detach = null;
- Method loadAgent = null;
- try {
- Class> virtualMachineClass = getVirtualMachineClass();
- attach = virtualMachineClass.getMethod("attach", String.class);
- detach = virtualMachineClass.getMethod("detach");
- loadAgent = virtualMachineClass.getMethod("loadAgent", String.class);
- } catch (Throwable e) {
- LOGGER.info("Unavailable or unrecognised attach API : {}", e.toString());
- }
- VIRTUAL_MACHINE_ATTACH = attach;
- VIRTUAL_MACHINE_DETACH = detach;
- VIRTUAL_MACHINE_LOAD_AGENT = loadAgent;
- }
-
- private static Class> getVirtualMachineClass() throws ClassNotFoundException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction>() {
- public Class> run() throws Exception {
- try {
- return ClassLoader.getSystemClassLoader().loadClass(VIRTUAL_MACHINE_CLASSNAME);
- } catch (ClassNotFoundException cnfe) {
- for (File jar : getPossibleToolsJars()) {
- try {
- Class> vmClass = new URLClassLoader(new URL[] {jar.toURL()}).loadClass(VIRTUAL_MACHINE_CLASSNAME);
- LOGGER.info("Located valid 'tools.jar' at '{}'", jar);
- return vmClass;
- } catch (Throwable t) {
- LOGGER.info("Exception while loading tools.jar from '{}': {}", jar, t);
- }
- }
- throw new ClassNotFoundException(VIRTUAL_MACHINE_CLASSNAME);
- }
- }
- });
- } catch (PrivilegedActionException pae) {
- Throwable actual = pae.getCause();
- if (actual instanceof ClassNotFoundException) {
- throw (ClassNotFoundException) actual;
- }
- throw new AssertionError("Unexpected checked exception : " + actual);
- }
- }
-
- private static List getPossibleToolsJars() {
- List jars = new ArrayList();
-
- File javaHome = new File(System.getProperty("java.home"));
- File jreSourced = new File(javaHome, "lib/tools.jar");
- if (jreSourced.exists()) {
- jars.add(jreSourced);
- }
- if ("jre".equals(javaHome.getName())) {
- File jdkHome = new File(javaHome, "../");
- File jdkSourced = new File(jdkHome, "lib/tools.jar");
- if (jdkSourced.exists()) {
- jars.add(jdkSourced);
- }
- }
- return jars;
- }
-
- /**
- * Attempts to load the agent through the Attach API
- * @return true if agent was loaded (which could have happened thought the -javaagent switch)
- */
- static boolean loadAgent() {
- synchronized (AgentLoader.class.getName().intern()) {
- if (!agentIsAvailable() && VIRTUAL_MACHINE_LOAD_AGENT != null) {
- try {
- warnIfOSX();
- String name = ManagementFactory.getRuntimeMXBean().getName();
- Object vm = VIRTUAL_MACHINE_ATTACH.invoke(null, name.substring(0, name.indexOf('@')));
- try {
- File agent = getAgentFile();
- LOGGER.info("Trying to load agent @ {}", agent);
- if (agent != null) {
- VIRTUAL_MACHINE_LOAD_AGENT.invoke(vm, agent.getAbsolutePath());
- }
- } finally {
- VIRTUAL_MACHINE_DETACH.invoke(vm);
- }
- } catch (InvocationTargetException ite) {
- Throwable cause = ite.getCause();
- LOGGER.info("Failed to attach to VM and load the agent: {}: {}", cause.getClass(), cause.getMessage());
- } catch (Throwable t) {
- LOGGER.info("Failed to attach to VM and load the agent: {}: {}", t.getClass(), t.getMessage());
- }
- }
-
- return agentIsAvailable();
- }
- }
-
- private static void warnIfOSX() {
- if (JvmInformation.isOSX() && System.getProperty("java.io.tmpdir") != null) {
- LOGGER.warn("Loading the SizeOfAgent will probably fail, as you are running on Apple OS X and have a value set for java.io.tmpdir\n" +
- "They both result in a bug, not yet fixed by Apple, that won't let us attach to the VM and load the agent.\n" +
- "Most probably, you'll also get a full thread-dump after this because of the failure... Nothing to worry about!\n" +
- "You can bypass trying to load the Agent entirely by setting the System property '"
- + net.sf.ehcache.pool.sizeof.AgentSizeOf.BYPASS_LOADING + "' to true");
- }
- }
-
- private static File getAgentFile() throws IOException, URISyntaxException {
- URL agent = AgentLoader.class.getResource("sizeof-agent.jar");
- if (agent == null) {
- return null;
- } else if (agent.getProtocol().equals("file")) {
- return new File(agent.toURI());
- } else {
- File temp = File.createTempFile("ehcache-sizeof-agent", ".jar");
- try {
- FileOutputStream fout = new FileOutputStream(temp);
- try {
- InputStream in = agent.openStream();
- try {
- byte[] buffer = new byte[(int)MemoryUnit.KILOBYTES.toBytes(1)];
- while (true) {
- int read = in.read(buffer);
- if (read < 0) {
- break;
- } else {
- fout.write(buffer, 0, read);
- }
- }
- } finally {
- in.close();
- }
- } finally {
- fout.close();
- }
- } finally {
- temp.deleteOnExit();
- }
- LOGGER.info("Extracted agent jar to temporary file {}", temp);
- return temp;
- }
- }
-
- /**
- * Checks whether the agent is available
- * @return true if available
- */
- static boolean agentIsAvailable() {
- try {
- if (instrumentation == null) {
- instrumentation = (Instrumentation)System.getProperties().get(INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME);
- }
- if (instrumentation == null) {
- Class sizeOfAgentClass = ClassLoader.getSystemClassLoader().loadClass(SIZEOF_AGENT_CLASSNAME);
- Method getInstrumentationMethod = sizeOfAgentClass.getMethod("getInstrumentation");
- instrumentation = (Instrumentation)getInstrumentationMethod.invoke(sizeOfAgentClass);
- }
- return instrumentation != null;
- } catch (SecurityException e) {
- LOGGER.warn("Couldn't access the system classloader because of the security policies applied by " +
- "the security manager. You either want to loosen these, so ClassLoader.getSystemClassLoader() and " +
- "reflection API calls are permitted or the sizing will be done using some other mechanism.\n" +
- "Alternatively, set the system property net.sf.ehcache.sizeof.agent.instrumentationSystemProperty to true " +
- "to have the agent put the required instances in the System Properties for the loader to access.");
- return false;
- } catch (Throwable e) {
- return false;
- }
- }
-
- /**
- * Returns the size of this Java object as calculated by the loaded agent.
- *
- * @param obj object to be sized
- * @return size of the object in bytes
- */
- static long agentSizeOf(Object obj) {
- if (instrumentation == null) {
- throw new UnsupportedOperationException("Sizeof agent is not available");
- }
- return instrumentation.getObjectSize(obj);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 0)
@@ -1,7 +0,0 @@
-
-
-
-
-This package contains the SizeOf filtering interface and implementations for the pooling in Ehcache.
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0)
@@ -1,60 +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.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Assert;
-import net.sf.ehcache.CacheManager;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.terracotta.test.categories.CheckShorts;
-
-@Category(CheckShorts.class)
-public class DecoratedCacheConfigTest {
-
- private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache",
- "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"});
-
- @Test
- public void testDecoratedCacheConfig() {
- CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource(
- "ehcache-decorator-noname-test.xml"));
- try {
- List names = new ArrayList(Arrays.asList(cm.getCacheNames()));
- names.removeAll(ALL_CACHE_NAMES);
- Assert.assertEquals("This list should be empty - " + names, 0, names.size());
- // System.out.println("Original config: " + cm.getOriginalConfigurationText());
- String text = cm.getActiveConfigurationText();
- // System.out.println("Cache manager config: " + text);
- for (String name : ALL_CACHE_NAMES) {
- Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\""));
- String cacheConfigTest = cm.getActiveConfigurationText(name);
- // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest);
- Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ",
- cacheConfigTest.contains("name=\"" + name + "\""));
- }
-
- } finally {
- cm.shutdown();
- }
-
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 0)
@@ -1,108 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-
-package org.terracotta.modules.ehcache.hibernate.domain;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class Person {
-
- private Long id;
- private int age;
- private String firstname;
- private String lastname;
- private List events = new ArrayList(); // list semantics, e.g., indexed
- private Set emailAddresses = new HashSet();
- private Set phoneNumbers = new HashSet();
- private List talismans = new ArrayList(); // a Bag of good-luck charms.
-
- public Person() {
- //
- }
-
- public List getEvents() {
- return events;
- }
-
- protected void setEvents(List events) {
- this.events = events;
- }
-
- public void addToEvent(Event event) {
- this.getEvents().add(event);
- event.getParticipants().add(this);
- }
-
- public void removeFromEvent(Event event) {
- this.getEvents().remove(event);
- event.getParticipants().remove(this);
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public Set getEmailAddresses() {
- return emailAddresses;
- }
-
- public void setEmailAddresses(Set emailAddresses) {
- this.emailAddresses = emailAddresses;
- }
-
- public Set getPhoneNumbers() {
- return phoneNumbers;
- }
-
- public void setPhoneNumbers(Set phoneNumbers) {
- this.phoneNumbers = phoneNumbers;
- }
-
- public void addTalisman(String name) {
- talismans.add(name);
- }
-
- public List getTalismans() {
- return talismans;
- }
-
- public void setTalismans(List talismans) {
- this.talismans = talismans;
- }
-
- public String toString() {
- return getFirstname() + " " + getLastname();
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/ExpiredTransactionIDImpl.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/ExpiredTransactionIDImpl.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/ExpiredTransactionIDImpl.java (revision 0)
@@ -1,32 +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;
-
-
-/**
- * @author Ludovic Orban
- */
-public class ExpiredTransactionIDImpl extends TransactionIDImpl {
-
- /**
- * Create an expired transaction ID
- * @param transactionId the non-expired transaction ID to copy
- */
- public ExpiredTransactionIDImpl(TransactionIDImpl transactionId) {
- super(transactionId);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-jetty.bat
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-jetty.bat (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-jetty.bat (revision 0)
@@ -1,38 +0,0 @@
-@echo off
-
-if not defined JAVA_HOME (
- echo JAVA_HOME is not defined
- exit /b 1
-)
-
-setlocal
-
-set jetty_instance=%1
-
-if "%jetty_instance%" == "" (
- echo Need to specify which instance of Jetty: 9081 or 9082
- exit /b 1
-)
-
-pushd "%~d0%~p0"
-for /f "tokens=*" %%a in ('call relative-paths.bat tc_install_dir') do set tc_install_dir=%%a
-pushd
-cd %tc_install_dir%
-set tc_install_dir=%CD%
-set tc_install_dir="%tc_install_dir:"=%"
-popd
-popd
-
-set JAVA_HOME="%JAVA_HOME:"=%"
-set root=%~d0%~p0..
-set root="%root:"=%"
-set jetty_work_dir=%root%\jetty6.1\%jetty_instance%
-set jetty_home=%tc_install_dir%\third-party\jetty-6.1.15
-set start_jar=%jetty_home%\start.jar
-set /a stop_port=jetty_instance + 2
-
-cd %jetty_work_dir%
-echo Stopping Jetty %jetty_instance%...
-%JAVA_HOME%\bin\java -Djetty.home=%jetty_home% -DSTOP.PORT=%stop_port% -DSTOP.KEY=secret -jar %start_jar% --stop
-
-endlocal
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 0)
@@ -1,61 +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.hibernate.strategy.EhcacheAccessStrategyFactory;
-
-import org.hibernate.cache.CacheDataDescription;
-import org.hibernate.cache.CacheException;
-import org.hibernate.cache.EntityRegion;
-import org.hibernate.cache.access.AccessType;
-import org.hibernate.cache.access.EntityRegionAccessStrategy;
-import org.hibernate.cfg.Settings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An entity region specific wrapper around an Ehcache instance.
- *
- * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access
- * is not supported.
- *
- * @author Chris Dennis
- * @author Abhishek Sanoujam
- */
-public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion {
-
- private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class);
-
- /**
- * Constructs an EhcacheEntityRegion around the given underlying cache.
- *
- * @param accessStrategyFactory
- */
- public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings,
- CacheDataDescription metadata, Properties properties) {
- super(accessStrategyFactory, underlyingCache, settings, metadata, properties);
- }
-
- /**
- * {@inheritDoc}
- */
- public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
- return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/checkstyle/suppressions.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/checkstyle/suppressions.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/checkstyle/suppressions.xml (revision 0)
@@ -1,451 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 0)
@@ -1,73 +0,0 @@
-package net.sf.ehcache;
-
-import net.sf.ehcache.config.CacheConfiguration;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * @author Alex Snaps
- */
-public class OverflowCacheTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(CacheTest.class.getName());
-
- private CacheManager manager;
-
- @Before
- public void setUp() throws Exception {
- manager = CacheManager.create();
- }
-
- /**
- * teardown
- */
- @After
- public void tearDown() throws Exception {
- if (manager != null) {
- manager.shutdown();
- }
- }
-
-
- /**
- * Shows the effect of jamming large amounts of puts into a cache that overflows to disk.
- * The DiskStore should cause puts to back off and avoid an out of memory error.
- */
- @Test
- public void testBehaviourOnDiskStoreBackUp() throws Exception {
- Cache cache = new Cache(new CacheConfiguration().name("testBehaviourOnDiskStoreBackUp")
- .maxElementsInMemory(1000)
- .overflowToDisk(true)
- .eternal(false)
- .timeToLiveSeconds(100)
- .timeToIdleSeconds(200)
- .diskPersistent(false)
- .diskExpiryThreadIntervalSeconds(0)
- .diskSpoolBufferSizeMB(10));
- manager.addCache(cache);
-
- assertEquals(0, cache.getStatistics().getLocalHeapSize());
-
- Element a;
- int i = 0;
- try {
- for (; i < 150000; i++) {
- String key = i + "";
- String value = key;
- a = new Element(key, value + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
- cache.put(a);
- }
- } catch (OutOfMemoryError e) {
- LOG.info("OutOfMemoryError: " + e.getMessage() + " " + i);
- fail();
- }
- }
-
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0)
@@ -1,147 +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.blocking;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheException;
-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.config.DiskStoreConfiguration;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.sameInstance;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-
-/**
- * Test cases for the {@link UpdatingSelfPopulatingCache}.
- *
- * @author Greg Luck
- * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $
- */
-public class UpdatingSelfPopulatingCacheTest {
-
- @Rule
- public TemporaryFolder temporaryFolder = new TemporaryFolder();
-
- private CacheManager cacheManager;
- private Cache cache;
-
- @Before
- public void setUp() throws Exception {
- Configuration configuration = new Configuration();
- configuration.name("upSelfPopCM")
- .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath()))
- .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2)
- .timeToLiveSeconds(5)
- .overflowToDisk(true)
- .diskPersistent(true));
- cacheManager = CacheManager.newInstance(configuration);
- cache = cacheManager.getCache("cache");
- }
-
- @After
- public void tearDown() {
- cacheManager.shutdown();
- }
-
- /**
- * Tests fetching an entry, and then an update.
- */
- @Test
- public void testFetchAndUpdate() throws Exception {
- final Object value = "value";
- final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value);
- UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory);
-
-
- //test null
- Element element = selfPopulatingCache.get(null);
-
- // Lookup
- element = selfPopulatingCache.get("key");
- assertThat(element.getObjectValue(), sameInstance(value));
- assertThat(factory.getCount(), is(2));
-
- Object actualValue = selfPopulatingCache.get("key").getObjectValue();
- assertThat(actualValue, sameInstance(value));
- assertThat(factory.getCount(), is(3));
-
- actualValue = selfPopulatingCache.get("key").getObjectValue();
- assertThat(actualValue, sameInstance(value));
- assertThat(factory.getCount(), is(4));
- }
-
- /**
- * Tests when fetch fails.
- */
- @Test
- public void testFetchFail() throws Exception {
- final Exception exception = new Exception("Failed.");
- final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() {
- public Object createEntry(final Object key)
- throws Exception {
- throw exception;
- }
-
- public void updateEntryValue(Object key, Object value)
- throws Exception {
- throw exception;
- }
- };
-
- UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory);
-
- // Lookup
- try {
- selfPopulatingCache.get("key");
- fail();
- } catch (final Exception e) {
- // Check the error
- assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage());
- }
- }
-
- /**
- * Tests refreshing the entries.
- */
- @Test
- public void testRefresh() throws Exception {
- final String value = "value";
- final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value);
- UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory);
-
- // Refresh
- try {
- selfPopulatingCache.refresh();
- fail();
- } catch (CacheException e) {
- //expected.
- assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage());
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-writebehind-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0)
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.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.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;
- }
-}
\ No newline at end of file
Index: rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0)
@@ -1,32 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-
-package org.terracotta.modules.ehcache.wan;
-
-/**
- * @author Eugene Shelestovich
- */
-public interface Watchable {
-
- /**
- *
- */
- void goLive();
-
- void die();
-
- /**
- * Checks whether or not a given Watchable is alive.
- *
- * @return {@code true} if a given Watchable is alive, {@code false} otherwise
- */
- boolean probeLiveness();
-
- /**
- * Returns a name which uniquely identifies the Watchable.
- *
- * @return unique name
- */
- String name();
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/FeaturesManager.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/FeaturesManager.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/FeaturesManager.java (revision 0)
@@ -1,79 +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.pool.Pool;
-import net.sf.ehcache.store.Store;
-import net.sf.ehcache.transaction.SoftLockFactory;
-import net.sf.ehcache.transaction.SoftLockManager;
-import net.sf.ehcache.transaction.TransactionIDFactory;
-import net.sf.ehcache.writer.writebehind.WriteBehind;
-
-/**
- * Interface implemented by classes providing access to extended functionality.
- *
- * @author Chris Dennis
- */
-public interface FeaturesManager {
-
- /**
- * Fully qualified classname of the enterprise features manager
- */
- public static final String ENTERPRISE_FM_CLASSNAME = "net.sf.ehcache.EnterpriseFeaturesManager";
-
- /**
- * Create a WriteBehind instance for the given cache.
- *
- * @param cache cache to create write behind for
- * @return a write behind instance
- */
- WriteBehind createWriteBehind(Cache cache);
-
- /**
- * Create a store for the given cache.
- *
- * @param cache cache to create a store for
- * @param onHeapPool on-heap pool
- * @param onDiskPool on-disk pool
- * @return a store for the given cache
- */
- Store createStore(Cache cache, Pool onHeapPool, Pool onDiskPool);
-
- /**
- * Create a transaction map for the associated cache manager
- *
- * @return a transaction map for the cache manager
- */
- TransactionIDFactory createTransactionIDFactory();
-
- /**
- * Create a soft-lock map for the given cache
- *
- * @return a soft-lcok map for the given cache
- */
- SoftLockManager createSoftLockManager(Ehcache cache, SoftLockFactory lockFactory);
-
- /**
- * Called on {@code CacheManager} creation.
- */
- void startup();
-
- /**
- * Called on {@code CacheManager} shutdown and on exception during CacheManager bootstrapping.
- */
- void dispose();
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.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.store;
-
-import net.sf.ehcache.Element;
-import net.sf.ehcache.store.compound.ReadWriteCopyStrategy;
-import net.sf.ehcache.transaction.SoftLockID;
-
-/**
- * @author Alex Snaps
- */
-public class TxCopyStrategyHandler extends CopyStrategyHandler {
-
- /**
- * Creates a TxCopyStrategyHandler based on the copy configuration
- *
- * @param copyOnRead copy on read flag
- * @param copyOnWrite copy on write flag
- * @param copyStrategy the copy strategy to use
- * @param loader
- */
- public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite,
- final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) {
- super(copyOnRead, copyOnWrite, copyStrategy, loader);
- }
-
- @Override
- public Element copyElementForReadIfNeeded(final Element element) {
- final Object objectValue = element.getObjectValue();
- if (objectValue instanceof SoftLockID) {
- return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement());
- }
- return super.copyElementForReadIfNeeded(element);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/Element.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/Element.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/Element.java (revision 0)
@@ -1,889 +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.config.CacheConfiguration;
-import net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf;
-import net.sf.ehcache.util.TimeUtil;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-
-/**
- * A Cache Element, consisting of a key, value and attributes.
- *
- * From ehcache-1.2, Elements can have keys and values that are Serializable or Objects. To preserve backward
- * compatibility, special accessor methods for Object keys and values are provided: {@link #getObjectKey()} and
- * {@link #getObjectValue()}. If placing Objects in ehcache, developers must use the new getObject... methods to
- * avoid CacheExceptions. The get... methods are reserved for Serializable keys and values.
- *
- * @author Greg Luck
- * @version $Id: Element.java 10789 2018-04-26 02:08:13Z adahanne $
- */
-public class Element implements Serializable, Cloneable {
-
- /**
- * serial version
- * Updated for version 1.2, 1.2.1 and 1.7
- */
- private static final long serialVersionUID = 1098572221246444544L;
-
- private static final Logger LOG = LoggerFactory.getLogger(Element.class.getName());
-
- private static final AtomicLongFieldUpdater HIT_COUNT_UPDATER = AtomicLongFieldUpdater.newUpdater(Element.class, "hitCount");
-
- private static final boolean ELEMENT_VERSION_AUTO = Boolean.getBoolean("net.sf.ehcache.element.version.auto");
-
- private static final long NOT_SET_ID = 0;
-
- static {
- if (ELEMENT_VERSION_AUTO) {
- LOG.warn("Note that net.sf.ehcache.element.version.auto is set and user provided version will not be honored");
- }
- }
-
- /**
- * the cache key.
- */
- @IgnoreSizeOf
- private final Object key;
-
- /**
- * the value.
- */
- private final Object value;
-
- /**
- * version of the element. System.currentTimeMillis() is used to compute version for updated elements. That
- * way, the actual version of the updated element does not need to be checked.
- */
- private volatile long version;
-
- /**
- * The number of times the element was hit.
- */
- private volatile long hitCount;
-
- /**
- * The amount of time for the element to live, in seconds. 0 indicates unlimited.
- */
- private volatile int timeToLive = Integer.MIN_VALUE;
-
- /**
- * The amount of time for the element to idle, in seconds. 0 indicates unlimited.
- */
- private volatile int timeToIdle = Integer.MIN_VALUE;
-
- /**
- * The creation time.
- */
- private transient long creationTime;
-
- /**
- * The last access time.
- */
- private transient long lastAccessTime;
-
- /**
- * If there is an Element in the Cache and it is replaced with a new Element for the same key,
- * then both the version number and lastUpdateTime should be updated to reflect that. The creation time
- * will be the creation time of the new Element, not the original one, so that TTL concepts still work.
- */
- private volatile long lastUpdateTime;
-
- private volatile boolean cacheDefaultLifespan = true;
-
- private volatile long id = NOT_SET_ID;
-
- /**
- * A full constructor.
- *
- * Creation time is set to the current time. Last Access Time is not set.
- *
- * @since .4
- */
- public Element(final Serializable key, final Serializable value, final long version) {
- this((Object) key, (Object) value, version);
-
- }
-
- /**
- * A full constructor.
- *
- * Creation time is set to the current time. Last Access Time and Previous To Last Access Time
- * are not set.
- *
- * @since 1.2
- */
- public Element(final Object key, final Object value, final long version) {
- this.key = key;
- this.value = value;
- this.version = version;
- HIT_COUNT_UPDATER.set(this, 0);
- this.creationTime = getCurrentTime();
- }
-
- /**
- * Constructor.
- *
- * @deprecated The {@code nextToLastAccessTime} field is unused since
- * version 1.7, setting it will have no effect. Use
- * #Element(Object, Object, long, long, long, long, long)
- * instead
- * @since 1.3
- * @see #Element(Object, Object, long, long, long, long, long)
- */
- @Deprecated
- public Element(final Object key, final Object value, final long version,
- final long creationTime, final long lastAccessTime, final long nextToLastAccessTime,
- final long lastUpdateTime, final long hitCount) {
- this(key, value, version, creationTime, lastAccessTime, lastUpdateTime, hitCount);
- }
-
- /**
- * Constructor.
- *
- * @since 1.7
- */
- public Element(final Object key, final Object value, final long version,
- final long creationTime, final long lastAccessTime,
- final long lastUpdateTime, final long hitCount) {
- this.key = key;
- this.value = value;
- this.version = version;
- this.lastUpdateTime = lastUpdateTime;
- HIT_COUNT_UPDATER.set(this, hitCount);
- this.creationTime = creationTime;
- this.lastAccessTime = lastAccessTime;
- }
-
- /**
- * Constructor used by ElementData. Needs to be public since ElementData might be in another classloader
- *
- * @since 1.7
- */
- public Element(final Object key, final Object value, final long version, final long creationTime,
- final long lastAccessTime, final long hitCount, final boolean cacheDefaultLifespan,
- final int timeToLive, final int timeToIdle, final long lastUpdateTime) {
- this.key = key;
- this.value = value;
- this.version = version;
- HIT_COUNT_UPDATER.set(this, hitCount);
- this.cacheDefaultLifespan = cacheDefaultLifespan;
- this.timeToLive = timeToLive;
- this.timeToIdle = timeToIdle;
- this.lastUpdateTime = lastUpdateTime;
- this.creationTime = creationTime;
- this.lastAccessTime = lastAccessTime;
- }
-
- /**
- * Constructor
- *
- * @param key any non null value
- * @param value any value, including nulls
- * @param timeToIdleSeconds seconds to idle
- * @param timeToLiveSeconds seconds to live
- * @since 2.7.1
- */
- public Element(final Object key, final Object value,
- final int timeToIdleSeconds, final int timeToLiveSeconds) {
- this(key, value);
- setTimeToIdle(timeToIdleSeconds);
- setTimeToLive(timeToLiveSeconds);
- }
-
- /**
- * Constructor
- *
- * @param key any non null value
- * @param value any value, including nulls
- * @param eternal whether this element is eternal
- * @since 2.7.1
- */
- public Element(final Object key, final Object value, final boolean eternal) {
- this(key, value);
- setEternal(eternal);
- }
-
- /**
- * Constructor used by ehcache-server
- *
- * timeToIdleSeconds and timeToLiveSeconds will have precedence over eternal. Which means that what ever eternal says, non-null
- * timeToIdleSeconds or timeToLiveSeconds will result in the element not being eternal
- *
- * @param key any non null value
- * @param value any value, including nulls
- * @param eternal specify as non-null to override cache configuration
- * @param timeToIdleSeconds specify as non-null to override cache configuration
- * @param timeToLiveSeconds specify as non-null to override cache configuration
- *
- * @deprecated
- */
- @Deprecated
- public Element(final Object key, final Object value,
- final Boolean eternal, final Integer timeToIdleSeconds, final Integer timeToLiveSeconds) {
- this.key = key;
- this.value = value;
- if (eternal != null) {
- setEternal(eternal.booleanValue());
- }
- if (timeToIdleSeconds != null) {
- setTimeToIdle(timeToIdleSeconds.intValue());
- }
- if (timeToLiveSeconds != null) {
- setTimeToLive(timeToLiveSeconds.intValue());
- }
- this.creationTime = getCurrentTime();
- }
-
- /**
- * Constructor.
- *
- * @param key
- * @param value
- */
- public Element(final Serializable key, final Serializable value) {
- this((Object) key, (Object) value, 1L);
- }
-
- /**
- * Constructor.
- *
- * @param key
- * @param value
- * @since 1.2
- */
- public Element(final Object key, final Object value) {
- this(key, value, 1L);
- }
-
- /**
- * Gets the key attribute of the Element object.
- *
- * @return The key value.
- * @throws CacheException if the key is not {@code Serializable}.
- * @deprecated Please use {@link #getObjectKey()} instead.
- */
- @Deprecated
- public final Serializable getKey() throws CacheException {
- try {
- return (Serializable) getObjectKey();
- } catch (ClassCastException e) {
- throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey()");
- }
- }
-
- /**
- * Gets the key attribute of the Element object.
- *
- * This method is provided for those wishing to use ehcache as a memory only cache
- * and enables retrieval of non-Serializable values from elements.
- *
- * @return The key as an Object. i.e no restriction is placed on it
- * @see #getKey()
- */
- public final Object getObjectKey() {
- return key;
- }
-
- /**
- * Gets the value attribute of the Element object.
- *
- * @return The value which must be {@code Serializable}. If not use {@link #getObjectValue}.
- * @throws CacheException if the value is not {@code Serializable}.
- * @deprecated Please use {@link #getObjectValue()} instead.
- */
- @Deprecated
- public final Serializable getValue() throws CacheException {
- try {
- return (Serializable) getObjectValue();
- } catch (ClassCastException e) {
- throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() +
- " is not Serializable. Consider using Element.getObjectValue()");
- }
- }
-
- /**
- * Gets the value attribute of the Element object as an Object.
- *
- * This method is provided for those wishing to use ehcache as a memory only cache
- * and enables retrieval of non-Serializable values from elements.
- *
- * @return The value as an Object. i.e no restriction is placed on it
- * @see #getValue()
- * @since 1.2
- */
- public final Object getObjectValue() {
- return value;
- }
-
- /**
- * Equals comparison with another element, based on the key.
- */
- @Override
- public final boolean equals(final Object object) {
- if (object == null || !(object instanceof Element)) {
- return false;
- }
-
- Element element = (Element) object;
- if (key == null || element.getObjectKey() == null) {
- return false;
- }
-
- return key.equals(element.getObjectKey());
- }
-
- /**
- * Sets time to Live
- *
- * Value must be a positive integer, 0 means infinite time to live.
- *
- * If calling this method with 0 as the parameter, consider using {@link #setEternal(boolean)}
- * or make sure you also explicitly call {@link #setTimeToIdle(int)}.
- *
- * @param timeToLiveSeconds the number of seconds to live
- */
- public void setTimeToLive(final int timeToLiveSeconds) {
- if (timeToLiveSeconds < 0) {
- throw new IllegalArgumentException("timeToLive can't be negative");
- }
- this.cacheDefaultLifespan = false;
- this.timeToLive = timeToLiveSeconds;
- }
-
- /**
- * Sets time to idle
- *
- * Value must be a positive integer, 0 means infinite time to idle.
- *
- * If calling this method with 0 as the parameter, consider using {@link #setEternal(boolean)}
- * or make sure you also explicitly call {@link #setTimeToLive(int)}.
- *
- * @param timeToIdleSeconds the number of seconds to idle
- */
- public void setTimeToIdle(final int timeToIdleSeconds) {
- if (timeToIdleSeconds < 0) {
- throw new IllegalArgumentException("timeToIdle can't be negative");
- }
- this.cacheDefaultLifespan = false;
- this.timeToIdle = timeToIdleSeconds;
- }
-
- /**
- * Gets the hashcode, based on the key.
- */
- @Override
- public final int hashCode() {
- return key.hashCode();
- }
-
- /**
- * Sets the version attribute of the ElementAttributes object.
- *
- * @param version The new version value
- */
- public final void setVersion(final long version) {
- this.version = version;
- }
-
- /**
- * Sets the element identifier (this field is used internally by ehcache). Setting this field in application code will not be preserved
- *
- * @param id The new id value
- */
- void setId(final long id) {
- if (id == NOT_SET_ID) {
- throw new IllegalArgumentException("Id cannot be set to " + id);
- }
- this.id = id;
- }
-
- /**
- * Gets the element identifier (this field is used internally by ehcache)
- *
- * @return id the id
- */
- long getId() {
- final long v = id;
- if (v == NOT_SET_ID) {
- throw new IllegalStateException("Id not set");
- }
- return v;
- }
-
- /**
- * Determines if an Id has been set on this element
- *
- * @return true if this element has an Id
- */
- boolean hasId() {
- return id != NOT_SET_ID;
- }
-
- /**
- * Sets the creationTime attribute of the ElementAttributes object.
- *
- * Note that in a Terracotta clustered environment, resetting the creation
- * time will not have any effect.
- *
- * @deprecated Resetting the creation time is not recommended as of version
- * 1.7
- */
- @Deprecated
- public final void setCreateTime() {
- creationTime = getCurrentTime();
- }
-
- /**
- * Gets the creationTime of the Element
- *
- * @return The creationTime value
- */
- public final long getCreationTime() {
- return creationTime;
- }
-
- /**
- * Calculates the latest of creation and update time
- * @return if never updated, creation time is returned, otherwise updated time
- */
- public final long getLatestOfCreationAndUpdateTime() {
- if (0 == lastUpdateTime) {
- return creationTime;
- } else {
- return lastUpdateTime;
- }
- }
-
- /**
- * Gets the version attribute of the ElementAttributes object.
- *
- * @return The version value
- */
- public final long getVersion() {
- return version;
- }
-
- /**
- * Gets the last access time of this element.
- *
- * Access means the element was written into a cache or read from it.
- * When first instantiated an {@link Element} has a lastAccessTime of 0, unless passed into the constructor.
- *
- * @return last access time in unix epoch
- * @see #Element(Object, Object, long, long, long, long, boolean, int, int, long)
- * @see #Element(Object, Object, long, long, long, long, long)
- * @see #resetAccessStatistics()
- * @see #updateAccessStatistics()
- */
- public final long getLastAccessTime() {
- return lastAccessTime;
- }
-
- /**
- * Gets the next to last access time.
- *
- * @deprecated The {@code nextToLastAccessTime} field is unused since
- * version 1.7, retrieving it will return the {@code
- * lastAccessTime}. Use #getLastAccessTime() instead.
- * @see #getLastAccessTime()
- */
- @Deprecated
- public final long getNextToLastAccessTime() {
- return getLastAccessTime();
- }
-
- /**
- * Gets the hit count on this element.
- */
- public final long getHitCount() {
- return hitCount;
- }
-
- /**
- * Resets the hit count to 0 and the last access time to now. Used when an Element is put into a cache.
- */
- public final void resetAccessStatistics() {
- lastAccessTime = getCurrentTime();
- HIT_COUNT_UPDATER.set(this, 0);
- }
-
- /**
- * Sets the last access time to now and increase the hit count.
- */
- public final void updateAccessStatistics() {
- lastAccessTime = getCurrentTime();
- HIT_COUNT_UPDATER.incrementAndGet(this);
- }
-
- /**
- * Sets the last access time to now without updating the hit count.
- */
- public final void updateUpdateStatistics() {
- lastUpdateTime = getCurrentTime();
- if (ELEMENT_VERSION_AUTO) {
- version = lastUpdateTime;
- }
- }
-
-
- /**
- * Returns a {@link String} representation of the {@link Element}.
- */
- @Override
- public final String toString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append("[ key = ").append(key)
- .append(", value=").append(value)
- .append(", version=").append(version)
- .append(", hitCount=").append(hitCount)
- .append(", CreationTime = ").append(this.getCreationTime())
- .append(", LastAccessTime = ").append(this.getLastAccessTime())
- .append(" ]");
-
- return sb.toString();
- }
-
- /**
- * Clones an Element. A completely new object is created, with no common references with the
- * existing one.
- *
- * This method will not work unless the Object is Serializable
- *
- * Warning: This can be very slow on large object graphs. If you use this method
- * you should write a performance test to verify suitability.
- *
- * @return a new {@link Element}, with exactly the same field values as the one it was cloned from.
- * @throws CloneNotSupportedException
- */
- @Override
- public final Object clone() throws CloneNotSupportedException {
- //Not used. Just to get code inspectors to shut up
- super.clone();
-
- try {
- return new Element(deepCopy(key), deepCopy(value), version, creationTime, lastAccessTime, 0L, hitCount);
- } catch (IOException e) {
- LOG.error("Error cloning Element with key " + key
- + " during serialization and deserialization of value");
- throw new CloneNotSupportedException();
- } catch (ClassNotFoundException e) {
- LOG.error("Error cloning Element with key " + key
- + " during serialization and deserialization of value");
- throw new CloneNotSupportedException();
- }
- }
-
- private static Object deepCopy(final Object oldValue) throws IOException, ClassNotFoundException {
- Serializable newValue = null;
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oos = null;
- ObjectInputStream ois = null;
- try {
- oos = new ObjectOutputStream(bout);
- oos.writeObject(oldValue);
- ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
- ois = new ObjectInputStream(bin);
- newValue = (Serializable) ois.readObject();
- } finally {
- try {
- if (oos != null) {
- oos.close();
- }
- if (ois != null) {
- ois.close();
- }
- } catch (Exception e) {
- LOG.error("Error closing Stream");
- }
- }
- return newValue;
- }
-
- /**
- * The size of this object in serialized form. This is not the same
- * thing as the memory size, which is JVM dependent. Relative values should be meaningful,
- * however.
- *
- * Warning: This method can be very slow for values which contain large object graphs.
- *
- * If the key or value of the Element is not Serializable, an error will be logged and 0 will be returned.
- *
- * @return The serialized size in bytes
- */
- public final long getSerializedSize() {
-
- if (!isSerializable()) {
- return 0;
- }
- long size = 0;
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- ObjectOutputStream oos = null;
- try {
- oos = new ObjectOutputStream(bout);
- oos.writeObject(this);
- size = bout.size();
- return size;
- } catch (IOException e) {
- LOG.debug("Error measuring element size for element with key " + key + ". Cause was: " + e.getMessage());
- } finally {
- try {
- if (oos != null) {
- oos.close();
- }
- } catch (Exception e) {
- LOG.error("Error closing ObjectOutputStream");
- }
- }
-
- return size;
- }
-
- /**
- * Whether the element may be Serialized.
- *
- * While Element implements Serializable, it is possible to create non Serializable elements
- * for use in MemoryStores. This method checks that an instance of Element really is Serializable
- * and will not throw a NonSerializableException if Serialized.
- *
- * This method was tweaked in 1.6 as it has been shown that Serializable classes can be serializaed as can
- * null, regardless of what class it is a null of. ObjectOutputStream.write(null) works and ObjectInputStream.read()
- * will read null back.
- *
- * @return true if the element is Serializable
- * @since 1.2
- */
- public final boolean isSerializable() {
- return isKeySerializable()
- && (value instanceof Serializable || value == null);
- }
-
- /**
- * Whether the element's key may be Serialized.
- *
- * While Element implements Serializable, it is possible to create non Serializable elements and/or
- * non Serializable keys for use in MemoryStores.
- *
- * This method checks that an instance of an Element's key really is Serializable
- * and will not throw a NonSerializableException if Serialized.
- *
- * @return true if the element's key is Serializable
- * @since 1.2
- */
- public final boolean isKeySerializable() {
- return key instanceof Serializable || key == null;
- }
-
- /**
- * If there is an Element in the Cache and it is replaced with a new Element for the same key,
- * then both the version number and lastUpdateTime should be updated to reflect that. The creation time
- * will be the creation time of the new Element, not the original one, so that TTL concepts still work.
- *
- * @return the time when the last update occured. If this is the original Element, the time will be null
- */
- public long getLastUpdateTime() {
- return lastUpdateTime;
- }
-
- /**
- * An element is expired if the expiration time as given by {@link #getExpirationTime()} is in the past.
- *
- * @return true if the Element is expired, otherwise false. If no lifespan has been set for the Element it is
- * considered not able to expire.
- * @see #getExpirationTime()
- */
- public boolean isExpired() {
- if (!isLifespanSet() || isEternal()) {
- return false;
- }
-
- long now = getCurrentTime();
- long expirationTime = getExpirationTime();
-
- return now > expirationTime;
- }
-
- /**
- * An element is expired if the expiration time as given by {@link #getExpirationTime()} is in the past.
- *
- * This method in addition propogates the default TTI/TTL values of the supplied cache into this element.
- *
- * @param config config to take default parameters from
- * @return true if the Element is expired, otherwise false. If no lifespan has been set for the Element it is
- * considered not able to expire.
- * @see #getExpirationTime()
- */
- public boolean isExpired(CacheConfiguration config) {
- if (cacheDefaultLifespan) {
- if (config.isEternal()) {
- timeToIdle = 0;
- timeToLive = 0;
- } else {
- timeToIdle = TimeUtil.convertTimeToInt(config.getTimeToIdleSeconds());
- timeToLive = TimeUtil.convertTimeToInt(config.getTimeToLiveSeconds());
- }
- }
- return isExpired();
- }
-
- /**
- * Returns the expiration time based on time to live. If this element also has a time to idle setting, the expiry
- * time will vary depending on whether the element is accessed.
- *
- * @return the time to expiration
- */
- public long getExpirationTime() {
- if (!isLifespanSet() || isEternal()) {
- return Long.MAX_VALUE;
- }
-
- long expirationTime = 0;
- long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive());
-
- long mostRecentTime = Math.max(creationTime, lastAccessTime);
- long ttiExpiry = mostRecentTime + TimeUtil.toMillis(getTimeToIdle());
-
- if (getTimeToLive() != 0 && (getTimeToIdle() == 0 || lastAccessTime == 0)) {
- expirationTime = ttlExpiry;
- } else if (getTimeToLive() == 0) {
- expirationTime = ttiExpiry;
- } else {
- expirationTime = Math.min(ttlExpiry, ttiExpiry);
- }
- return expirationTime;
- }
-
- /**
- * @return true if the element is eternal
- */
- public boolean isEternal() {
- return (0 == timeToIdle) && (0 == timeToLive);
- }
-
- /**
- * Sets whether the element is eternal.
- *
- * @param eternal
- */
- public void setEternal(final boolean eternal) {
- if (eternal) {
- this.cacheDefaultLifespan = false;
- this.timeToIdle = 0;
- this.timeToLive = 0;
- } else if (isEternal()) {
- this.cacheDefaultLifespan = false;
- this.timeToIdle = Integer.MIN_VALUE;
- this.timeToLive = Integer.MIN_VALUE;
- }
- }
-
- /**
- * Whether any combination of eternal, TTL or TTI has been set.
- *
- * @return true if set.
- */
- public boolean isLifespanSet() {
- return this.timeToIdle != Integer.MIN_VALUE || this.timeToLive != Integer.MIN_VALUE;
- }
-
- /**
- * @return the time to live, in seconds
- */
- public int getTimeToLive() {
- if (Integer.MIN_VALUE == timeToLive) {
- return 0;
- } else {
- return timeToLive;
- }
- }
-
- /**
- * @return the time to idle, in seconds
- */
- public int getTimeToIdle() {
- if (Integer.MIN_VALUE == timeToIdle) {
- return 0;
- } else {
- return timeToIdle;
- }
- }
-
- /**
- * @return false
if this Element has a custom lifespan
- */
- public boolean usesCacheDefaultLifespan() {
- return cacheDefaultLifespan;
- }
-
- /**
- * Set the default parameters of this element - those from its enclosing cache.
- * @param tti TTI in seconds
- * @param ttl TTL in seconds
- * @param eternal true
if the element is eternal.
- */
- protected void setLifespanDefaults(int tti, int ttl, boolean eternal) {
- if (eternal) {
- this.timeToIdle = 0;
- this.timeToLive = 0;
- } else if (isEternal()) {
- this.timeToIdle = Integer.MIN_VALUE;
- this.timeToLive = Integer.MIN_VALUE;
- } else {
- timeToIdle = tti;
- timeToLive = ttl;
- }
- }
-
- /**
- * Seam for testing purposes
- * @return System.currentTimeMillis() by default
- */
- long getCurrentTime() {
- return System.currentTimeMillis();
- }
-
- /**
- * Custom serialization write logic
- */
- private void writeObject(ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
- out.writeInt(TimeUtil.toSecs(creationTime));
- out.writeInt(TimeUtil.toSecs(lastAccessTime));
- }
-
- /**
- * Custom serialization read logic
- */
- private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- creationTime = TimeUtil.toMillis(in.readInt());
- lastAccessTime = TimeUtil.toMillis(in.readInt());
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-xa-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-xa-test.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/basic-xa-test.xml (revision 0)
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0)
@@ -1,40 +0,0 @@
-RULE trace RemoteTransactionManagerImpl commitWithoutThrottling
-CLASS RemoteTransactionManagerImpl
-METHOD commitWithoutThrottling
-AT ENTRY
-IF true
-DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore putWithWriterEntry
-CLASS ClusteredStore
-METHOD putWithWriter
-AT ENTRY
-IF true
-DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore putWithWriterExit
-CLASS ClusteredStore
-METHOD putWithWriter
-AT EXIT
-IF true
-DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore removeWithWriterEntry
-CLASS ClusteredStore
-METHOD removeWithWriter
-AT ENTRY
-IF true
-DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName());
-ENDRULE
-
-RULE trace ClusteredStore removeWithWriterExit
-CLASS ClusteredStore
-METHOD removeWithWriter
-AT EXIT
-IF true
-DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName());
-ENDRULE
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0)
@@ -1,90 +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.local;
-
-import net.sf.ehcache.transaction.TransactionID;
-import net.sf.ehcache.transaction.TransactionIDFactory;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * The local transactions mode recovery manager which is used to trigger full recovery of all
- * caches configured with local transaction mode.
- *
- * @author Ludovic Orban
- */
-public class LocalRecoveryManager {
-
- private final TransactionIDFactory transactionIdFactory;
- private final List localTransactionStores = new CopyOnWriteArrayList();
- private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet();
-
- /**
- * Create a LocalRecoveryManager instance
- * @param transactionIdFactory the TransactionIDFactory
- */
- public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) {
- this.transactionIdFactory = transactionIdFactory;
- }
-
- /**
- * Register a LocalTransactionStore from the recovery manager
- * @param localTransactionStore the LocalTransactionStore
- */
- void register(LocalTransactionStore localTransactionStore) {
- localTransactionStores.add(localTransactionStore);
- }
-
- /**
- * Unregister a LocalTransactionStore from the recovery manager
- * @param localTransactionStore the LocalTransactionStore
- */
- void unregister(LocalTransactionStore localTransactionStore) {
- localTransactionStores.remove(localTransactionStore);
- }
-
- /**
- * Run recovery on all registered local transaction stores. The latter
- * are used internally by caches when they're configured with local transaction mode.
- * @return the set of recovered TransactionIDs
- */
- public Set recover() {
- Set recovered = new HashSet();
- // first ask all stores to cleanup their soft locks
- for (LocalTransactionStore localTransactionStore : localTransactionStores) {
- recovered.addAll(localTransactionStore.recover());
- }
- // then clear the transaction ID
- for (TransactionID transactionId : recovered) {
- transactionIdFactory.clear(transactionId);
- }
-
- previouslyRecoveredTransactionIDs = recovered;
- return recovered;
- }
-
- /**
- * Get the set of transaction IDs collected by the previous recover() call
- * @return the set of previously recovered TransactionIDs
- */
- public Set getPreviouslyRecoveredTransactionIDs() {
- return previouslyRecoveredTransactionIDs;
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.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.bootstrap;
-
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Ehcache;
-
-/**
- * @author Greg Luck
- * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $
- */
-public interface BootstrapCacheLoader {
-
- /**
- * Instructs the loader to load the given cache
- * @param cache cache to load
- */
- void load(Ehcache cache) throws CacheException;
-
- /**
- *
- * @return true if this bootstrap loader is asynchronous
- */
- boolean isAsynchronous();
-
- /**
- * Clones the loader
- *
- * @return clone of this instance
- * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface.
- */
- Object clone() throws CloneNotSupportedException;
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0)
@@ -1,21 +0,0 @@
-package org.terracotta.ehcache.tests.servermap;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-
-import com.tc.test.config.model.TestConfig;
-
-public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase {
-
- public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) {
- super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig,
- ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class);
- testConfig.setDgcEnabled(true);
- testConfig.setDgcIntervalInSec(60);
- testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true");
-
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false");
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true");
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000");
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 0)
@@ -1,123 +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.store;
-
-
-import java.io.Serializable;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A typesafe enumeration of eviction policies.
- * The policy used to evict elements from the {@link net.sf.ehcache.store.MemoryStore}.
- * This can be one of:
- *
- * LRU - least recently used
- * LFU - least frequently used
- * FIFO - first in first out, the oldest element by creation time
- *
- * The default value is LRU
- *
- * @author Greg Luck
- * @version $Id: MemoryStoreEvictionPolicy.java 5594 2012-05-07 16:04:31Z cdennis $
- * @since 1.2
- */
-public final class MemoryStoreEvictionPolicy implements Serializable {
-
- /**
- * LRU - least recently used.
- */
- public static final MemoryStoreEvictionPolicy LRU = new MemoryStoreEvictionPolicy("LRU");
-
- /**
- * LFU - least frequently used.
- */
-
- public static final MemoryStoreEvictionPolicy LFU = new MemoryStoreEvictionPolicy("LFU");
-
- /**
- * FIFO - first in first out, the oldest element by creation time.
- */
- public static final MemoryStoreEvictionPolicy FIFO = new MemoryStoreEvictionPolicy("FIFO");
-
- /**
- * FIFO - first in first out, the oldest element by creation time.
- */
- public static final MemoryStoreEvictionPolicy CLOCK = new MemoryStoreEvictionPolicy("CLOCK");
-
- private static final Logger LOG = LoggerFactory.getLogger(MemoryStoreEvictionPolicy.class.getName());
-
- private final String myName;
-
- /**
- * This class should not be subclassed or have instances created.
- * @param policy
- */
- private MemoryStoreEvictionPolicy(String policy) {
- myName = policy;
- }
-
- /**
- * @return a String representation of the policy
- */
- @Override
- public String toString() {
- return myName;
- }
-
- /**
- * Converts a string representation of the policy into a policy.
- *
- * @param policy either LRU, LFU or FIFO
- * @return one of the static instances
- */
- public static MemoryStoreEvictionPolicy fromString(String policy) {
- if (policy != null) {
- if (policy.equalsIgnoreCase("LRU")) {
- return LRU;
- } else if (policy.equalsIgnoreCase("LFU")) {
- return LFU;
- } else if (policy.equalsIgnoreCase("FIFO")) {
- return FIFO;
- } else if (policy.equalsIgnoreCase("CLOCK")) {
- return CLOCK;
- }
- }
- LOG.warn("The memoryStoreEvictionPolicy of {} cannot be resolved. The policy will be set to LRU", policy);
- return LRU;
- }
-
- /**
- * Enum for {@link MemoryStoreEvictionPolicy}
- *
- */
- public static enum MemoryStoreEvictionPolicyEnum {
- /**
- * Value for {@link MemoryStoreEvictionPolicy#LFU}
- */
- LFU,
- /**
- * Value for {@link MemoryStoreEvictionPolicy#LRU}
- */
- LRU,
- /**
- * Value for {@link MemoryStoreEvictionPolicy#FIFO}
- */
- FIFO;
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0)
@@ -1,161 +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.expression.And;
-import net.sf.ehcache.search.expression.EqualTo;
-import net.sf.ehcache.search.expression.GreaterThan;
-import net.sf.ehcache.search.expression.GreaterThanOrEqual;
-import net.sf.ehcache.search.expression.ILike;
-import net.sf.ehcache.search.expression.LessThan;
-import net.sf.ehcache.search.expression.LessThanOrEqual;
-import net.sf.ehcache.search.expression.Not;
-import net.sf.ehcache.search.expression.NotEqualTo;
-import net.sf.ehcache.search.expression.Or;
-import net.sf.ehcache.search.parser.MCriteria.Between;
-import net.sf.ehcache.search.parser.MCriteria.Simple;
-import net.sf.ehcache.search.parser.MValue.MInt;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class MCriteriaTest {
-
- private final ClassLoader loader = getClass().getClassLoader();
-
- @Test
- public void testSimpleModelCriteria() throws CustomParseException {
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj);
- EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader));
- }
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj);
- NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader));
- }
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj);
- GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader));
- }
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj);
- GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader));
- }
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj);
- LessThan crit = (LessThan)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader));
- }
- {
- MInt obj = new MValue.MInt(null, "0");
- Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj);
- LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), "foo");
- Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader));
- }
- }
-
- void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) {
- Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max);
- net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader);
- Assert.assertEquals(crit.getAttributeName(), name);
- Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader));
- Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader));
- Assert.assertEquals(crit.isMinInclusive(), min);
- Assert.assertEquals(crit.isMaxInclusive(), max);
- }
-
- @Test
- public void testBetween() throws CustomParseException {
- MInt obj1 = new MValue.MInt(null, "0");
- MInt obj2 = new MValue.MInt(null, "110");
- checkBetween("foo", obj1, false, obj2, false);
- checkBetween("foo", obj1, true, obj2, false);
- checkBetween("foo", obj1, false, obj2, true);
- checkBetween("foo", obj1, true, obj2, true);
- }
-
- @Test
- public void testIlike() {
- MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo");
- ILike crit = (ILike)ilike.asEhcacheObject(loader);
- Assert.assertEquals(crit.getRegex(), "foo.*foo");
- Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName());
- }
-
- @Test
- public void testLike() {
- MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo");
- ILike crit = (ILike)like.asEhcacheObject(loader);
- Assert.assertEquals(like.getLikeRegex(), "foo.%foo");
- Assert.assertEquals(like.getILikeRegex(), "foo.*foo");
- Assert.assertEquals(crit.getRegex(), "foo.*foo");
- Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName());
- }
-
- @Test
- public void testNot() throws CustomParseException {
- MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1"));
- MCriteria.Not not = new MCriteria.Not(simple);
- Not crit = (Not)not.asEhcacheObject(loader);
- @SuppressWarnings("unused")
- EqualTo inner = (EqualTo)crit.getCriteria();
- Assert.assertTrue(true); // the casts are sufficient for the test.
- }
-
- @Test
- public void testAnd() throws CustomParseException {
- Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0"));
- Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10"));
- Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5"));
-
- MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3);
- And crit = (And)and.asEhcacheObject(loader);
- Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan);
- Assert.assertTrue(crit.getCriterion()[1] instanceof And);
- And crit2 = (And)crit.getCriterion()[1];
- Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan);
- Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo);
-
- }
-
- @Test
- public void testOr() throws CustomParseException {
- Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100"));
- Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10"));
- MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2);
-
- Or crit = (Or)or.asEhcacheObject(loader);
- Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan);
- Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/store/PoolableMemoryStoreTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/store/PoolableMemoryStoreTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/store/PoolableMemoryStoreTest.java (revision 0)
@@ -1,234 +0,0 @@
-package net.sf.ehcache.store;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.event.CacheEventListener;
-import net.sf.ehcache.pool.impl.BoundedPool;
-import net.sf.ehcache.pool.impl.ConstantSizeOfEngine;
-import net.sf.ehcache.pool.impl.RoundRobinOnHeapPoolEvictor;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicReference;
-import org.hamcrest.number.OrderingComparison;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author Ludovic Orban
- */
-public class PoolableMemoryStoreTest {
-
- private static final int ENTRIES = 2;
- private volatile Cache cache;
- private volatile BoundedPool onHeapPool;
- private volatile Store memoryStore;
-
- private static Collection keysOfOnHeapElements(Store store) {
- return (Collection) store.getKeys();
- }
-
- private static int countElementsOnHeap(Store store) {
- return keysOfOnHeapElements(store).size();
- }
-
- private void dump() {
- System.out.println("# # # # # #");
- System.out.println(memoryStore.getSize() + " elements in cache");
- System.out.println("on heap: " + keysOfOnHeapElements(memoryStore));
- System.out.println("on heap size: " + onHeapPool.getSize());
- System.out.println("# # # # # #");
- }
-
- @Before
- public void setUp() {
- cache = new Cache(new CacheConfiguration("myCache1", 0).eternal(true));
-
- cache.getCacheEventNotificationService().registerListener(new CacheEventListener() {
- public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException { }
-
- public void notifyElementPut(Ehcache cache, Element element) throws CacheException { }
-
- public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException { }
-
- public void notifyElementExpired(Ehcache cache, Element element) { }
-
- public void notifyElementEvicted(Ehcache cache, Element element) {
- }
-
- public void notifyRemoveAll(Ehcache cache) { }
-
- public void dispose() { }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- });
-
- onHeapPool = new BoundedPool(
- 16384 * ENTRIES, // == 2 elements
- new RoundRobinOnHeapPoolEvictor(),
- new ConstantSizeOfEngine(
- 1536, /* 1.5 KB*/
- 14336, /* 14 KB */
- 512 /* 0.5 KB */
- )
- );
-
- memoryStore = MemoryStore.create(cache, onHeapPool);
- }
-
- @After
- public void tearDown() {
- cache.dispose();
- memoryStore.dispose();
- }
-
-
- @Test
- public void testPutNew() throws Exception {
- // put 20 new elements in, making sure eviction is working
- for (int i = 0; i < 20; i++) {
- Element e = new Element(i, "" + i);
- memoryStore.put(e);
- assertTrue("#" + i, countElementsOnHeap(memoryStore) <= ENTRIES);
- }
-
- assertEquals(ENTRIES, countElementsOnHeap(memoryStore));
- assertEquals(16384 * ENTRIES, onHeapPool.getSize());
-
- // get an on-heap element
- Object key = keysOfOnHeapElements(memoryStore).iterator().next();
- memoryStore.get(key);
-
- assertEquals(ENTRIES, countElementsOnHeap(memoryStore));
- assertEquals(16384 * ENTRIES, onHeapPool.getSize());
-
- // put a new element on-heap
- memoryStore.put(new Element(-1, "-1"));
-
- assertEquals(ENTRIES, countElementsOnHeap(memoryStore));
- assertEquals(16384 * ENTRIES, onHeapPool.getSize());
- }
-
- @Test
- public void testPutUpdate() throws Exception {
- // warm up
- memoryStore.put(new Element(1, "1"));
- memoryStore.put(new Element(2, "2"));
- memoryStore.put(new Element(3, "3"));
-
- assertEquals(2, memoryStore.getSize());
- assertEquals(16384 * 2, onHeapPool.getSize());
-
- // update element in memory
- Object key = keysOfOnHeapElements(memoryStore).iterator().next();
- memoryStore.put(new Element(key, key.toString()));
-
- // size can be 1 or 2, depending if the evicted element is the updated one or not
- if (memoryStore.getSize() == 2) {
- assertEquals(16384 * 2, onHeapPool.getSize());
- } else if (memoryStore.getSize() == 1) {
- assertEquals(16384, onHeapPool.getSize());
- } else {
- fail();
- }
- }
-
- @Test
- public void testRemove() throws Exception {
- // warm up
- memoryStore.put(new Element(1, "1"));
- memoryStore.put(new Element(2, "2"));
- memoryStore.put(new Element(3, "3"));
-
- assertEquals(2, memoryStore.getSize());
- assertEquals(16384 * 2, onHeapPool.getSize());
-
- // remove element on heap
- Object key = keysOfOnHeapElements(memoryStore).iterator().next();
- memoryStore.remove(key);
-
- assertEquals(1, memoryStore.getSize());
- assertEquals(16384, onHeapPool.getSize());
- }
-
- @Test
- public void testRemoveAll() throws Exception {
- // warm up
- memoryStore.put(new Element(1, "1"));
- memoryStore.put(new Element(2, "2"));
- memoryStore.put(new Element(3, "3"));
-
- assertEquals(2, memoryStore.getSize());
- assertEquals(16384 * 2, onHeapPool.getSize());
-
- memoryStore.removeAll();
-
- assertEquals(0, memoryStore.getSize());
- assertEquals(0, onHeapPool.getSize());
- }
-
- @Test
- public void testStabilityUnderMutation() throws Exception {
- memoryStore.put(new Element(1, new AtomicReference()));
- assertEquals(1, memoryStore.getSize());
- assertThat(memoryStore.getInMemorySizeInBytes(), OrderingComparison.greaterThan(0L));
- assertThat(onHeapPool.getSize(), OrderingComparison.greaterThan(0L));
-
- ((AtomicReference) memoryStore.get(1).getObjectValue()).set(new byte[1024]);
- memoryStore.remove(1);
-
- assertEquals(0, memoryStore.getSize());
- assertEquals(0, memoryStore.getInMemorySizeInBytes());
- assertEquals(0, onHeapPool.getSize());
- }
-
- @Test
- @Ignore
- public void testMultithreaded() throws Exception {
- final int nThreads = 16;
-
- final ExecutorService executor = Executors.newFixedThreadPool(nThreads);
- final ConcurrentLinkedQueue> queue = new ConcurrentLinkedQueue>();
-
- for (int i = 0; i < nThreads; i++) {
- final int threadId = i;
- Future> f = executor.submit(new Runnable() {
- public void run() {
- for (int i = 0; i < 10000; i++) {
- Element e = new Element(i, "" + i);
- memoryStore.put(e);
-
- assertTrue(threadId + "#" + i + " - " + onHeapPool.getSize(), 16384 * 2 >= onHeapPool.getSize());
-
- Thread.yield();
- if ((i + 1) % 1000 == 0) { dump(); memoryStore.removeAll(); }
- }
- }
- });
- queue.add(f);
- }
-
- while (!queue.isEmpty()) {
- Future> f = queue.poll();
- f.get();
- }
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.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.search.expression;
-
-import java.util.Map;
-
-import net.sf.ehcache.Element;
-import net.sf.ehcache.search.attribute.AttributeExtractor;
-
-/**
- * Criteria for plain "not equals to" condition
- *
- * @author teck
- */
-public class NotEqualTo extends EqualTo {
-
- /**
- * Constructor
- *
- * @param attributeName attribute name
- * @param value
- */
- public NotEqualTo(String attributeName, Object value) {
- super(attributeName, value);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean execute(Element e, Map attributeExtractors) {
- return !super.execute(e, attributeExtractors);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 0)
@@ -1,18 +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;
-
-/**
- * @author cdennis
- */
-public class ExplicitlyUnclusteredStandaloneCacheTest extends AbstractCacheTestBase {
-
- public ExplicitlyUnclusteredStandaloneCacheTest(TestConfig testConfig) {
- super("explicitly-unclustered-cache-test.xml", testConfig, UnclusteredClient.class, UnclusteredClient.class);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0)
@@ -1,12 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async;
-
-import net.sf.ehcache.Ehcache;
-
-public interface AsyncCoordinatorFactory {
- AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config);
-
- boolean destroy(String cacheManagerName, String cacheName);
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ConcurrencyValueTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ConcurrencyValueTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ConcurrencyValueTest.java (revision 0)
@@ -1,56 +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;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-public class ConcurrencyValueTest extends AbstractCacheTestBase {
- private static final int CDM_DEFAULT_CONCURRENCY = 256;
-
- public ConcurrencyValueTest(TestConfig testConfig) {
- super("basic-cache-test.xml", testConfig, Client1.class);
- }
-
- @Override
- protected void evaluateClientOutput(String clientName, int exitCode, File clientOutput) throws Throwable {
- super.evaluateClientOutput(clientName, exitCode, clientOutput);
-
- FileReader fr = null;
- boolean currencyValueLogged1 = false;
- boolean currencyValueLogged2 = false;
- String currencyValueLogMsg1 = getConcurrencyValueLogMsg("defaultConcurrencyCache", CDM_DEFAULT_CONCURRENCY);
- String currencyValueLogMsg2 = getConcurrencyValueLogMsg("configuredConcurrencyCache", 123);
- try {
- fr = new FileReader(clientOutput);
- BufferedReader reader = new BufferedReader(fr);
- String st = "";
- while ((st = reader.readLine()) != null) {
- if (st.contains(currencyValueLogMsg1)) currencyValueLogged1 = true;
- if (st.contains(currencyValueLogMsg2)) currencyValueLogged2 = true;
- }
- } catch (Exception e) {
- throw new AssertionError(e);
- } finally {
- try {
- fr.close();
- } catch (Exception e) {
- //
- }
- }
-
- if (!currencyValueLogged1) { throw new AssertionError(); }
-
- if (!currencyValueLogged2) { throw new AssertionError(); }
- }
-
- private static String getConcurrencyValueLogMsg(String name, int concurrency) {
- return "Cache [" + name + "] using concurrency: " + concurrency;
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0)
@@ -1,440 +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 java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.ehcache.search.Attribute;
-import net.sf.ehcache.search.Direction;
-import net.sf.ehcache.search.ExecutionHints;
-import net.sf.ehcache.search.Query;
-import net.sf.ehcache.search.Results;
-import net.sf.ehcache.search.SearchException;
-import net.sf.ehcache.search.aggregator.Aggregator;
-import net.sf.ehcache.search.aggregator.AggregatorException;
-import net.sf.ehcache.search.aggregator.AggregatorInstance;
-import net.sf.ehcache.search.expression.AlwaysMatch;
-import net.sf.ehcache.search.expression.Criteria;
-import net.sf.ehcache.store.StoreQuery;
-
-/**
- * Query builder implementation. Instances are bound to a specific cache
- *
- * @author teck
- */
-class CacheQuery implements Query, StoreQuery {
-
- private volatile boolean frozen;
- private volatile boolean includeKeys;
- private volatile boolean includeValues;
- private volatile int maxResults = -1;
- private String[] targets;
-
- private final List orderings = Collections.synchronizedList(new ArrayList());
- private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>());
- private final List criteria = Collections.synchronizedList(new ArrayList());
- private final List aggregators = Collections.synchronizedList(new ArrayList());
- private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>());
-
- private final Cache cache;
- private volatile ExecutionHints hints;
-
- /**
- * Create a new builder instance
- *
- * @param cache
- */
- public CacheQuery(Cache cache) {
- this.cache = cache;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query includeKeys() {
- checkFrozen();
- this.includeKeys = true;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query includeValues() {
- checkFrozen();
- this.includeValues = true;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query includeAttribute(Attribute>... attributes) {
- checkFrozen();
-
- if (attributes == null) {
- throw new NullPointerException();
- }
-
- for (Attribute> attribute : attributes) {
- if (attribute == null) {
- throw new NullPointerException("null attribute");
- }
-
- this.includedAttributes.add(attribute);
- }
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException {
- checkFrozen();
-
- if (aggregators == null) {
- throw new NullPointerException();
- }
-
- for (Aggregator aggregator : aggregators) {
- if (aggregator == null) {
- throw new NullPointerException("null aggregator");
- }
-
- this.aggregators.add(aggregator);
- }
-
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query addOrderBy(Attribute> attribute, Direction direction) {
- checkFrozen();
- this.orderings.add(new OrderingImpl(attribute, direction));
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query addGroupBy(Attribute>... attributes) {
- checkFrozen();
-
- if (attributes == null) {
- throw new NullPointerException();
- }
-
- for (Attribute> attribute : attributes) {
- if (attribute == null) {
- throw new NullPointerException("null attribute");
- }
- groupByAttributes.add(attribute);
- }
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query maxResults(int maxResults) {
- checkFrozen();
- this.maxResults = maxResults;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Query addCriteria(Criteria criteria) {
- checkFrozen();
-
- if (criteria == null) {
- throw new NullPointerException("null criteria");
- }
-
- this.criteria.add(criteria);
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public Results execute() throws SearchException {
- return cache.executeQuery(snapshot());
- }
-
- /**
- * {@inheritDoc}
- */
- public Results execute(ExecutionHints params) throws SearchException {
- this.hints = params;
- return cache.executeQuery(snapshot());
- }
-
-
- /**
- * {@inheritDoc}
- */
- public Query end() {
- frozen = true;
- return this;
- }
-
- /**
- * {@inheritDoc}
- */
- public List getOrdering() {
- assertFrozen();
- return Collections.unmodifiableList(orderings);
- }
-
- /**
- * {@inheritDoc}
- */
- public Criteria getCriteria() {
- assertFrozen();
- return getEffectiveCriteriaCopy();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean requestsKeys() {
- assertFrozen();
- return includeKeys;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean requestsValues() {
- assertFrozen();
- return includeValues;
- }
-
- /**
- * {@inheritDoc}
- */
- public Cache getCache() {
- assertFrozen();
- return cache;
- }
-
- /**
- * {@inheritDoc}
- */
- public Set> requestedAttributes() {
- assertFrozen();
- return Collections.unmodifiableSet(this.includedAttributes);
- }
-
- /**
- * {@inheritDoc}
- */
- public Set> groupByAttributes() {
- assertFrozen();
- return Collections.unmodifiableSet(this.groupByAttributes);
- }
-
- /**
- * {@inheritDoc}
- */
- public int maxResults() {
- assertFrozen();
- return maxResults;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public ExecutionHints getExecutionHints() {
- assertFrozen();
- return hints;
- }
-
- /**
- * {@inheritDoc}
- */
- public List getAggregators() {
- return Collections.unmodifiableList(this.aggregators);
- }
-
- /**
- * {@inheritDoc}
- */
- public List> getAggregatorInstances() {
- assertFrozen();
- return Collections.unmodifiableList(createAggregatorInstances(aggregators));
- }
-
- private static List> createAggregatorInstances(List aggregators) {
- List> rv = new ArrayList>(aggregators.size());
- for (Aggregator aggregator : aggregators) {
- rv.add(aggregator.createInstance());
- }
-
- return rv;
- }
-
- private Criteria getEffectiveCriteriaCopy() {
- Criteria result = new AlwaysMatch();
- for (Criteria c : criteria) {
- result = result.and(c);
- }
- return result;
- }
-
- private void assertFrozen() {
- if (!frozen) {
- throw new AssertionError("not frozen");
- }
- }
-
- private StoreQuery snapshot() {
- if (frozen) {
- return this;
- }
-
- return new StoreQueryImpl();
- }
-
- private void checkFrozen() {
- if (frozen) {
- throw new SearchException("Query is frozen and cannot be mutated");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getTargets() {
- return this.targets;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void targets(final String[] targets) {
- this.targets = targets;
- }
-
- /**
- * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder
- */
- private class StoreQueryImpl implements StoreQuery {
- private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy();
- private final boolean copiedIncludeKeys = includeKeys;
- private final boolean copiedIncludeValues = includeValues;
- private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes));
- private final int copiedMaxResults = maxResults;
- private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings));
- private final List copiedAggregators = Collections.unmodifiableList(aggregators);
- private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators));
- private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes));
- private final ExecutionHints execHints = hints;
-
- public Criteria getCriteria() {
- return copiedCriteria;
- }
-
- public boolean requestsKeys() {
- return copiedIncludeKeys;
- }
-
- public boolean requestsValues() {
- return copiedIncludeValues;
- }
-
- public Cache getCache() {
- return cache;
- }
-
- public Set> requestedAttributes() {
- return copiedAttributes;
- }
-
- public Set> groupByAttributes() {
- return copiedGroupByAttributes;
- }
-
- public int maxResults() {
- return copiedMaxResults;
- }
-
- public List getOrdering() {
- return copiedOrdering;
- }
-
- public List getAggregators() {
- return copiedAggregators;
- }
-
- public List> getAggregatorInstances() {
- return copiedAggregatorInstances;
- }
-
- public String[] getTargets() {
- return targets;
- }
-
- /**
- * {@inheritDoc}
- */
- public void targets(String[] targets) {
- CacheQuery.this.targets = targets;
- }
-
- public ExecutionHints getExecutionHints() {
- return execHints;
- }
- }
-
- /**
- * An attribute/direction pair
- */
- private static class OrderingImpl implements Ordering {
-
- private final Attribute> attribute;
- private final Direction direction;
-
- public OrderingImpl(Attribute> attribute, Direction direction) {
- if ((attribute == null) || (direction == null)) {
- throw new NullPointerException();
- }
-
- this.attribute = attribute;
- this.direction = direction;
- }
-
- public Attribute> getAttribute() {
- return attribute;
- }
-
- public Direction getDirection() {
- return direction;
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/distribution.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/distribution.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/distribution.xml (revision 0)
@@ -1,45 +0,0 @@
-
- distribution
-
- tar.gz
-
-
-
-
-
-
-
-
-
-
-
- ${basedir}/src
- /src
-
-
- ${project.build.directory}/${project.name}
-
- **/ehcache*.jar
- **/terracotta-toolkit*-runtime*.jar
-
- /webapps/${project.name}
-
-
- ${basedir}/src/assemble
-
- README.*
-
- /
-
-
- ${basedir}/src/assemble/jetty6.1
- /jetty6.1
-
-
- ${basedir}/src/assemble/bin
- /bin
- 0755
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 0)
@@ -1,425 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapTTLExpressTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapTTLExpressTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapTTLExpressTest.java (revision 0)
@@ -1,33 +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 ServerMapTTLExpressTest extends AbstractCacheTestBase {
-
- public ServerMapTTLExpressTest(TestConfig testConfig) {
- super("/servermap/basic-servermap-cache-test.xml", testConfig, ServerMapTTLExpressTestClient.class);
- testConfig.setDgcEnabled(true);
- testConfig.setDgcIntervalInSec(60);
- testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true");
-
- // L1 properties
- 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 disable localcache for this test
- iter.remove();
- }
- }
- // always disable local cache
- testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.storageStrategy.dcv2.localcache.enabled=false");
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionIDSerializedForm.java (revision 0)
@@ -1,110 +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;
-
-import net.sf.ehcache.CacheManager;
-
-import java.io.Serializable;
-
-/**
- * A replacement serialized form for transaction IDs. It can be used by transaction ID factories
- * to create IDs that serialize to this form (using writeReplace()) if they don't want or cannot
- * provide directly serializable IDs.
- *
- * During deserialization, objects of this class will be replaced by the result of the
- * CacheManager.restoreTransactionID() call.
- *
- * @author Ludovic Orban
- */
-public class TransactionIDSerializedForm implements Serializable {
- private final String cacheManagerName;
- private final String clusterUUID;
- private final String ownerID;
- private final long creationTime;
- private final int id;
-
- /**
- * Constructor
- *
- * @param cacheManagerName the name of the cache manager which contains the factory
- * that created the original TransactionID
- * @param clusterUUID the TransactionID's cluster UUID
- * @param creationTime the TransactionID's creation time
- * @param id the TransactionID's internal ID
- */
- public TransactionIDSerializedForm(String cacheManagerName, String clusterUUID, String ownerID, long creationTime, int id) {
- this.cacheManagerName = cacheManagerName;
- this.clusterUUID = clusterUUID;
- this.ownerID = ownerID;
- this.creationTime = creationTime;
- this.id = id;
- }
-
- /**
- * Get the name of the cache manager which contains the factory that created the
- * original TransactionID
- *
- * @return the cache manager name
- */
- public String getCacheManagerName() {
- return cacheManagerName;
- }
-
- /**
- * Get the original TransactionID's cluster UUID
- *
- * @return the original TransactionID's cluster UUID
- */
- public String getClusterUUID() {
- return clusterUUID;
- }
-
- /**
- * Get the original TransactionID's owner id
- *
- * @return the original TransactionID's owner id
- */
- public String getOwnerID() {
- return ownerID;
- }
-
- /**
- * Get the original TransactionID's creation time
- *
- * @return the original TransactionID's creation time
- */
- public long getCreationTime() {
- return creationTime;
- }
-
- /**
- * Get the original TransactionID's internal ID
- *
- * @return the original TransactionID's internal ID
- */
- public int getId() {
- return id;
- }
-
- private Object readResolve() {
- CacheManager cacheManager = CacheManager.getCacheManager(cacheManagerName);
- if (cacheManager == null) {
- throw new TransactionException("unable to restore transaction ID from " + cacheManagerName);
- }
- return cacheManager.getOrCreateTransactionIDFactory().restoreTransactionID(this);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 0)
@@ -1,113 +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.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.DiskStoreConfiguration;
-import net.sf.ehcache.config.MemoryUnit;
-import net.sf.ehcache.config.PersistenceConfiguration;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.terracotta.test.categories.CheckShorts;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-@Category(CheckShorts.class)
-@RunWith(Parameterized.class)
-public class CacheCopyOnRwReplaceRemoveTest {
-
- public static final String MEMORY_CACHE = "memoryCache";
- public static final String DISK_CACHE = "diskCache";
-
- @Parameters(name = "copyOnRead:{0}, copyOnWrite:{1}")
- public static Collection data() {
- Object[][] data = new Object[][] { { true, false }, { false, true }, { true, true } };
- return Arrays.asList(data);
- }
-
- private final boolean copyOnRead;
- private final boolean copyOnWrite;
-
- private CacheManager cacheManager;
-
- public CacheCopyOnRwReplaceRemoveTest(boolean copyOnRead, boolean copyOnWrite) {
- this.copyOnRead = copyOnRead;
- this.copyOnWrite = copyOnWrite;
- }
-
- @Before
- public void setUp() throws Exception {
- cacheManager = CacheManager.create( new Configuration()
- .name("copyOnRWReplaceRemoveManager")
- .diskStore(new DiskStoreConfiguration().path(System.getProperty("java.io.tmpdir")))
- .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES)
- .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES));
- cacheManager.addCache(new Cache(new CacheConfiguration().name(MEMORY_CACHE)
- .copyOnRead(copyOnRead)
- .copyOnWrite(copyOnWrite)));
- cacheManager.addCache(new Cache(new CacheConfiguration().name(DISK_CACHE)
- .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP))
- .copyOnRead(copyOnRead)
- .copyOnWrite(copyOnWrite)));
- }
-
- @After
- public void tearDown() {
- cacheManager.shutdown();
- }
-
- @Test
- public void testMemoryCache() throws Exception {
- Ehcache cache = cacheManager.getCache(MEMORY_CACHE);
- testReplaceElement(cache);
- testRemoveElement(cache);
- }
-
- @Test
- public void testDiskCache() throws Exception {
- Ehcache cache = cacheManager.getCache(DISK_CACHE);
- testReplaceElement(cache);
- testRemoveElement(cache);
- }
-
- private void testReplaceElement(Ehcache cache) {
- Long key = System.nanoTime();
- String value = "value" + key;
- cache.put(new Element(new Long(key), new String(value)));
- Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue());
- String nextValue = value + "1";
- Assert.assertTrue(cache.replace(new Element(new Long(key), new String(value)), new Element(new Long(key), new String(nextValue))));
- }
-
- private void testRemoveElement(Ehcache cache) {
- Long key = System.nanoTime();
- String value = "value" + key;
- cache.put(new Element(new Long(key), new String(value)));
- Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue());
- Assert.assertTrue(cache.removeElement(new Element(new Long(key), new String(value))));
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.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;
-
-import net.sf.ehcache.config.generator.model.NodeAttribute;
-import net.sf.ehcache.config.generator.model.NodeElement;
-import net.sf.ehcache.config.generator.xsom.XSDAttributeValueFactory;
-import net.sf.ehcache.config.generator.xsom.XSDAttributeValueType;
-
-public class StandaloneEntryBasedConfigAttributesValueFactory implements XSDAttributeValueFactory {
-
- public String createValueForAttribute(NodeElement element, NodeAttribute attribute, XSDAttributeValueType xsdAttributeValueType) {
- if ("terracotta".equals(element.getName())) {
- if("coherent".equals(attribute.getName())) {
- // returning null will skip this attribute
- // can skip "coherent" attribute as its deprecated by consistency attribute
- return null;
- }
- if("clustered".equals(attribute.getName())) {
- return "false";
- }
- }
- if ("pinning".equals(element.getName())) {
- if ("storage".equals(attribute.getName())) {
- return "inMemory";
- }
- }
- if ("sizeOfPolicy".equals(element.getName())) {
- if ("maxDepth".equals(attribute.getName())) {
- return "100";
- } else if ("maxDepthExceededBehavior".equals(attribute.getName())) {
- return "continue";
- }
- }
- // always generate with eternal=false
- if ("defaultCache".equals(element.getName()) || "cache".equals(element.getName())) {
- if("eternal".equals(attribute.getName())) {
- return "false";
- }
- if("transactionalMode".equals(attribute.getName())) {
- return "off";
- }
- // these are deprecated
- if ("maxElementsInMemory".equals(attribute.getName()) ||
- "maxMemoryOffHeap".equals(attribute.getName()) ||
- "diskPersistent".equals(attribute.getName()) ||
- "overflowToDisk".equals(attribute.getName())) {
- return null;
- }
- if ("maxElementsOnDisk".equals(attribute.getName()) ||
- "maxBytesLocalHeap".equals(attribute.getName()) ||
- "maxBytesLocalOffHeap".equals(attribute.getName()) ||
- "maxBytesLocalDisk".equals(attribute.getName())) {
- return null;
- }
- if("maxEntriesLocalHeap".equals(attribute.getName()) ||
- "maxEntriesLocalOffHeap".equals(attribute.getName()) ||
- "maxEntriesLocalDisk".equals(attribute.getName())) {
- return "10000";
- }
- if("maxEntriesInCache".equals(attribute.getName())) {
- return null;
- }
- }
- if ("ehcache".equals(element.getName())) {
- if("maxBytesLocalHeap".equals(attribute.getName()) ||
- "maxBytesLocalOffHeap".equals(attribute.getName()) ||
- "maxBytesLocalDisk".equals(attribute.getName())) {
- return null;
- }
- }
- if ("searchAttribute".equals(element.getName())) {
- if ("expression".equals(attribute.getName())) {
- return "value.toString()";
- } else if ("name".equals(attribute.getName())) {
- return "name";
- } else {
- return null;
- }
- }
-
- return xsdAttributeValueType.getRandomAllowedValue();
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/terracotta/RotatingSnapshotFileTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/terracotta/RotatingSnapshotFileTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/terracotta/RotatingSnapshotFileTest.java (revision 0)
@@ -1,192 +0,0 @@
-package net.sf.ehcache.terracotta;
-
-import net.sf.ehcache.DiskStorePathManager;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicReference;
-
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.hamcrest.core.IsCollectionContaining.hasItem;
-import static org.hamcrest.core.IsNot.not;
-import static org.hamcrest.number.OrderingComparison.greaterThan;
-import static org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Alex Snaps
- */
-public class RotatingSnapshotFileTest {
-
- @Rule
- public final TemporaryFolder directory = new TemporaryFolder();
-
- private final ClassLoader loader = getClass().getClassLoader();
-
- @Test
- public void testSuccessfulWrite() throws IOException {
- RotatingSnapshotFile snapshotFile = new RotatingSnapshotFile(new DiskStorePathManager(directory.getRoot().getAbsolutePath()), "test", loader);
- Set keys = populateWithValues(snapshotFile, 100);
- assertThat(snapshotFile.currentSnapshotFile().exists(), is(true));
- assertThat(snapshotFile.tempSnapshotFile().exists(), is(false));
- assertThat(snapshotFile.newSnapshotFile().exists(), is(false));
- assertThat(snapshotFile.currentSnapshotFile().length(), greaterThan(0L));
- assertThat(snapshotFile.readAll(), equalTo(keys));
- }
-
- @Test
- public void testStopsOnThreadInterrupted() throws IOException, InterruptedException {
- final RotatingSnapshotFile file = new RotatingSnapshotFile(new DiskStorePathManager(directory.getRoot().getAbsolutePath()), "killMe", loader);
- final AtomicReference throwable = new AtomicReference();
- Set keys = populateWithValues(file, 100);
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- assertThat(file.newSnapshotFile().exists(), is(false));
-
- final CountDownLatch latch = new CountDownLatch(100);
- Thread writerThread = new Thread() {
-
- int valuesAskedWhileInterrupted = 0;
-
- @Override
- public void run() {
- try {
- file.writeAll(new Iterable() {
- public Iterator iterator() {
- return new Iterator() {
- public boolean hasNext() {
- if (isInterrupted() && ++valuesAskedWhileInterrupted > 1) {
- throwable.set(new AssertionError("We shouldn't be asked for more values by now!"));
- return false;
- }
- return true;
- }
-
- public String next() {
- latch.countDown();
- return UUID.randomUUID().toString();
- }
-
- public void remove() {
- // Just don't do anything...
- }
- };
- }
- });
- } catch (Throwable e) {
- throwable.set(e);
- }
- }
- };
-
- writerThread.start();
- latch.await();
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(true));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- file.setShutdownOnThreadInterrupted(true);
- writerThread.interrupt();
- writerThread.join();
- assertThat(throwable.get(), nullValue());
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(true));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- assertThat(file.readAll(), equalTo(keys));
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(false));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- }
-
- @Test
- public void testFinishesOnThreadInterrupted() throws IOException, InterruptedException {
- final RotatingSnapshotFile file = new RotatingSnapshotFile(new DiskStorePathManager(directory.getRoot().getAbsolutePath()), "killMe", loader);
- final AtomicReference throwable = new AtomicReference();
- Set keys = populateWithValues(file, 100);
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- assertThat(file.newSnapshotFile().exists(), is(false));
-
- final CountDownLatch latch = new CountDownLatch(100);
- final int keyAmount = 100;
- final String keyPrefix = "Finish with value ";
- Thread writerThread = new Thread() {
-
- int valuesToDispenseOnceInterrupted = keyAmount;
-
- @Override
- public void run() {
- try {
- file.writeAll(new Iterable() {
- public Iterator iterator() {
- return new Iterator() {
- public boolean hasNext() {
- return !isInterrupted() || valuesToDispenseOnceInterrupted > 0;
- }
-
- public Object next() {
- if (isInterrupted()) {
- return keyPrefix + (valuesToDispenseOnceInterrupted--);
- } else {
- latch.countDown();
- return UUID.randomUUID();
- }
- }
-
- public void remove() {
- // Just don't do anything...
- }
- };
- }
- });
- } catch (Throwable e) {
- throwable.set(e);
- }
- }
- };
-
- writerThread.start();
- latch.await();
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(true));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- writerThread.interrupt();
- writerThread.join();
- assertThat(throwable.get(), nullValue());
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(false));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- final Set values = file.readAll();
- for (Object key : keys) {
- assertThat(values, not(hasItem(key)));
- }
- for (int i = 1; i <= keyAmount; i++) {
- assertThat(values, hasItem(keyPrefix + i));
- }
- assertThat(values, not(hasItem(keyPrefix + 0)));
- assertThat(values, hasSize(greaterThanOrEqualTo(keyAmount)));
- assertThat(file.currentSnapshotFile().exists(), is(true));
- assertThat(file.newSnapshotFile().exists(), is(false));
- assertThat(file.tempSnapshotFile().exists(), is(false));
- }
-
- private Set populateWithValues(RotatingSnapshotFile snapshotFile, int amount) throws IOException {
- Set keys = new HashSet();
- for (int i = 0; i < amount; i++) {
- keys.add("SomeKey that contains something " + i);
- }
-
- snapshotFile.writeAll(keys);
- return keys;
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm (revision 0)
@@ -1,44 +0,0 @@
-
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl getXATransactionDecision
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD getXATransactionDecision
-AT EXIT
-IF true
-DO traceln("[ehcache txns facade] getXATransactionDecision - key.hashCode(): " + $key.hashCode() + " returning:-> " + $!);
-ENDRULE
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl updateXATransactionDecision
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD updateXATransactionDecision
-AT EXIT
-IF true
-DO traceln("[ehcache txns facade] updateXATransactionDecision - key.hashCode(): " + $key.hashCode() + ", newDecision: " + $newDecision);
-ENDRULE
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl getSoftLockState
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD getSoftLockState
-AT EXIT
-IF true
-DO traceln("[ehcache txns facade] getSoftLockState - key.hashCode(): " + $key.hashCode() + " returning:-> " + $!);
-ENDRULE
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl updateSoftLockState
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD updateSoftLockState
-AFTER INVOKE put
-IF true
-DO traceln("[ehcache txns facade] updateSoftLockState, after put - key.hashCode(): " + $key.hashCode() + ", newSoftLockState: " + $newSoftLockState);
-AT EXIT
-IF true
-DO traceln("[ehcache txns facade] updateSoftLockState, returning for key.hashCode(): " + $key.hashCode() + " returning:-> " + $!);
-ENDRULE
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl isExpired
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD isExpired
-AT EXIT
-IF true
-DO traceln("[ehcache txns facade] isExpired - softLockId.hashCode(): " + serializeToString($softLockId).hashCode() + " returning:-> " + $!);
-ENDRULE
Index: rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/scatterpolicies/SingleBucketScatterPolicy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/scatterpolicies/SingleBucketScatterPolicy.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/scatterpolicies/SingleBucketScatterPolicy.java (revision 0)
@@ -1,15 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async.scatterpolicies;
-
-
-import java.io.Serializable;
-
-public class SingleBucketScatterPolicy implements ItemScatterPolicy {
-
- public int selectBucket(final int count, final E item) {
- return 0;
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 0)
@@ -1,159 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.lifecycle;
-
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ConfigurationFactory;
-import net.sf.ehcache.config.TerracottaConfiguration;
-
-import org.mockito.Mockito;
-import org.objenesis.ObjenesisStd;
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.test.util.TestBaseUtil;
-import org.terracotta.toolkit.Toolkit;
-
-import com.tc.test.config.model.TestConfig;
-import com.terracotta.entity.ClusteredEntityManager;
-import com.terracotta.entity.ehcache.ClusteredCacheManager;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-
-public class CacheManagerDestroyCrashTest extends AbstractCacheTestBase {
- private static final String CACHE_NAME = "cache1";
-
- public CacheManagerDestroyCrashTest(TestConfig testConfig) {
- super("lifecycle/cache-destroy.xml", testConfig, CacheManagerCreateClient.class,
- CacheManagerEntityDestroyCrashClient.class);
- }
-
- @Override
- protected String createClassPath(Class client) throws IOException {
- String classpath = super.createClassPath(client);
- classpath = addToClasspath(classpath, TestBaseUtil.jarFor(Mockito.class));
- classpath = addToClasspath(classpath, TestBaseUtil.jarFor(ObjenesisStd.class));
- return classpath;
- }
-
- public static class CacheManagerCreateClient extends ClientBase {
-
- public CacheManagerCreateClient(String[] mainArgs) {
- super(mainArgs);
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable {
-
- CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, 100)
- .terracotta(new TerracottaConfiguration());
- cacheManager.addCache(new Cache(cacheConfig));
- cache = cacheManager.getCache(CACHE_NAME);
- cache.put(new Element("key", "value", true));
-
- cacheManager.shutdown();
-
- // Notify client to destroy
- getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 1
-
- // Waiting for other client to signal destroy done
- getBarrierForAllClients().await(1, TimeUnit.MINUTES); // hit 2
-
- // Making sure adding back cache does not resurrect old data structures
- setupCacheManager();
- cacheManager.addCache(new Cache(cacheConfig));
- cache = cacheManager.getCache(CACHE_NAME);
- assertNull(cache.get("key"));
- }
-
- @Override
- protected Cache getCache() {
- return null;
- }
-
- }
-
- public static class CacheManagerEntityDestroyCrashClient extends ClientBase {
-
- public CacheManagerEntityDestroyCrashClient(String[] mainArgs) {
- super(mainArgs);
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable {
- // Waiting for CM to be created
-
- waitForAllClients(); // hit 1
-
- Toolkit spiedToolkit = spy(getClusteringToolkit());
-
- ClusteredEntityManager clusteredEntityManager1 = new ClusteredEntityManager(spiedToolkit);
- Configuration configuration = ConfigurationFactory.parseConfiguration(getEhcacheXmlAsStream());
- String cmName = configuration.getName();
-
- Map cacheManagers = clusteredEntityManager1
- .getRootEntities(ClusteredCacheManager.class);
-
- ClusteredCacheManager clusteredCacheManager = cacheManagers.get(cmName);
-
- while(clusteredCacheManager.isUsed()) {
- TimeUnit.MILLISECONDS.sleep(200);
- }
-
-
- doThrow(new TestDestroyCrashException("Crashing destroy"))
- .when(spiedToolkit)
- .getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class));
- try {
- clusteredEntityManager1.destroyRootEntity(cmName, ClusteredCacheManager.class, clusteredCacheManager);
- fail("Destroy should have thrown an exception");
- } catch(TestDestroyCrashException e) {
- // Expected as we want destroy to crash
- e.printStackTrace();
- }
- reset(spiedToolkit);
-
- clusteredEntityManager1.getRootEntity(cmName, ClusteredCacheManager.class);
- // Shows inline clean up performed
- verify(spiedToolkit).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class));
-
- reset(spiedToolkit);
-
- ClusteredEntityManager clusteredEntityManager2 = new ClusteredEntityManager(spiedToolkit);
- assertNull(clusteredEntityManager2.getRootEntity(cmName, ClusteredCacheManager.class));
-
- verify(spiedToolkit, never()).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class));
-
- getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 2
- }
-
- @Override
- protected void setupCacheManager() {
- // Do nothing here
- }
-
- @Override
- protected Cache getCache() {
- // Do nothing here
- return null;
- }
- }
-
- public static class TestDestroyCrashException extends RuntimeException {
- public TestDestroyCrashException(String msg) {
- super(msg);
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 0)
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 0)
@@ -1,93 +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.cluster;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Allows you to explore the Terracotta cluster nodes and register for events about the cluster.
- *
- * @author Geert Bevin, Abhishek Sanoujam
- * @since 2.0
- */
-public interface CacheCluster {
-
- /**
- * Get scheme name for this cluster info.
- *
- * @return a scheme name for the cluster information.
- * Currently TERRACOTTA
is the only scheme supported.
- */
- ClusterScheme getScheme();
-
- /**
- * Retrieves the {@code ClusterNode} instance that corresponds to the current node.
- *
- * @return the {@code ClusterNode} instance that corresponds to the current node
- */
- ClusterNode getCurrentNode();
-
- /**
- * Waits until the current node has successfully joined the cluster.
- *
- * @return the {@code ClusterNode} instance that corresponds to the current node
- */
- ClusterNode waitUntilNodeJoinsCluster();
-
- /**
- * Get all the nodes in the cluster
- *
- * @return information on all the nodes in the cluster, including ID, hostname, and IP address.
- */
- Collection getNodes();
-
- /**
- * Find out if the current node is connected to the cluster or not
- *
- * @return true if cluster is online otherwise false
- */
- boolean isClusterOnline();
-
- /**
- * Add a listener for cluster events
- *
- * @param listener Listener
- * @return True if already listening
- */
- boolean addTopologyListener(ClusterTopologyListener listener);
-
- /**
- * Remove a listener for cluster events
- *
- * @param listener Listener
- * @return True if not listening
- */
- boolean removeTopologyListener(ClusterTopologyListener listener);
-
- /**
- * Removes all listeners for cluster events
- */
- void removeAllListeners();
-
- /**
- * Get all the topology listeners
- *
- * @return a list of all the topology listeners
- */
- List getTopologyListeners();
-}
Index: rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 0)
@@ -1,73 +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.management.resource.CacheConfigEntity;
-import net.sf.ehcache.management.sampled.CacheManagerSampler;
-import org.terracotta.management.resource.AgentEntity;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author brandony
- */
-final class CacheConfigurationEntityBuilder {
-
- private final Map samplersByCName = new HashMap();
-
- static CacheConfigurationEntityBuilder createWith(CacheManagerSampler sampler,
- String cacheName) {
- return new CacheConfigurationEntityBuilder(sampler, cacheName);
- }
-
- private CacheConfigurationEntityBuilder(CacheManagerSampler sampler,
- String cacheName) {
- addSampler(sampler, cacheName);
- }
-
- CacheConfigurationEntityBuilder add(CacheManagerSampler sampler,
- String cacheName) {
- addSampler(sampler, cacheName);
- return this;
- }
-
- Collection build() {
- Collection cces = new ArrayList();
-
- for (Map.Entry entry : samplersByCName.entrySet()) {
- CacheConfigEntity cce = new CacheConfigEntity();
-
- String cacheName = entry.getKey();
- cce.setCacheName(cacheName);
- cce.setAgentId(AgentEntity.EMBEDDED_AGENT_ID);
- cce.setVersion(this.getClass().getPackage().getImplementationVersion());
-
- CacheManagerSampler sampler = entry.getValue();
- cce.setCacheManagerName(sampler.getName());
- cce.setXml(sampler.generateActiveConfigDeclaration(cacheName));
-
- cces.add(cce);
- }
-
- return cces;
- }
-
- private void addSampler(CacheManagerSampler sampler,
- String cacheName) {
- if (sampler == null) throw new IllegalArgumentException("sampler == null");
-
- if (cacheName == null) throw new IllegalArgumentException("cacheName == null");
-
- if(!Arrays.asList(sampler.getCacheNames()).contains(cacheName)) {
- throw new IllegalArgumentException(String.format("Invalid cache name: %s.", cacheName));
- }
-
- samplersByCName.put(cacheName, sampler);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/bin/package.sh
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/bin/package.sh (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/colorcache/src/assemble/bin/package.sh (revision 0)
@@ -1,53 +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
-
-appname=colorcache
-
-
-unset CDPATH
-root=`dirname $0`/..
-root=`cd $root && pwd`
-
-jetty1=$root/jetty6.1/9081
-jetty2=$root/jetty6.1/9082
-webapp_lib=$root/webapps/$appname/WEB-INF/lib
-
-tc_install_dir=$root/bin/`$root/bin/relative-paths.sh tc_install_dir`
-ehcache_jars_dir=$root/bin/`$root/bin/relative-paths.sh ehcache_jars_dir`
-
-# package ehcache-core and ehcache-terracotta
-cp $ehcache_jars_dir/lib/ehcache*.jar $webapp_lib
-
-# package toolkit runtime. It could be in 2 different places depending on which kit (ehcache vs tc)
-toolkit_runtime=$tc_install_dir/common/terracotta-toolkit*-runtime*.jar
-
-if [ ! -f $toolkit_runtime ]; then
- # not found under 'common', try 'lib'
- toolkit_runtime=$ehcache_jars_dir/lib/terracotta-toolkit*-runtime*.jar
- if [ ! -f $toolkit_runtime ]; then
- echo "Couldn't locate toolkit runtime jar"
- exit 1
- fi
-fi
-
-cp $toolkit_runtime $webapp_lib
-
-if [ $? -eq 0 ]; then
- echo "Deploying demo..."
- cp -r $root/webapps $jetty1
- cp -r $root/webapps $jetty2
- echo "Done."
- exit 0
-else
- echo "Error packaging the sample"
- exit 1
-fi
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/services/net.sf.ehcache.pool.SizeOfEngineFactory.txt
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/services/net.sf.ehcache.pool.SizeOfEngineFactory.txt (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/services/net.sf.ehcache.pool.SizeOfEngineFactory.txt (revision 0)
@@ -1 +0,0 @@
-net.sf.ehcache.pool.SizeOfEngineLoaderTest$MyRealFactory
\ No newline at end of file
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 0)
@@ -1,77 +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.impl;
-
-import java.util.Map;
-
-import net.sf.ehcache.store.StoreQuery;
-
-/**
- * Result implementation
- *
- * @author teck
- */
-public class ResultImpl extends BaseResult {
-
- private final Object key;
- private final Object value;
- private final Map attributes;
- private final Object[] sortAttributes;
-
- /**
- * Constructor
- *
- * @param key
- * @param value
- * @param query
- * @param attributes
- * @param sortAttributes
- */
- public ResultImpl(Object key, Object value, StoreQuery query, Map attributes, Object[] sortAttributes) {
- super(query);
- this.key = key;
- this.value = value;
- this.attributes = attributes;
- this.sortAttributes = sortAttributes;
- }
-
- /**
- * Get attribute value for use in sorting
- *
- * @param pos
- * @return
- */
- Object getSortAttribute(int pos) {
- return sortAttributes[pos];
- }
-
- @Override
- protected Object basicGetKey() {
- return key;
- }
-
- @Override
- protected Object basicGetValue() {
- return value;
- }
-
- @Override
- protected Object basicGetAttribute(String name) {
- return attributes.get(name);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 0)
@@ -1,55 +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.ByteArrayInputStream;
-import java.io.UnsupportedEncodingException;
-
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.CacheManager;
-
-import org.junit.Test;
-
-public class ConfigurationGeneratedParsesTest {
-
- private static final String[] TEST_CONFIGS = new String[] {
- "ehcache.xml",
- "ehcache-big.xml",
- "ehcache-cacheextension.xml",
- "ehcache-comparator.xml",
- "ehcache-countinglisteners.xml",
- "ehcache-search.xml",
- "ehcache-tx-local.xml",
- "ehcache-tx-twopc.xml",
- "ehcache-writer.xml",
- "ehcacheUTF8.xml",
- };
-
- @Test
- public void testGeneratedConfigIsValid() throws CacheException, UnsupportedEncodingException {
- for (String config : TEST_CONFIGS) {
- String generatedConfig;
- CacheManager manager = new CacheManager(ConfigurationGeneratedParsesTest.class.getClassLoader().getResource(config));
- try {
- generatedConfig = manager.getActiveConfigurationText();
- } finally {
- manager.shutdown();
- }
- new CacheManager(new ByteArrayInputStream(generatedConfig.getBytes("UTF-8"))).shutdown();
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/refreshahead/StringifyCacheLoaderFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/refreshahead/StringifyCacheLoaderFactory.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/refreshahead/StringifyCacheLoaderFactory.java (revision 0)
@@ -1,95 +0,0 @@
-package net.sf.ehcache.constructs.refreshahead;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Status;
-import net.sf.ehcache.loader.CacheLoader;
-import net.sf.ehcache.loader.CacheLoaderFactory;
-
-public class StringifyCacheLoaderFactory extends CacheLoaderFactory {
-
- @Override
- public CacheLoader createCacheLoader(Ehcache cache, Properties properties) {
- return new StringifyCacheLoader(properties);
- }
-
- public static class StringifyCacheLoader implements CacheLoader {
-
- private long delayMS = 0;
-
- public StringifyCacheLoader(Properties properties) {
- if (properties != null) {
- delayMS = Long.parseLong(properties.getProperty("delayMS", "0"));
- }
- }
-
- @Override
- public Map loadAll(Collection keys, Object argument) {
- return loadAll(keys);
- }
-
- @Override
- public Map loadAll(Collection keys) {
- try {
- Thread.sleep(delayMS);
- } catch (InterruptedException e) {
-
- }
- HashMap ret=new HashMap();
- for(Object k:keys) {
- ret.put(k, k.toString());
- }
- return ret;
- }
-
- @Override
- public Object load(Object key, Object argument) {
- return load(key);
- }
-
- @Override
- public Object load(Object key) throws CacheException {
- try {
- Thread.sleep(delayMS);
- } catch (InterruptedException e) {
-
- }
- return key.toString();
- }
-
- @Override
- public void init() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Status getStatus() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void dispose() throws CacheException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public CacheLoader clone(Ehcache cache) throws CloneNotSupportedException {
- // TODO Auto-generated method stub
- return null;
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 0)
@@ -1,89 +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;
-
-public class MOrderBy {
-
- /**
- * The attr.
- */
- private final MAttribute attr;
-
- /**
- * The asc.
- */
- private final boolean asc;
-
- /**
- * Instantiates a new model order by.
- *
- * @param attr the attr
- * @param asc the asc
- */
- public MOrderBy(MAttribute attr, boolean asc) {
- this.attr = attr;
- this.asc = asc;
- }
-
- /**
- * Gets the attribute.
- *
- * @return the attribute
- */
- public MAttribute getAttribute() {
- return attr;
- }
-
- /**
- * Checks if is order ascending.
- *
- * @return true, if is order ascending
- */
- public boolean isOrderAscending() {
- return asc;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "order by " + attr + (asc ? " ascending" : " descending");
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (asc ? 1231 : 1237);
- result = prime * result + ((attr == null) ? 0 : attr.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;
- MOrderBy other = (MOrderBy)obj;
- if (asc != other.asc) return false;
- if (attr == null) {
- if (other.attr != null) return false;
- } else if (!attr.equals(other.attr)) return false;
- return true;
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 0)
@@ -1,73 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.async;
-
-
-import org.terracotta.toolkit.concurrent.locks.ToolkitLock;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-public class LockHolder {
- private static final int PARTIES = 2;
- private final Map holdings = new HashMap();
-
- public synchronized void hold(final ToolkitLock lock) {
- if (lock == null || holdings.containsKey(lock)) { return; }
- final CyclicBarrier barrier = new CyclicBarrier(PARTIES);
- Thread lockThread = new Thread(new Runnable() {
- @Override
- public void run() {
- lock.lock();
- try {
- await(barrier); // hit 1
- await(barrier); // hit 2
- } finally {
- try {
- lock.unlock();
- } catch (Throwable th) {
- // ignore any exception in unlock so that thread calling release() is not stuck at barrier.await()
- }
- await(barrier); // hit 3
- }
- }
- });
- holdings.put(lock.getName(), barrier);
- lockThread.start();
- await(barrier); // hit 1
- }
-
- public synchronized void release(ToolkitLock lock) {
- CyclicBarrier barrier = holdings.get(lock.getName());
- if (barrier != null) {
- releaseLock(barrier);
- holdings.remove(lock);
- }
- }
-
- private void releaseLock(CyclicBarrier barrier) {
- await(barrier); // hit 2
- await(barrier); // hit 3
- }
-
- public synchronized void reset() {
- for (CyclicBarrier barrier : holdings.values()) {
- releaseLock(barrier);
- }
- holdings.clear();
- }
-
- private void await(CyclicBarrier barrier) {
- try {
- barrier.await();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- } catch (BrokenBarrierException e) {
- // ignore
- }
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-locks-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-locks-test.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-locks-test.xml (revision 0)
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/distribution/src/main/assembly/root/README.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/src/main/assembly/root/README.html (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/src/main/assembly/root/README.html (revision 0)
@@ -1,151 +0,0 @@
-
-
-
- README Notes For Ehcache ${project.version}
-
- The project home page is http://ehcache.org. Please see http://ehcache.org for a full change log, usage, product versions
- and comprehensive documentation.
-
-
- Introduction
- ============
- Ehcache is a pure Java, in-process cache with the following features:
-
- 1. Fast and Light Weight
- 1.1 Fast
- 1.2 Simple
- 1.3 Small foot print
- 1.4 Minimal dependencies
- 2. Scalable
- 2.1 Provides Memory and Disk stores for scalabilty into gigabytes
- 2.4 Scalable to hundreds of caches
- 2.3 Tuned for high concurrent load on large multi-cpu servers
- 2.4 Multiple CacheManagers per virtual machine
- 3. Flexible
- 3.1 Supports Object or Serializable caching
- 3.2 Support cache-wide or Element-based expiry policies
- 3.3 Provides LRU, LFU and FIFO cache eviction policies
- 3.4 Provides Memory and Disk stores
- 3.5 Distributed
- 3.6 Dynamic, Runtime Configuration of Caches
- 4. Standards Based
- 4.1 Full implementation of JSR107 JCACHE API
- 5. Extensible
- 5.1 Listeners may be plugged in
- 5.2 Peer Discovery, Replicators and Listeners may be plugged in
- 5.3 Cache Extensions may be plugged in
- 5.4 Cache Loaders may be plugged in
- 5.5 Cache Exception Handlers may be plugged in
- 6. Application Persistence
- 6.1 Persistent disk store which stores data between VM restarts
- 6.2 Flush to disk on demand
- 7. Listeners
- 7.1 CacheManager listeners
- 7.2 Cache event listeners
- 8. JMX Enabled
- 9. Distributed Caching
- 10. Support for replication via RMI or JGroups
- 10.1 Peer Discovery
- 10.2 Reliable Delivery
- 10.3 Synchronous Or Asynchronous Replication
- 10.4 Copy Or Invalidate Replication
- 10.5 Transparent Replication
- 10.6 Extensible
- 10.7 Bootstrapping from Peers
- 11. Cache Server
- 11.1 RESTful cache server
- 11.2 SOAP cache server
- 11.3 comes as a WAR or as a complete server
- 12. Java EE and Applied Caching
- 12.1 Blocking Cache to avoid duplicate processing for concurrent operations
- 12.2 SelfPopulating Cache for pull through caching of expensive operations
- 12.3 Java EE Gzipping Servlet Filter
- 12.4 Cacheable Commands
- 12.5 Works with Hibernate
- 12.6 Works with Google App Engine
- 12.7 Transactional support through JTA
- 13. High Quality
- 13.1 High Test Coverage
- 13.2 Automated Load, Limit and Performance System Tests
- 13.3 Specific Concurrency Testing
- 13.4 Production tested
- 13.5 Fully documented
- 13.6 Trusted by Popular Frameworks
- 13.7 Conservative Commit policy
- 13.8 Full public information on the history of every bug
- 13.9 Responsiveness to serious bugs
- 14. Open Source Licensing
- 14.1 Apache 2.0 license
-
- Java Requirements
- =================
-
- Ehcache 1.7.2 and above supports Java 1.5 and 1.6 at runtime. Ehcache final releases are compiled with -target 1.5.
-
- The Ehcache 1.5 branch is being maintained for Java 1.4 users.
-
- Dependencies
- ============
-
- SLF4J API and one concrete logging implementation. The API jar and the JDK14 logging jar are included in the distribution.
-
- Maven POM snippet
- =================
-
- All Ehcache releases are placed in the central Maven repository.
-
- The Maven snippet for Ehcache is:
-
- <dependency>
- <groupid>net.sf.ehcache</groupid>
- <artifactid>ehcache</artifactid>
- <version>${project.version}</version>
- </dependency>
-
- Installation
- ============
- Place the ehcache-core.jar, slf4j-api.jar and slf4j-jdk14.jar, or the concrete SLF4J logging implementation library of your choice into your classpath.
-
- For use with Terracotta, copy the ehcache-terracotta.jar to your classpath.
-
- Create an ehcache.xml configuration from the one supplied in the distribution and place it in the root of your classpath.
-
- The Terracotta server is in the terracotta directory. It includes start and stop scripts.
-
- For Maven based development, there is a tc-maven-plugin which works much like the Jetty plugin. See UsingWithMaven.txt,
- which shows how to add the server to your integration test phase and interactive command use.
-
- For Ant based development, the tc-maven-plugin can be called from Ant. See UsingWithAnt.txt,
- which shows how to add the server to your Ant build, and how to use the server interactively from Ant.
-
-
- Samples
- =======
- See the samples directory for ready-to-run samples which show to use the full features of Ehcache, including use with Terracotta.
-
-
-
- Documentation
- =============
- See http://ehcache.org/documentation for full documentation.
-
- The JavaDoc is in the distribution and also online at http://ehcache.org/apidocs
-
- Licenses
- ========
- This kit contains ehcache code which is governed by the Apache License, version 2.0. The license is in the licenses folder.
-
- Ehcache 1.7.1 and higher uses SLF4J for logging. The SLF4J license is included in the licenses folder.
-
- Known Issues
- ============
-
- 1. There are a number of known issues and workarounds for Tomcat. See the Using Ehcache with Tomcat chapter
- in the online documentation.
-
- 2. See the FAQ online for a current list.
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/one-cache-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/one-cache-test.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/one-cache-test.xml (revision 0)
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/HolidayCalendar.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/HolidayCalendar.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/HolidayCalendar.java (revision 0)
@@ -1,59 +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.container.hibernate.domain;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-public class HolidayCalendar {
- private Long id;
- private Map holidays = new HashMap(); // Date -> String
-
- public HolidayCalendar init() {
- DateFormat df = new SimpleDateFormat("yyyy.MM.dd");
- try {
- holidays.clear();
- holidays.put(df.parse("2009.01.01"), "New Year's Day");
- holidays.put(df.parse("2009.02.14"), "Valentine's Day");
- holidays.put(df.parse("2009.11.11"), "Armistice Day");
- } catch (ParseException e) {
- System.out.println("Error parsing date string");
- throw new RuntimeException(e);
- }
- return this;
- }
-
- public Map getHolidays() {
- return holidays;
- }
-
- protected void setHolidays(Map holidays) {
- this.holidays = holidays;
- }
-
- public void addHoliday(Date d, String name) {
- holidays.put(d, name);
- }
-
- public String getHoliday(Date d) {
- return (String)holidays.get(d);
- }
-
- public boolean isHoliday(Date d) {
- return holidays.containsKey(d);
- }
-
- protected Long getId() {
- return id;
- }
-
- protected void setId(Long id) {
- this.id = id;
- }
-}
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/exceptionhandler/CacheExceptionHandlerTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/exceptionhandler/CacheExceptionHandlerTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/exceptionhandler/CacheExceptionHandlerTest.java (revision 0)
@@ -1,224 +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.exceptionhandler;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.ehcache.AbstractCacheTest;
-import net.sf.ehcache.CacheException;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.loader.CacheLoader;
-import net.sf.ehcache.loader.ExceptionThrowingLoader;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author Greg Luck
- * @version $Id: CacheExceptionHandlerTest.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public class CacheExceptionHandlerTest {
-
- /**
- * manager
- */
- protected CacheManager manager;
- /**
- * the cache name we wish to test
- */
- protected String cacheName = "exceptionHandlingCache";
- /**
- * the cache we wish to test
- */
- protected Ehcache cache;
-
- /**
- * {@inheritDoc}
- *
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- manager = CacheManager.create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache.xml");
- cache = manager.getEhcache(cacheName);
- cache.removeAll();
- }
-
-
- /**
- * {@inheritDoc}
- *
- * @throws Exception
- */
- @After
- public void tearDown() throws Exception {
- CountingExceptionHandler.resetCounters();
- manager.shutdown();
- }
-
- /**
- * Test a cache which has been configured to have a CountingExceptionHandler configured
- */
- @Test
- public void testConfiguredCache() {
- manager.removeCache("exceptionHandlingCache");
- //Would normally throw an IllegalStateException
- cache.get("key1");
-
- assertEquals(1, CountingExceptionHandler.HANDLED_EXCEPTIONS.size());
- assertEquals(null, ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS.get(0)).getKey());
- assertEquals(IllegalStateException.class, ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS
- .get(0)).getException().getClass());
- }
-
- /**
- * Test a cache which has been configured to have an ExceptionThrowingLoader screw up loading.
- * This one should have a key set.
- */
- @Test
- public void testKeyWithConfiguredCache() {
-
- List loaders = new ArrayList(cache.getRegisteredCacheLoaders());
- for (CacheLoader loader : loaders) {
- cache.unregisterCacheLoader(loader);
- }
-
- cache.registerCacheLoader(new ExceptionThrowingLoader());
- cache.getWithLoader("key1", null, null);
-
- assertEquals(1, CountingExceptionHandler.HANDLED_EXCEPTIONS.size());
- assertEquals("key1", ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS.get(0)).getKey());
- assertEquals(CacheException.class, ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS
- .get(0)).getException().getClass());
- }
-
- /**
- * Double proxy test
- */
- @Test
- public void testCacheExceptionHandler() {
- Ehcache proxiedCache = ExceptionHandlingDynamicCacheProxy.createProxy(cache);
-
- List loaders = new ArrayList(cache.getRegisteredCacheLoaders());
- for (CacheLoader loader : loaders) {
- cache.unregisterCacheLoader(loader);
- }
- cache.registerCacheLoader(new CustomExceptionThrowingLoader());
- proxiedCache.getWithLoader("key1", null, null);
-
-
- //Would normally throw an IllegalArgumentException
-// proxiedCache.put(null);
-
- assertEquals(1, CountingExceptionHandler.HANDLED_EXCEPTIONS.size());
- assertEquals("key1", ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS.get(0)).getKey());
- assertEquals(CacheException.class, ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS
- .get(0)).getException().getClass());
- }
-
-
- /**
- * Test some gnarly parsing code
- */
- @Test
- public void testKeyExtraction() {
-
- String testMessage = "For key 1234";
- String key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals("1234", key);
-
- testMessage = "key 1234";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals("1234", key);
-
- testMessage = null;
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals(null, key);
-
- testMessage = "";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals(null, key);
-
- testMessage = "key 1234 ";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals("1234", key);
-
- testMessage = "key 1234 .";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals("1234", key);
-
- testMessage = "key .";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals(".", key);
-
- testMessage = "key";
- key = ExceptionHandlingDynamicCacheProxy.extractKey(testMessage);
- assertEquals(null, key);
-
- }
-
- /**
- * Tests that the exception thrown by a configured loader, is
- * actually passed on to exception handler
- */
- @Test
- public void testExceptionThrown() {
-
- List loaders = new ArrayList(cache.getRegisteredCacheLoaders());
- for (CacheLoader loader : loaders) {
- cache.unregisterCacheLoader(loader);
- }
- cache.registerCacheLoader(new CustomExceptionThrowingLoader());
-
- cache.getWithLoader("key1", null, null);
-
- assertEquals(1, CountingExceptionHandler.HANDLED_EXCEPTIONS.size());
- assertEquals("key1", ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS.get(0)).getKey());
-
-
- Class expectedExceptionClass = UnsupportedOperationException.class;
-
- Exception e = ((CountingExceptionHandler.HandledException) CountingExceptionHandler.HANDLED_EXCEPTIONS
- .get(0)).getException();
-
- Throwable cause = e;
- boolean foundExceptionInChain = false;
-
-
- //Recurse through the chain
- while ((cause = cause.getCause()) != null) {
-
- if (cause.getClass().equals(expectedExceptionClass)) {
- foundExceptionInChain = true;
- break;
- }
- }
-
- if (!foundExceptionInChain) {
- fail();
- }
-
-
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 0)
@@ -1,38 +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.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to ignore a field, type or entire package while doing a SizeOf measurement
- * @see net.sf.ehcache.pool.sizeof.SizeOf
- * @author Chris Dennis
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE })
-public @interface IgnoreSizeOf {
-
- /**
- * Controls whether the annotation, when applied to a {@link ElementType#TYPE type} is to be applied to all its subclasses
- * as well or solely on that type only. true if inherited by subtypes, false otherwise
- */
- boolean inherited() default false;
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 0)
@@ -1,163 +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.expression;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-import net.sf.ehcache.Element;
-import net.sf.ehcache.search.Attribute;
-import net.sf.ehcache.search.SearchException;
-import net.sf.ehcache.search.attribute.AttributeExtractor;
-
-/**
- * A regular expression criteria that matches attribute string values. For non java.lang.String attributes
,
- * the toString()
form is used in the comparison.
- *
- * Expressions are always case insensitive
- *
- * The following special characters are supported:
- *
- * '?' - match any one single character
- * '*' - match any multiple character(s) (including zero)
- *
- * The supported wildcard characters can be escaped with a backslash '\', and a literal backslash can be included with '\\'
- *
- * WARN: Expressions starting with a leading wildcard character are potentially very expensive (ie. full scan) for indexed caches
- *
- *
- * @author teck
- */
-public class ILike extends BaseCriteria {
-
- private final String attributeName;
- private final String regex;
- private final Pattern pattern;
-
- /**
- * Construct a "like" criteria for the given expression
- *
- * @param attributeName attribute name
- * @param regex expression
- */
- public ILike(String attributeName, String regex) {
- if ((attributeName == null) || (regex == null)) {
- throw new SearchException("Both the attribute name and regex must be non null.");
- }
-
- this.attributeName = attributeName;
- this.regex = regex;
- this.pattern = convertRegex(regex.trim());
- }
-
- /**
- * Return attribute name.
- *
- * @return String attribute name
- */
- public String getAttributeName() {
- return attributeName;
- }
-
- /**
- * Return regex string.
- *
- * @return String regex.
- */
- public String getRegex() {
- return regex;
- }
-
- private static Pattern convertRegex(final String expr) {
- if (expr.length() == 0) {
- throw new SearchException("Zero length regex");
- }
-
- StringBuilder javaRegex = new StringBuilder("^");
-
- boolean escape = false;
- for (int i = 0; i < expr.length(); i++) {
- char ch = expr.charAt(i);
-
- if (escape) {
- switch (ch) {
- case '\\':
- case '?':
- case '*': {
- javaRegex.append(Pattern.quote(lowerCase(ch)));
- break;
- }
-
- default: {
- throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr);
- }
- }
-
- escape = false;
- } else {
- switch (ch) {
- case '\\': {
- escape = true;
- break;
- }
- case '?': {
- javaRegex.append(".");
- break;
- }
- case '*': {
- javaRegex.append(".*");
- break;
- }
- default: {
- javaRegex.append(Pattern.quote(lowerCase(ch)));
- }
- }
- }
- }
-
- javaRegex.append("$");
-
- return Pattern.compile(javaRegex.toString(), Pattern.DOTALL);
- }
-
- private static String lowerCase(char ch) {
- // heeding the advice in Character.toLowerCase() and using String.toLowerCase() instead here
- return Character.toString(ch).toLowerCase();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean execute(Element e, Map attributeExtractors) {
- Object value = getExtractor(attributeName, attributeExtractors).attributeFor(e, attributeName);
- if (value == null) {
- return false;
- }
-
- String asString = value.toString().toLowerCase();
-
- return pattern.matcher(asString).matches();
- }
-
- @Override
- public Set> getAttributes() {
- return Collections.>singleton(new Attribute(attributeName));
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-db.bat
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-db.bat (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/events/src/assemble/bin/stop-db.bat (revision 0)
@@ -1,19 +0,0 @@
-@echo off
-
-if not defined JAVA_HOME (
- echo JAVA_HOME is not defined
- exit /b 1
-)
-
-setlocal
-
-set JAVA_HOME="%JAVA_HOME:"=%"
-set root=%~d0%~p0..
-set root="%root:"=%"
-
-cd %root%
-set h2_jar=%root%\src\main\webapp\WEB-INF\lib\h2-1.1.116.jar
-
-call %JAVA_HOME%\bin\java -cp %h2_jar% org.h2.tools.Server -tcpShutdown tcp://localhost:9092
-
-endlocal
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/META-INF/services/net.sf.ehcache.management.ManagementServer
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/META-INF/services/net.sf.ehcache.management.ManagementServer (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/META-INF/services/net.sf.ehcache.management.ManagementServer (revision 0)
@@ -1,2 +0,0 @@
-#used by ManagementServerLoaderTest
-net.sf.ehcache.management.DummyManagementServerImpl
\ No newline at end of file
Index: rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0)
@@ -1,162 +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 java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2;
-import net.sf.ehcache.management.sampled.CacheSampler;
-import net.sf.ehcache.management.service.AccessorPrefix;
-import net.sf.ehcache.util.counter.sampled.SampledCounter;
-import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.terracotta.management.resource.AgentEntityV2;
-
-/**
- * A builder for {@link CacheStatisticSampleEntityV2} resource objects.
- *
- * @author brandony
- */
-final class CacheStatisticSampleEntityBuilderV2 {
- private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class);
-
- private static final String SAMPLE_SUFFIX = "Sample";
-
- private final Set sampleNames;
-
- private final Map> samplersByCMName = new HashMap>();
-
- static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) {
- return new CacheStatisticSampleEntityBuilderV2(statisticSampleName);
- }
-
- private CacheStatisticSampleEntityBuilderV2(Set sampleNames) {
- this.sampleNames = sampleNames;
- }
-
- CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler,
- String cacheManagerName) {
- addSampler(sampler, cacheManagerName);
- return this;
- }
-
- Collection build() {
- Collection csses = new ArrayList();
-
- for (Map.Entry> entry : samplersByCMName.entrySet()) {
- for (CacheSampler sampler : entry.getValue()) {
- if (sampleNames == null) {
- for (Method m : CacheSampler.class.getMethods()) {
- if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) {
- CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey());
- if (csse != null) {
- csses.add(csse);
- }
- }
- }
- } else {
- for (String sampleName : sampleNames) {
- Method sampleMethod;
- try {
- sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX);
- } catch (NoSuchMethodException e) {
- LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName);
- continue;
- }
-
- if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) {
- CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey());
- if (csse != null) {
- csses.add(csse);
- }
- }
- }
- }
- }
- }
-
- return csses;
- }
-
- private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod,
- CacheSampler sampler,
- String cmName) {
- SampledCounter sCntr;
- try {
- sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler));
- } catch (IllegalAccessException e) {
- LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.",
- sampleMethod.getName());
- sCntr = null;
- } catch (InvocationTargetException e) {
- LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e);
- sCntr = null;
- }
-
- if (sCntr != null) {
- CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2();
- csse.setCacheManagerName(cmName);
- csse.setName(sampler.getCacheName());
- csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID);
- // csse.setVersion(this.getClass().getPackage().getImplementationVersion());
- csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, ""));
-
- TimeStampedCounterValue[] tscvs;
- if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) {
- tscvs = new TimeStampedCounterValue[0];
- } else {
- tscvs = sCntr.getAllSampleValues();
- }
-
- Map statValueByTime = new TreeMap();
- csse.setStatValueByTimeMillis(statValueByTime);
-
- for (TimeStampedCounterValue tscv : tscvs) {
- statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue());
- }
- return csse;
- }
-
- return null;
- }
-
- private Set getExcludedMethodNames(CacheSampler sampler) {
- if (sampler.isLocalHeapCountBased()) {
- return Collections.singleton("getLocalHeapSizeInBytesSample");
- }
- return Collections.emptySet();
- }
-
- private void addSampler(CacheSampler sampler,
- String cacheManagerName) {
- if (sampler == null) {
- throw new IllegalArgumentException("sampler == null");
- }
-
- if (cacheManagerName == null) {
- throw new IllegalArgumentException("cacheManagerName == null");
- }
-
- Set samplers = samplersByCMName.get(cacheManagerName);
-
- if (samplers == null) {
- samplers = new HashSet();
- samplersByCMName.put(cacheManagerName, samplers);
- }
-
- samplers.add(sampler);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/impl/BoundedPool.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/impl/BoundedPool.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/pool/impl/BoundedPool.java (revision 0)
@@ -1,52 +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.impl;
-
-import net.sf.ehcache.pool.PoolParticipant;
-import net.sf.ehcache.pool.SizeOfEngine;
-import net.sf.ehcache.pool.PoolAccessor;
-import net.sf.ehcache.pool.PoolEvictor;
-
-/**
- * A pool which loosely obeys to its bound: it can allow the accessors to consume more bytes than what
- * has been configured if that helps concurrency.
-
- * @author Ludovic Orban
- * @author Chris Dennis
- */
-public class BoundedPool extends AbstractPool {
-
- /**
- * Create a BoundedPool instance
- *
- * @param maximumPoolSize the maximum size of the pool, in bytes.
- * @param evictor the pool evictor, for cross-store eviction.
- * @param defaultSizeOfEngine the default SizeOf engine used by the accessors.
- */
- public BoundedPool(long maximumPoolSize, PoolEvictor evictor, SizeOfEngine defaultSizeOfEngine) {
- super(maximumPoolSize, evictor, defaultSizeOfEngine);
- }
-
- /**
- * {@inheritDoc}
- */
- public PoolAccessor createPoolAccessor(PoolParticipant participant, SizeOfEngine sizeOfEngine) {
- AtomicPoolAccessor accessor = new AtomicPoolAccessor(this, participant, sizeOfEngine, 0);
- registerPoolAccessor(accessor);
- return accessor;
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0)
@@ -1,149 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.modules.ehcache.l1bm;
-
-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.TerracottaConfiguration;
-
-import org.terracotta.ehcache.tests.AbstractCacheTestBase;
-import org.terracotta.ehcache.tests.ClientBase;
-import org.terracotta.toolkit.Toolkit;
-import org.terracotta.toolkit.concurrent.ToolkitBarrier;
-
-import com.tc.test.config.model.TestConfig;
-
-import java.util.Random;
-import java.util.concurrent.BrokenBarrierException;
-
-import junit.framework.Assert;
-
-public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase {
- private static final int NODE_COUNT = 2;
- private static final int NUM_OF_ELEMENTS = 1000;
- private static final int NUM_OF_THREADS = 10;
- private static final int WRITE_PERCENTAGE = 5;
-
- public L1BMOnHeapReadWriteTest(TestConfig testConfig) {
- super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class);
- }
-
- public static class L1BMOnHeapReadWriteTestApp extends ClientBase {
- private final ToolkitBarrier barrier;
-
- public L1BMOnHeapReadWriteTestApp(String[] args) {
- super(args);
- this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT);
- }
-
- public static void main(String[] args) {
- new L1BMOnHeapReadWriteTestApp(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
- boolean shouldWait = true;
- Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true);
- testL1BigMemorySanity(eventualWithStatsCache, shouldWait);
- eventualWithStatsCache.removeAll();
-
- Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false);
- testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait);
- eventualWithoutStatsCache.removeAll();
-
- shouldWait = false;
- Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true);
- testL1BigMemorySanity(strongWithStatsCache, shouldWait);
- strongWithStatsCache.removeAll();
-
- shouldWait = false;
- Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false);
- testL1BigMemorySanity(strongWithoutStatsCache, shouldWait);
- strongWithoutStatsCache.removeAll();
- }
-
- private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException,
- BrokenBarrierException {
- int index = barrier.await();
- if (index == 0) {
- System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache");
- for (int i = 0; i < NUM_OF_ELEMENTS; i++) {
- cache.put(new Element("key" + i, "val" + i));
- }
- System.out.println("XXXXX done with putting " + cache.getSize() + " entries");
- }
- barrier.await();
- if (shouldWait) {
- while (cache.getSize() != NUM_OF_ELEMENTS) {
- Thread.sleep(1000);
- }
- }
- Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize());
- System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: "
- + cache.getStatistics().getLocalHeapSize());
- if (index == 0) {
- Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0);
- } else {
- Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize());
- }
-
- System.out.println("XXXXX starting test threads....");
- Thread ths[] = new Thread[NUM_OF_THREADS];
- for (int i = 0; i < NUM_OF_THREADS; i++) {
- ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i);
- ths[i].start();
- }
-
- for (Thread th : ths) {
- th.join();
- }
- barrier.await();
- System.out.println("XXXXXX done with " + cache.getName());
- }
-
- private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) {
- CacheConfiguration cacheConfiguration = new CacheConfiguration();
- cacheConfiguration.setName(cacheName);
- cacheConfiguration.setMaxBytesLocalHeap(10485760L);
-
- TerracottaConfiguration tcConfiguration = new TerracottaConfiguration();
- tcConfiguration.setConsistency(consistency);
- cacheConfiguration.addTerracotta(tcConfiguration);
-
- Cache cache = new Cache(cacheConfiguration);
- cm.addCache(cache);
- return cache;
- }
-
- private static class TestThread implements Runnable {
- private final long TIME_TO_RUN = 1 * 60 * 1000;
- private final Cache cache;
- private final int threadIndex;
- private final int clientIndex;
-
- public TestThread(Cache cache, int threadIndex, int clientIndex) {
- this.cache = cache;
- this.threadIndex = threadIndex;
- this.clientIndex = clientIndex;
- }
-
- @Override
- public void run() {
- System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex);
- long start = System.currentTimeMillis();
- Random rand = new Random(start);
- while (System.currentTimeMillis() - start < TIME_TO_RUN) {
- if (rand.nextInt(100) < WRITE_PERCENTAGE) {
- this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS)));
- } else {
- String key = "key" + rand.nextInt(NUM_OF_ELEMENTS);
- Assert.assertNotNull("value for " + key + " is null", this.cache.get(key));
- }
- }
- }
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-event-eviction-exception-test.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-event-eviction-exception-test.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/cache-event-eviction-exception-test.xml (revision 0)
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapElementTTIExpressTestClient.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapElementTTIExpressTestClient.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapElementTTIExpressTestClient.java (revision 0)
@@ -1,90 +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;
-
-import junit.framework.Assert;
-
-public class ServerMapElementTTIExpressTestClient extends ServerMapClientBase {
-
- public ServerMapElementTTIExpressTestClient(String[] args) {
- super("testWithElementEvictionTTI", args);
- }
-
- public static void main(String[] args) {
- new ServerMapElementTTIExpressTestClient(args).run();
- }
-
- @Override
- protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable {
- int size = cache.getSize();
- assertEquals(0, size);
- System.out.println("Client populating cache.");
-
- for (int i = 0; i < 1500; i++) {
- cache.put(new Element("key-" + i, "value-" + i));
- }
-
- for (int i = 1500; i < 2000; i++) {
- Element element = new Element("key-" + i, "value-" + i);
- element.setTimeToIdle(60 * 4); // setting TTI of 1500-2000 keys as 4 min
- cache.put(element);
- }
-
- System.out.println("Cache populate. Size: " + cache.getSize());
-
- Date date = new Date();
- System.out.println("Sleeping for 2 mins (now=" + date + ", " + date.getTime() + ") ... ");
- // Sleep for TTI to kick in:
- Thread.sleep(2 * 60 * 1000);
-
- date = new Date();
- System.out.println("After sleeping 2 mins. Size: " + cache.getSize() + " (now=" + date + ", " + date.getTime()
- + ")");
-
- for (int i = 0; i < 1500; i++) {
- Element element = cache.get("key-" + i);
- Assert.assertNull("Element should be null of key-" + i + " actual: " + element, element);
- }
-
- date = new Date();
- System.out.println("Touching elements from 1500-2000 (now=" + date + ", " + date.getTime() + ")");
- for (int i = 1500; i < 2000; i++) {
- Element element = cache.get("key-" + i);
- Assert.assertTrue(element.getValue().equals("value-" + i));
- }
-
- for (int i = 2000; i < 2500; i++) {
- Element element = new Element("key-" + i, "value-" + i);
- element.setTimeToIdle(15 * 60); // setting TTI of 2000-2500 keys as 15 min
- cache.put(element);
- }
-
- date = new Date();
- System.out.println("Sleeping for 5 mins (now=" + date + ", " + date.getTime() + ") ... ");
- // Sleep for TTI to kick in:
- Thread.sleep(5 * 60 * 1000);
-
- date = new Date();
- System.out.println("After sleeping 5 mins. Size: " + cache.getSize() + " (now=" + date + ", " + date.getTime()
- + ")");
-
- for (int i = 1500; i < 2000; i++) {
- Element element = cache.get("key-" + i);
- Assert.assertNull("Element should be null of key-" + i + " actual: " + element, element);
- }
-
- for (int i = 2000; i < 2500; i++) {
- Element element = cache.get("key-" + i);
- Assert.assertTrue(element.getValue().equals("value-" + i));
- }
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/BTMTwoResourceTx1.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/BTMTwoResourceTx1.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/BTMTwoResourceTx1.java (revision 0)
@@ -1,22 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests.txns;
-
-
-import bitronix.tm.Configuration;
-import bitronix.tm.TransactionManagerServices;
-
-public class BTMTwoResourceTx1 extends TwoResourceTx1 {
-
- public BTMTwoResourceTx1(String[] args) {
- super(args);
- Configuration config = TransactionManagerServices.getConfiguration();
- config.setServerId("tworesourcetx-1-" + Math.random());
- config.setJournal("null");
- }
-
- public static void main(String[] args) {
- new BTMTwoResourceTx1(args).run();
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/LfuPolicy.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/LfuPolicy.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/store/LfuPolicy.java (revision 0)
@@ -1,57 +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.store;
-
-import net.sf.ehcache.Element;
-
-
-/**
- * Contains common LFU policy code for use between the LfuMemoryStore and the DiskStore, which also
- * uses an LfuPolicy for evictions.
- *
- * @author Greg Luck
- * @version $Id: LfuPolicy.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public class LfuPolicy extends AbstractPolicy {
-
- /**
- * The name of this policy as a string literal
- */
- public static final String NAME = "LFU";
-
- /**
- * @return the name of the Policy. Inbuilt examples are LRU, LFU and FIFO.
- */
- public String getName() {
- return NAME;
- }
-
- /**
- * Compares the desirableness for eviction of two elements
- *
- * Compares hit counts. If both zero,
- *
- * @param element1 the element to compare against
- * @param element2 the element to compare
- * @return true if the second element is preferable to the first element for ths policy
- */
- public boolean compare(Element element1, Element element2) {
- return element2.getHitCount() < element1.getHitCount();
-
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/PersistenceConfigurationElement.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/PersistenceConfigurationElement.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/PersistenceConfigurationElement.java (revision 0)
@@ -1,66 +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.elements;
-
-import net.sf.ehcache.config.PersistenceConfiguration;
-import net.sf.ehcache.config.generator.model.NodeElement;
-import net.sf.ehcache.config.generator.model.SimpleNodeAttribute;
-import net.sf.ehcache.config.generator.model.SimpleNodeElement;
-
-/**
- * Element representing the {@link net.sf.ehcache.config.PersistenceConfiguration}
- *
- * @author Chris Dennis
- *
- */
-public class PersistenceConfigurationElement extends SimpleNodeElement {
- private final PersistenceConfiguration persistenceConfiguration;
-
- /**
- * Construtor accepting the parent and the {@link net.sf.ehcache.config.PersistenceConfiguration}
- *
- * @param parent
- * @param persistenceConfiguration
- */
- public PersistenceConfigurationElement(ConfigurationElement parent, PersistenceConfiguration persistenceConfiguration) {
- super(parent, "persistence");
- this.persistenceConfiguration = persistenceConfiguration;
- init();
- }
-
- /**
- * Construtor accepting the element and the {@link net.sf.ehcache.config.PersistenceConfiguration}
- *
- * @param element
- * @param persistenceConfiguration
- */
- public PersistenceConfigurationElement(NodeElement element, PersistenceConfiguration persistenceConfiguration) {
- super(element, "persistence");
- this.persistenceConfiguration = persistenceConfiguration;
- init();
- }
-
- private void init() {
- if (persistenceConfiguration == null) {
- return;
- }
- addAttribute(new SimpleNodeAttribute("strategy", persistenceConfiguration.getStrategy()));
- addAttribute(new SimpleNodeAttribute("synchronousWrites", persistenceConfiguration.getSynchronousWrites()).optional(true)
- .defaultValue(PersistenceConfiguration.DEFAULT_SYNCHRONOUS_WRITES));
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0)
@@ -1,87 +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.extended;
-
-import java.util.List;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-import org.terracotta.statistics.ValueStatistic;
-import org.terracotta.statistics.archive.StatisticArchive;
-import org.terracotta.statistics.archive.StatisticSampler;
-import org.terracotta.statistics.archive.Timestamped;
-
-/**
- * The Class SampledStatistic.
- *
- * @param the generic type
- * @author cdennis
- */
-class SampledStatistic {
-
- /** The sampler. */
- private final StatisticSampler sampler;
-
- /** The history. */
- private final StatisticArchive history;
-
- /**
- * Instantiates a new sampled statistic.
- *
- * @param statistic the statistic
- * @param executor the executor
- * @param historySize the history size
- * @param periodNanos the period nanos
- */
- public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) {
- this.history = new StatisticArchive(historySize);
- this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history);
- }
-
- /**
- * Start sampling.
- */
- public void startSampling() {
- sampler.start();
- }
-
- /**
- * Stop sampling.
- */
- public void stopSampling() {
- sampler.stop();
- history.clear();
- }
-
- /**
- * History.
- *
- * @return the list
- */
- public List> history() {
- return history.getArchive();
- }
-
- /**
- * Adjust.
- *
- * @param historySize the history size
- * @param historyNanos the history nanos
- */
- void adjust(int historySize, long historyNanos) {
- history.setCapacity(historySize);
- sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/terracotta/ehcache-tc-embedded.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/terracotta/ehcache-tc-embedded.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/resources/terracotta/ehcache-tc-embedded.xml (revision 0)
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- app/logs-%i
-
-
-
-
-
\ No newline at end of file
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheManagerPeerProviderFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheManagerPeerProviderFactory.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/distribution/CacheManagerPeerProviderFactory.java (revision 0)
@@ -1,42 +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.CacheManager;
-
-import java.util.Properties;
-
-/**
- * An abstract factory for creating peers. Implementers should provide their own
- * concrete factory extending this factory. It can then be configured in ehcache.xml
- * @author Greg Luck
- * @version $Id: CacheManagerPeerProviderFactory.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public abstract class CacheManagerPeerProviderFactory {
-
- /**
- * Create a peer provider.
- * @param cacheManager the CacheManager instance connected to this peer provider
- * @param properties implementation specific properties. These are configured as comma
- * separated name value pairs in ehcache.xml
- * @return a constructed CacheManagerPeerProvider
- */
- public abstract CacheManagerPeerProvider createCachePeerProvider(CacheManager cacheManager, Properties properties);
-
-
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache/src/test/resources/serializedforms/SerializedReadCommittedClusteredSoftLockSerializationTest.testBasic.ser
===================================================================
diff -u -N -r10990 -r11009
Binary files differ
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/LocalTxTestDebug.btm
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/LocalTxTestDebug.btm (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/byteman/LocalTxTestDebug.btm (revision 0)
@@ -1,77 +0,0 @@
-
-
-RULE trace ServerMap gets
-CLASS ServerMap
-METHOD doGet
-AT EXIT
-#IF NOT $getType.name().equals("UNSAFE")
-IF false
-DO traceln(" ____ ServerMap.doGet key.hashCode(): \"" + $key.hashCode() + "\", \"" + $getType + "\", \"" + $quiet + " -> " + $!);
-ENDRULE
-
-RULE trace ServerMap puts
-CLASS ServerMap
-METHOD doLogicalPut
-AT ENTRY
-IF false
-DO traceln(" _____ ServerMap.doLogicalPut - key.hashCode(): \"" + $key.hashCode() + "\", mutateType: \"" + $type + "\", value: \"" + $value);
-ENDRULE
-
-
-RULE trace ServerMap removes
-CLASS ServerMap
-METHOD doLogicalRemove
-AT ENTRY
-IF false
-DO traceln(" _____ ServerMap.doLogicalRemove - key.hashCode(): \"" + $key.hashCode() + "\", mutateType: \"" + $type);
-ENDRULE
-
-RULE trace clusteredStore doPut
-CLASS ClusteredStore
-METHOD doPut
-AT EXIT
-IF false
-DO traceln(" _____ ClusteredStore.doPut - pkey.hashCode(): \"" + $portableKey.hashCode() + "\", return: \"" + $!);
-ENDRULE
-
-RULE trace clusteredStore replace
-CLASS ClusteredStore
-METHOD replace(Element,Element,ElementValueComparator)
-AT EXIT
-IF false
-DO traceln(" _____ ClusteredStore.replace old: "+$old+" element: "+$element+" return: \"" + $!);
-ENDRULE
-
-RULE trace CustomLifespanSerializedEntry isExpired
-CLASS CustomLifespanSerializedEntry
-METHOD isExpired
-AT EXIT
-IF false
-DO traceln(" _____ CustomLifespanSerializedEntry isExpired atTime: " +$atTime+ " maxTTISeconds: "+$maxTTISeconds+" maxTTLSeconds: "+$maxTTLSeconds+" lastAccessedTime: "+$0.lastAccessedTime+" createTime: "+$0.createTime+" return: " + $!);
-ENDRULE
-
-RULE trace ServerMap createSerializedEntry
-CLASS ServerMap
-METHOD createSerializedEntry
-AT ENTRY
-IF false
-DO traceln(" _____XXX ServerMap createSerializedEntry createTime: "+$createTimeInSecs+" now: " + $0.timeSource.now());
-ENDRULE
-
-RULE trace DefaultElementValueComparator
-CLASS DefaultElementValueComparator
-METHOD equals(Element, Element)
-AT ENTRY
-IF false
-DO traceln(" _____XXX DefaultElementValueComparator: e1: " + $e1 + ", e2: " + $e2);
-ENDRULE
-
-
-RULE trace EhcacheTxnsClusteredStateFacadeImpl clear
-CLASS EhcacheTxnsClusteredStateFacadeImpl
-METHOD clearSoftLock
-AT ENTRY
-IF false
-DO traceln(" _____XXX clearSoftLock: softLockId: " + $softLockId);
-ENDRULE
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/management/ManagementServerLoaderTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/management/ManagementServerLoaderTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/management/ManagementServerLoaderTest.java (revision 0)
@@ -1,81 +0,0 @@
-package net.sf.ehcache.management;
-
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.config.Configuration;
-import net.sf.ehcache.config.ManagementRESTServiceConfiguration;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * @author Ludovic Orban
- */
-public class ManagementServerLoaderTest {
-
- @Test
- public void testRegistrationLifecycleStandalone() throws Exception {
- boolean managementAvailable = ManagementServerLoader.isManagementAvailable();
- assertThat(managementAvailable, is(true));
-
- CacheManager cacheManager1 = createCacheManager("cm-one", "localhost:1234");
- CacheManager cacheManager2 = createCacheManager("cm-two", "localhost:1234");
-
- try {
- ManagementServerLoader.register(cacheManager1, null, cacheManager1.getConfiguration().getManagementRESTService());
- DummyManagementServerImpl dms = (DummyManagementServerImpl)ManagementServerLoader.MGMT_SVR_BY_BIND.get("localhost:1234").getManagementServer();
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
- ManagementServerLoader.register(cacheManager2, null, cacheManager2.getConfiguration().getManagementRESTService());
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
-
- ManagementServerLoader.unregister(cacheManager2.getConfiguration()
- .getManagementRESTService()
- .getBind(), cacheManager2);
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
- ManagementServerLoader.unregister(cacheManager1.getConfiguration()
- .getManagementRESTService()
- .getBind(), cacheManager1);
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STOPPED));
- } finally {
- cacheManager2.shutdown();
- cacheManager1.shutdown();
- }
- }
-
- @Test
- public void testRegistrationLifecycleClustered() throws Exception {
- boolean managementAvailable = ManagementServerLoader.isManagementAvailable();
- assertThat(managementAvailable, is(true));
-
- CacheManager cacheManager1 = createCacheManager("cm-one", "");
- CacheManager cacheManager2 = createCacheManager("cm-two", "");
-
- try {
- ManagementServerLoader.register(cacheManager1, "uuid1", cacheManager1.getConfiguration().getManagementRESTService());
- ManagementServerLoader.ManagementServerHolder managementServerHolder = ManagementServerLoader.MGMT_SVR_BY_BIND.get("");
- DummyManagementServerImpl dms = (DummyManagementServerImpl)managementServerHolder.getManagementServer();
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
-
- ManagementServerLoader.register(cacheManager2, "uuid2", cacheManager2.getConfiguration().getManagementRESTService());
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
-
- ManagementServerLoader.unregister("", cacheManager1);
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STARTED));
-
- ManagementServerLoader.unregister("", cacheManager2);
- assertThat(dms.status, is(DummyManagementServerImpl.Status.STOPPED));
- } finally {
- cacheManager2.shutdown();
- cacheManager1.shutdown();
- }
- }
-
- private static net.sf.ehcache.CacheManager createCacheManager(String name, String bind) {
- Configuration cfg = new Configuration().name(name);
- ManagementRESTServiceConfiguration managementRESTServiceConfiguration = new ManagementRESTServiceConfiguration();
- managementRESTServiceConfiguration.setBind(bind);
- cfg.managementRESTService(managementRESTServiceConfiguration);
- return new net.sf.ehcache.CacheManager(cfg);
- }
-
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-scheduled-refresh/checkstyle/checkstyle.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-scheduled-refresh/checkstyle/checkstyle.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-scheduled-refresh/checkstyle/checkstyle.xml (revision 0)
@@ -1,240 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/domain/Account.hbm.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/domain/Account.hbm.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/domain/Account.hbm.xml (revision 0)
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/hibernate.cfg.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/hibernate.cfg.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/hibernate-config/nontransactional/hibernate.cfg.xml (revision 0)
@@ -1,53 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- org.apache.derby.jdbc.ClientDriver
-
-
- jdbc:derby://localhost:__PORT__/MyDbTest;create=true
-
-
- user1
- user1
-
-
- 1
-
-
-
- org.hibernate.dialect.DerbyDialect
-
-
-
- thread
-
- true
- true
- true
- net.sf.ehcache.hibernate.EhCacheRegionFactory
- /ehcache.xml
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/lifecycle/cache-listing.xml
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/lifecycle/cache-listing.xml (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/resources/lifecycle/cache-listing.xml (revision 0)
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/BatchOperation.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/BatchOperation.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/BatchOperation.java (revision 0)
@@ -1,33 +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.writebehind.operations;
-
-import net.sf.ehcache.writer.CacheWriter;
-
-/**
- * Interface to implement batch operations that are executed on a cache writer
- *
- * @author Geert Bevin
- * @version $Id: BatchOperation.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public interface BatchOperation {
- /**
- * Perform the batch operation for a particular batch writer
- *
- * @param cacheWriter the cache writer this operation should be performed upon
- */
- void performBatchOperation(CacheWriter cacheWriter);
-}
Index: rctags/ehcache-2.10.7.0.37/distribution/.settings/org.eclipse.jdt.core.prefs
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0)
@@ -1,342 +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=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-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=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=error
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=error
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-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=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=error
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error
-org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-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=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=error
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-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=error
-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.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ThreadIgnore.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ThreadIgnore.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/ThreadIgnore.java (revision 0)
@@ -1,29 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests;
-
-public class ThreadIgnore {
- private final String firstFramePackage;
- private final String threadNamePrefix;
-
- public ThreadIgnore(String threadNamePrefix, String firstFramePackage) {
- this.threadNamePrefix = threadNamePrefix;
- this.firstFramePackage = firstFramePackage;
- }
-
- public boolean canIgnore(SimpleThreadInfo info) {
- if (info.getName().startsWith(threadNamePrefix)) {
-
- String[] stack = info.getStackTraceArray();
- if (stack.length > 1) {
- String frame = stack[stack.length - 2].trim().replaceFirst("at ", "");
- if (frame.startsWith(firstFramePackage)) { return true; }
- } else {
- return true;
- }
- }
-
- return false;
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/RotatingSnapshotFile.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/RotatingSnapshotFile.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/terracotta/RotatingSnapshotFile.java (revision 0)
@@ -1,279 +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.terracotta;
-
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import net.sf.ehcache.DiskStorePathManager;
-import net.sf.ehcache.util.PreferredLoaderObjectInputStream;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A file will rotate on every write, so to never loose older values in case of a JVM crash
- *
- * @author Alex Snaps
- */
-class RotatingSnapshotFile {
-
- private static final Logger LOG = LoggerFactory.getLogger(RotatingSnapshotFile.class);
-
- private static final String SUFFIX_OK = ".keySet";
- private static final String SUFFIX_PROGRESS = SUFFIX_OK + ".temp";
- private static final String SUFFIX_MOVE = SUFFIX_OK + ".old";
-
- private volatile boolean shutdownOnThreadInterrupted;
- private final String cacheName;
-
- private final Lock readLock;
- private final Lock writeLock;
- private final DiskStorePathManager diskStorePathManager;
-
- private final ClassLoader classLoader;
-
- {
- ReadWriteLock rwl = new ReentrantReadWriteLock();
- readLock = rwl.readLock();
- writeLock = rwl.writeLock();
- }
-
- /**
- * Constructor
- *
- * @param cacheName use as base name of the files
- */
- RotatingSnapshotFile(final DiskStorePathManager diskStorePathManager, final String cacheName, final ClassLoader classLoader) {
- this.diskStorePathManager = diskStorePathManager;
- this.cacheName = cacheName;
- this.classLoader = classLoader;
- }
-
- /**
- * Writes all values of the iterable to a new file and does the necessary clean up when done
- *
- * @param localKeys the iterable of entries to write to disk
- * @throws IOException If the underlying OutputStream do throw
- */
- void writeAll(final Iterable localKeys) throws IOException {
- writeLock.lock();
- long writtenKeys = 0;
- try {
- File inProgress = newSnapshotFile();
-
- cleanUp(inProgress);
- if (!inProgress.createNewFile()) {
- throw new AssertionError("The file '" + inProgress.getAbsolutePath() + "' exists already!");
- }
-
- final FileOutputStream fileOutputStream = new FileOutputStream(inProgress);
- final ObjectOutputStream oos = new ObjectOutputStream(fileOutputStream);
-
- try {
- for (Object localKey : localKeys) {
- if (shutdownOnThreadInterrupted && Thread.currentThread().isInterrupted()) {
- return;
- }
- oos.writeObject(localKey);
- ++writtenKeys;
- }
- } finally {
- fileOutputStream.close();
- }
-
- swapForOldWithNewSnapshot(inProgress);
- } finally {
- LOG.info("Did a snapshot of " + writtenKeys + " local keys");
- writeLock.unlock();
- }
- }
-
- /**
- * Reads all the keys from the file on disk, doing cleanup if required of previously unterminated file written to
- *
- * @param the type of the each element
- * @return the Set of all entries in the latest uncorrupted file on disk
- * @throws IOException If the underlying FileInputStream does throw
- */
- Set readAll() throws IOException {
-
- cleanUp();
-
- readLock.lock();
- try {
-
- final File currentSnapshot = currentSnapshotFile();
- if (!currentSnapshot.exists()) {
- return Collections.emptySet();
- }
-
- final Set values = new HashSet();
- FileInputStream fis = new FileInputStream(currentSnapshot);
- try {
- ObjectInputStream ois = new PreferredLoaderObjectInputStream(fis, classLoader);
- boolean eof = false;
- while (!eof) {
- try {
- values.add((T)ois.readObject());
- } catch (Exception e) {
- if (e instanceof EOFException) {
- eof = true;
- }
- // Ignore all other errors, and keep on trying to load keys
- }
- }
- try {
- ois.close();
- } catch (IOException e) {
- LOG.error("Error closing ObjectInputStream", e);
- closeAndDeleteAssociatedFileOnFailure(fis, currentSnapshot);
- }
-
- } catch (IOException e) {
- closeAndDeleteAssociatedFileOnFailure(fis, currentSnapshot);
- }
- return Collections.unmodifiableSet(values);
- } finally {
- readLock.unlock();
- }
- }
-
- private void cleanUp() {
- if (requiresCleanUp()) {
- writeLock.lock();
- try {
- cleanUp(newSnapshotFile());
- } finally {
- writeLock.unlock();
- }
- }
- }
-
- private void cleanUp(final File inProgress) {
- if (requiresCleanUp()) {
- final File dest = currentSnapshotFile();
- if (dest.exists() && !inProgress.delete()) {
- throw new RuntimeException("Couldn't cleanup old file " + inProgress.getAbsolutePath());
- } else {
- final File tempFile = tempSnapshotFile();
- if (tempFile.exists() && !tempFile.delete()) {
- throw new RuntimeException("Couldn't cleanup temp file " + tempFile.getAbsolutePath());
- }
- if (inProgress.exists() && !inProgress.renameTo(dest)) {
- throw new RuntimeException("Couldn't rename new snapshot: " + dest.getAbsolutePath());
- }
- }
- }
- }
-
- private boolean requiresCleanUp() {
- return newSnapshotFile().exists();
- }
-
- private void swapForOldWithNewSnapshot(final File inProgress) {
- File currentSnapshot = currentSnapshotFile();
- final File tempFile = tempSnapshotFile();
- if (currentSnapshot.exists() && !currentSnapshot.renameTo(tempFile)) {
- throw new RuntimeException("Couldn't rename previous snapshot: " + currentSnapshot.getAbsolutePath());
- }
- if (!inProgress.renameTo(currentSnapshot)) {
- throw new RuntimeException("Couldn't rename new snapshot: " + currentSnapshot.getAbsolutePath());
- }
- if (tempFile.exists() && !tempFile.delete()) {
- throw new RuntimeException("Couldn't delete temp file " + tempFile.getAbsolutePath());
- }
- }
-
- /**
- * Creates a File representing the uncorrupted file on disk
- *
- * @return the file to read from
- */
- File currentSnapshotFile() {
- return diskStorePathManager.getFile(cacheName, SUFFIX_OK);
- }
-
- /**
- * Creates a File representing the one to write new entries to
- *
- * @return the File to write to
- */
- File newSnapshotFile() {
- return diskStorePathManager.getFile(cacheName, SUFFIX_PROGRESS);
- }
-
- /**
- * Creates a File representing the old uncorrupted file, when the new one has successfully been written to disk
- *
- * @return the File representing the previous successful snapshot (temp file to be deleted)
- */
- File tempSnapshotFile() {
- return diskStorePathManager.getFile(cacheName, SUFFIX_MOVE);
- }
-
- /**
- * Whether to shutdown as soon as the writer Thread is interrupted, or to let all keys be written to disk first
- *
- * @param shutdownOnThreadInterrupted true, if shutdown needs to happen in the middle of a write
- */
- void setShutdownOnThreadInterrupted(final boolean shutdownOnThreadInterrupted) {
- this.shutdownOnThreadInterrupted = shutdownOnThreadInterrupted;
- }
-
- private void closeAndDeleteAssociatedFileOnFailure(final FileInputStream fis, final File associatedFile) {
- try {
- fis.close();
- } catch (IOException e) {
- LOG.error("Couldn't close FileInputStream on {}, deleting the file!", associatedFile.getAbsolutePath(), e);
- if (associatedFile.exists() && !associatedFile.delete()) {
- LOG.error("Couldn't delete file {}", associatedFile.getAbsolutePath(), e);
- }
- }
- }
-
- /**
- * Calling this method will result in writing all keys to be written to disk
- * or wait for the one in progress to finish
- *
- * @param localKeys the latest current local set
- * @throws IOException On exception being thrown while doing the snapshot
- */
- void snapshotNowOrWaitForCurrentToFinish(final Set localKeys) throws IOException {
- if (writeLock.tryLock()) {
- try {
- writeAll(localKeys);
- } finally {
- writeLock.unlock();
- }
- } else {
- writeLock.lock();
- writeLock.unlock();
- }
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/QueryStats.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/QueryStats.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/QueryStats.java (revision 0)
@@ -1,283 +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.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-
-import org.hibernate.stat.QueryStatistics;
-
-/**
- * @author gkeim
- *
- */
-public class QueryStats implements Serializable {
- private static final String COMPOSITE_TYPE_NAME = "QueryStats";
- private static final String COMPOSITE_TYPE_DESCRIPTION = "Statistics per Query";
- private static final String[] ITEM_NAMES = new String[] {"query", "cacheHitCount",
- "cacheMissCount", "cachePutCount", "executionCount", "executionRowCount", "executionAvgTime", "executionMaxTime",
- "executionMinTime", };
- private static final String[] ITEM_DESCRIPTIONS = new String[] {"query", "cacheHitCount",
- "cacheMissCount", "cachePutCount", "executionCount", "executionRowCount", "executionAvgTime", "executionMaxTime",
- "executionMinTime", };
- private static final OpenType[] ITEM_TYPES = new OpenType[] {SimpleType.STRING, SimpleType.LONG,
- SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
- SimpleType.LONG, };
- private static final CompositeType COMPOSITE_TYPE;
- private static final String TABULAR_TYPE_NAME = "Statistics by Query";
- private static final String TABULAR_TYPE_DESCRIPTION = "All Query Statistics";
- private static final String[] INDEX_NAMES = new String[] {"query", };
- private static final TabularType TABULAR_TYPE;
-
- static {
- try {
- COMPOSITE_TYPE = new CompositeType(COMPOSITE_TYPE_NAME, COMPOSITE_TYPE_DESCRIPTION, ITEM_NAMES,
- ITEM_DESCRIPTIONS, ITEM_TYPES);
- TABULAR_TYPE = new TabularType(TABULAR_TYPE_NAME, TABULAR_TYPE_DESCRIPTION, COMPOSITE_TYPE, INDEX_NAMES);
- } catch (OpenDataException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * query
- */
- protected final String query;
-
- /**
- * cacheHitCount
- */
- protected long cacheHitCount;
-
- /**
- * cacheMissCount
- */
- protected long cacheMissCount;
-
- /**
- * cachePutCount
- */
- protected long cachePutCount;
-
- /**
- * executionCount
- */
- protected long executionCount;
-
- /**
- * executionRowCount
- */
- protected long executionRowCount;
-
- /**
- * executionAvgTime
- */
- protected long executionAvgTime;
-
- /**
- * executionMaxTime
- */
- protected long executionMaxTime;
-
- /**
- * executionMinTime
- */
- protected long executionMinTime;
-
- /**
- * @param name
- */
- public QueryStats(String name) {
- this.query = name;
- }
-
- /**
- * @param name
- * @param src
- */
- public QueryStats(String name, QueryStatistics src) {
- this(name);
-
- try {
- this.cacheHitCount = BeanUtils.getLongBeanProperty(src, "cacheHitCount");
- this.cacheMissCount = BeanUtils.getLongBeanProperty(src, "cacheMissCount");
- this.cachePutCount = BeanUtils.getLongBeanProperty(src, "cachePutCount");
- this.executionCount = BeanUtils.getLongBeanProperty(src, "executionCount");
- this.executionRowCount = BeanUtils.getLongBeanProperty(src, "executionRowCount");
- this.executionAvgTime = BeanUtils.getLongBeanProperty(src, "executionAvgTime");
- this.executionMaxTime = BeanUtils.getLongBeanProperty(src, "executionMaxTime");
- this.executionMinTime = BeanUtils.getLongBeanProperty(src, "executionMinTime");
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException("Exception retrieving statistics", e);
- }
- }
-
- /**
- * @param cData
- */
- public QueryStats(final CompositeData cData) {
- int i = 0;
- query = (String) cData.get(ITEM_NAMES[i++]);
- cacheHitCount = (Long) cData.get(ITEM_NAMES[i++]);
- cacheMissCount = (Long) cData.get(ITEM_NAMES[i++]);
- cachePutCount = (Long) cData.get(ITEM_NAMES[i++]);
- executionCount = (Long) cData.get(ITEM_NAMES[i++]);
- executionRowCount = (Long) cData.get(ITEM_NAMES[i++]);
- executionAvgTime = (Long) cData.get(ITEM_NAMES[i++]);
- executionMaxTime = (Long) cData.get(ITEM_NAMES[i++]);
- executionMinTime = (Long) cData.get(ITEM_NAMES[i++]);
- }
-
- private static int safeParseInt(String s) {
- try {
- return Integer.parseInt(s);
- } catch (Exception e) {
- return -1;
- }
- }
-
- /**
- * @param stats
- */
- public void add(QueryStats stats) {
- cacheHitCount += stats.getCacheHitCount();
- cacheMissCount += stats.getCacheMissCount();
- cachePutCount += stats.getCachePutCount();
- executionCount += stats.getExecutionCount();
- executionRowCount += stats.getExecutionRowCount();
- executionAvgTime += stats.getExecutionAvgTime();
- executionMaxTime += stats.getExecutionMaxTime();
- executionMinTime += stats.getExecutionMinTime();
- }
-
- /**
- * toString
- */
- @Override
- public String toString() {
- return "query=" + query + ", cacheHitCount=" + cacheHitCount + ", cacheMissCount=" + cacheMissCount
- + ", cachePutCount=" + cachePutCount + ", executionCount=" + executionCount + ", executionRowCount="
- + executionRowCount + ", executionAvgTime=" + executionAvgTime + ", executionMaxTime=" + executionMaxTime
- + ", executionMinTime=" + executionMinTime;
- }
-
- /**
- * getQuery
- */
- public String getQuery() {
- return query;
- }
-
- /**
- * getCacheHitCount
- */
- public long getCacheHitCount() {
- return cacheHitCount;
- }
-
- /**
- * getCacheMissCount
- */
- public long getCacheMissCount() {
- return cacheMissCount;
- }
-
- /**
- * getCachePutCount
- */
- public long getCachePutCount() {
- return cachePutCount;
- }
-
- /**
- * getExecutionCount
- */
- public long getExecutionCount() {
- return executionCount;
- }
-
- /**
- * getExecutionRowCount
- */
- public long getExecutionRowCount() {
- return executionRowCount;
- }
-
- /**
- * getExecutionAvgTime
- */
- public long getExecutionAvgTime() {
- return executionAvgTime;
- }
-
- /**
- * getExecutionMaxTime
- */
- public long getExecutionMaxTime() {
- return executionMaxTime;
- }
-
- /**
- * getExecutionMinTime
- */
- public long getExecutionMinTime() {
- return executionMinTime;
- }
-
- /**
- * toCompositeData
- */
- public CompositeData toCompositeData() {
- try {
- return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES, new Object[] {query, cacheHitCount, cacheMissCount,
- cachePutCount, executionCount, executionRowCount, executionAvgTime, executionMaxTime, executionMinTime, });
- } catch (OpenDataException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * newTabularDataInstance
- */
- public static TabularData newTabularDataInstance() {
- return new TabularDataSupport(TABULAR_TYPE);
- }
-
- /**
- * fromTabularData
- */
- public static QueryStats[] fromTabularData(final TabularData tabularData) {
- final List countList = new ArrayList(tabularData.size());
- for (final Iterator pos = tabularData.values().iterator(); pos.hasNext();) {
- countList.add(new QueryStats((CompositeData) pos.next()));
- }
- return countList.toArray(new QueryStats[countList.size()]);
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/package.html
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/package.html (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/package.html (revision 0)
@@ -1,7 +0,0 @@
-
-
-
-
-This package contains classes for ehcache search attributes
-
-
Index: rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/xa/DummyTransaction.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/xa/DummyTransaction.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/system-tests/src/test/java/org/terracotta/ehcache/tests/xa/DummyTransaction.java (revision 0)
@@ -1,59 +0,0 @@
-/*
- * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
- */
-package org.terracotta.ehcache.tests.xa;
-
-import javax.transaction.Synchronization;
-import javax.transaction.Transaction;
-import javax.transaction.xa.XAResource;
-
-public class DummyTransaction implements Transaction {
-
- private final long id;
-
- public DummyTransaction(long id) {
- this.id = id;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof DummyTransaction) {
- DummyTransaction otherTx = (DummyTransaction) o;
- return otherTx.id == id;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return (int) id;
- }
-
- public void commit() throws SecurityException {
- //
- }
-
- public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException {
- return true;
- }
-
- public boolean enlistResource(XAResource xaResource) throws IllegalStateException {
- return true;
- }
-
- public int getStatus() {
- return 0;
- }
-
- public void registerSynchronization(Synchronization synchronization) throws IllegalStateException {
- //
- }
-
- public void rollback() throws IllegalStateException {
- //
- }
-
- public void setRollbackOnly() throws IllegalStateException {
- //
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/loader/CountingCacheLoaderFactory.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/loader/CountingCacheLoaderFactory.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/loader/CountingCacheLoaderFactory.java (revision 0)
@@ -1,51 +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;
-
-
-import net.sf.ehcache.Ehcache;
-
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * A factory for creating counting cache loaders. This can be hooked up to the JCacheFactory by
- * specifying "cacheLoaderFactoryClassName" in the environment
- *
- * @author Greg Luck
- * @version $Id: CountingCacheLoaderFactory.java 5594 2012-05-07 16:04:31Z cdennis $
- */
-public class CountingCacheLoaderFactory extends CacheLoaderFactory {
-
-
- /**
- */
- public CacheLoader createCacheLoader(Map environment) {
- return new CountingCacheLoader();
- }
-
- /**
- * Creates a CacheLoader using the Ehcache configuration mechanism at the time the associated cache is created.
- *
- * @param properties implementation specific properties. These are configured as comma
- * separated name value pairs in ehcache.xml
- * @return a constructed CacheLoader
- */
- public CacheLoader createCacheLoader(Ehcache cache, Properties properties) {
- return new CountingCacheLoader();
- }
-}
Index: rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java
===================================================================
diff -u -N
--- rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10990)
+++ rctags/ehcache-2.10.7.0.37/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0)
@@ -1,309 +0,0 @@
-package net.sf.ehcache.constructs.eventual;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.reset;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-import net.sf.ehcache.config.CacheConfiguration;
-import net.sf.ehcache.config.ElementValueComparatorConfiguration;
-import net.sf.ehcache.config.TerracottaConfiguration;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.terracotta.test.categories.CheckShorts;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * StronglyConsistentCacheAccessorTest
- */
-@Category(CheckShorts.class)
-public class StronglyConsistentCacheAccessorTest {
-
- @Test
- public void refusesStandaloneCache() {
- try {
- new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600));
- fail("Underlying cache not clustered and eventual");
- } catch (Exception e) {
- assertThat(e, instanceOf(IllegalArgumentException.class));
- }
- }
-
- @Test
- public void refusesClusteredButNoEventualCache() {
- TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class);
- CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class);
- Ehcache underlyingCache = mock(Ehcache.class);
-
- when(underlyingCache.getName()).thenReturn("testCache");
- when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration);
- when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration);
- when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG);
-
- try {
- new StronglyConsistentCacheAccessor(underlyingCache);
- fail("Underlying cache clustered but not eventual");
- } catch (Exception e) {
- assertThat(e, instanceOf(IllegalArgumentException.class));
- }
- }
-
- @Test
- public void acceptClusteredAndEventualUnderlyingCache() {
- Ehcache underlyingCache = buildMockCache();
-
- new StronglyConsistentCacheAccessor(underlyingCache);
- }
-
- @Test
- public void testPutIfAbsent() {
- Element element = new Element("key", "value");
- Ehcache underlyingCache = buildMockCache();
- when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element);
-
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache);
- element = cacheAccessor.putIfAbsent(element);
- assertThat(element, nullValue());
-
-
- element = cacheAccessor.putIfAbsent(new Element("key", "otherValue"));
- assertThat(element.getObjectValue(), equalTo((Object)"value"));
-
- try {
- cacheAccessor.putIfAbsent(new Element(null, null));
- fail("Expected NPE with null key");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @Test
- public void testSingleArgReplace() {
- Element element = new Element("key", "value");
- Ehcache underlyingCache = buildMockCache();
- when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element);
-
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache);
- element = cacheAccessor.replace(element);
- assertThat(element, nullValue());
-
-
- element = cacheAccessor.replace(new Element("key", "otherValue"));
- assertThat(element.getObjectValue(), equalTo((Object)"value"));
-
- try {
- cacheAccessor.replace(new Element(null, null));
- fail("Expected NPE with null key");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @Test
- public void testTwoArgReplace() {
- Element element = new Element("key", "value");
- Ehcache underlyingCache = buildMockCache();
- when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element);
-
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache);
- assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false));
- assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true));
-
- try {
- cacheAccessor.replace(new Element(null, null), new Element("key", "other"));
- fail("Expected NPE with null key");
- } catch (NullPointerException e) {
- // Expected
- }
-
- try {
- cacheAccessor.replace(new Element("key", "other"), new Element(null, null));
- fail("Expected NPE with null key");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @Test
- public void testRemoveElement() {
- Element element = new Element("key", "value");
- Ehcache underlyingCache = buildMockCache();
- when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element);
- when(underlyingCache.remove((Object)"key")).thenReturn(true);
-
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache);
- assertThat(cacheAccessor.removeElement(element), is(false));
- assertThat(cacheAccessor.removeElement(element), is(true));
-
- try {
- cacheAccessor.removeElement(new Element(null, null));
- fail("Expected NPE with null key");
- } catch (NullPointerException e) {
- // Expected
- }
- }
-
- @Test
- public void putMethodsDoWriteLock() throws Exception {
- Ehcache ehcache = buildMockCache();
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache);
-
- String key = "test";
- Element element = new Element(key, "test");
-
- String put = "put";
- Set putMethods = getMethodsMatching(put);
- for (Method putMethod : putMethods) {
- int paramLength = putMethod.getParameterTypes().length;
- Object[] params = new Object[paramLength];
- if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) {
- params[0] = Collections.singleton(element);
- } else {
- params[0] = element;
- }
- if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) {
- params[1] = false;
- }
- System.out.println("Invoking " + putMethod.getName());
- putMethod.invoke(cacheAccessor, params);
- verify(ehcache).acquireWriteLockOnKey(key);
- verify(ehcache).releaseWriteLockOnKey(key);
- reset(ehcache);
- }
- }
-
- @Test
- public void replaceMethodsDoWriteLock() throws Exception {
- Ehcache ehcache = buildMockCache();
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache);
-
- String key = "test";
- Element element = new Element(key, "test");
-
- Set replaceMethods = getMethodsMatching("replace");
- for (Method replaceMethod : replaceMethods) {
- int paramLength = replaceMethod.getParameterTypes().length;
- Object[] params = new Object[paramLength];
- if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) {
- params[0] = Collections.singleton(element);
- } else {
- params[0] = element;
- }
- if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) {
- params[1] = element;
- }
- System.out.println("Invoking " + replaceMethod.getName());
- replaceMethod.invoke(cacheAccessor, params);
- verify(ehcache).acquireWriteLockOnKey(key);
- verify(ehcache).releaseWriteLockOnKey(key);
- reset(ehcache);
- }
- }
-
- @Test
- public void removeMethodsDoWriteLock() throws Exception {
- Ehcache ehcache = buildMockCache();
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache);
-
- String key = "test";
- Element element = new Element(key, "someValue");
-
- String remove = "remove";
- Set removeMethods = getMethodsMatching(remove, "Property");
- for (Method removeMethod : removeMethods) {
- System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")");
- int paramLength = removeMethod.getParameterTypes().length;
- if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) {
- continue;
- }
- Object[] params = new Object[paramLength];
- if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) {
- params[0] = Collections.singleton(key);
- } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) {
- params[0] = element;
- } else {
- params[0] = key;
- }
- if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) {
- params[1] = false;
- }
- System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params));
- removeMethod.invoke(cacheAccessor, params);
- verify(ehcache).acquireWriteLockOnKey(key);
- verify(ehcache).releaseWriteLockOnKey(key);
- reset(ehcache);
- }
- }
-
- @Test
- public void getMethodsDoReadLock() throws Exception {
- Ehcache ehcache = buildMockCache();
- StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache);
-
- String key = "key";
- String get = "get";
- Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid");
- for (Method getMethod : getMethods) {
- System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")");
- int paramLength = getMethod.getParameterTypes().length;
- Object[] params = new Object[paramLength];
- if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) {
- params[0] = Collections.singleton(key);
- } else {
- params[0] = key;
- }
-
- System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params));
- getMethod.invoke(cacheAccessor, params);
- verify(ehcache).acquireReadLockOnKey(key);
- verify(ehcache).releaseReadLockOnKey(key);
- reset(ehcache);
- }
- }
-
- private Set getMethodsMatching(String put, String... excludes) {
- Set