Index: rctags/ehcache-2.10.9.1.15/system-tests/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/pom.xml (revision 0) @@ -1,291 +0,0 @@ - - 4.0.0 - - org.terracotta - system-tests-parent - 4.3.9.1.2 - - - net.sf.ehcache.internal - ehcache-terracotta-system-tests - 2.10.9.1.15 - ehcache-terracotta-system-tests - System tests for ehcache-terracotta - - 512m - 1024m - -XX:MaxPermSize=512m - true - 10.10.1.1 - 2.2.3 - 1.7.25 - 1.9 - - - - org.terracotta - terracotta - ${terracotta.core.version} - - - javax.servlet - javax.servlet-api - - - - - net.sf.ehcache - ehcache - ${project.version} - test - - - net.sf.ehcache - management-ehcache-v1 - ${project.version} - test - - - net.sf.ehcache - management-ehcache-v2 - ${project.version} - test - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.core.version} - test - - - org.ow2.asm - asm - 7.2 - test - - - org.hibernate - hibernate-core - 3.3.2.GA - test - - - javassist - javassist - 3.8.0.GA - test - - - org.apache.derby - derby - ${derby.version} - test - - - org.apache.derby - derbynet - ${derby.version} - test - - - org.apache.derby - derbyclient - ${derby.version} - test - - - javax.transaction - jta - 1.1 - test - - - org.codehaus.btm - btm - 2.1.3 - test - - - org.apache.geronimo.specs - geronimo-jta_1.0.1B_spec - 1.0.1 - test - - - com.atomikos - transactions-jta - 3.8.0 - test - - - org.mockito - mockito-all - - - - - org.ow2.jotm - jotm-core - 2.1.9 - test - - - commons-logging - commons-logging - - - commons-logging - commons-logging-api - - - - - org.terracotta.test - container-test-framework - - - org.quartz-scheduler - quartz - ${quartz.version} - - - io.rest-assured - rest-assured - - - org.codehaus.groovy - groovy - - - org.codehaus.groovy - groovy-json - - - org.codehaus.groovy - groovy-xml - - - net.sf.ehcache.test - hibernate-ehcache-bundle - ${osgi-test-tool.version} - - - org.terracotta.test - osgi-test-utils - ${osgi-test-tool.version} - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - test-jar - - test-jar - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-depends-file - - generate-depends-file - - - - - - - - - include-container-tests - - - appserver - - - - - - org.terracotta - maven-forge-plugin - - - **/container/**/*Test.java - - - - - - - - no-appserver-tests - - - appserver - no-appserver - - - - - - org.terracotta - maven-forge-plugin - - -Xmx768m - -XX:MaxPermSize=128m - - **/*Test.java - - - - - - - - deploy-sonatype - - true - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - jboss - JBoss Repository - https://repository.jboss.org/nexus/content/repositories/public/ - - true - - - false - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/pom.xml (revision 0) @@ -1,537 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - - - net.sf.ehcache.internal - ehcache-core - jar - - ehcache-core - Internal ehcache-core module. This artifact is not meant to be used directly - - - Ehcache - UTF-8 - UTF-8 - 5 - src/test/java - src/test/resources - ehcache - false - - -Xmx64m - - - - - - org.slf4j - slf4j-api - - - org.terracotta.internal - statistics - - - - - javax.servlet - javax.servlet-api - - - org.hibernate - hibernate-core - - - javax.transaction - jta - - - net.sf.ehcache - sizeof-agent - - - - - org.slf4j - slf4j-jdk14 - - - commons-logging - commons-logging - - - org.codehaus.btm - btm - - - net.sf.hibernate - hibernate - - - org.hamcrest - hamcrest - - - junit - junit - - - hamcrest-core - org.hamcrest - - - - - dom4j - dom4j - - - javassist - javassist - - - org.hibernate - hibernate-ehcache - - - org.apache.derby - derby - - - org.mockito - mockito-core - - - com.sun.xsom - xsom - - - org.beanshell - bsh - - - - - - - src/main/resources - true - - - ${project.build.directory}/generated-resources - false - - - ${basedir}/${testDir} - - - ${basedir}/src/main/config/jcache - - - ${basedir}/${testResources} - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - test-jar - - test-jar - - - - - - - org.terracotta - maven-forge-plugin - - 1 - false - ${tests.supplemental.args} ${tests.max.heap.size} - false - false - true - plain - false - - true - ${net.sf.ehcache.speedAdjustmentFactor} - ${project.build.directory} - true - - - net.sf.ehcache:sizeof-agent - - - - - build-info - generate-resources - - buildinfo - - - ${basedir}/.. - - - - - default-test - - - **/*$* - **/*PerfTest.java - **/*PerfTest*.java - **/Abstract*Test.java - - - - - integration-test-execution - integration-test - - test - - - ${checkshort} - false - - **/*$* - - - **/IT*.java - **/*IT.java - **/*ITCase.java - - ${tests.supplemental.args} -Xms512m -Xmx512m - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - verify - - checkstyle - - - - - ${basedir}/checkstyle/checkstyle.xml - ${basedir}/checkstyle/suppressions.xml - ${basedir}/checkstyle/ClassHeader.txt - ${skipCheckstyle} - false - false - false - false - false - false - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - generate-resources - copy-agent-jar-to-resources - - copy-dependencies - - - * - sizeof-agent - ${project.build.directory}/generated-resources/net/sf/ehcache/pool/sizeof/ - true - true - - - - - - org.codehaus.mojo - rmic-maven-plugin - - - rmi-compilation - compile - - rmic - - - - **/RMICachePeer.class - - ${project.build.outputDirectory} - - - - - - org.glassfish.corba - rmic - 4.2.1 - - - - - - - - - skip-ehcache-core-deploy - - true - - - - staging - - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - deploy - - sign - - - - - - - - - perfTests - - - - org.terracotta - maven-forge-plugin - - - - default-test - - ${tests.supplemental.args} -Xmx512m - - **/*PerfTest.java - **/*PerfTest*.java - - - **/*$* - **/Abstract*Test.java - - - - - - - - - - - buildnumber-git - - - - org.codehaus.mojo - buildnumber-maven-plugin - 1.0-beta-3 - - - generate-resources - - create - - - - - false - false - {0,date,yyyy-MM-dd_HH-mm}_{1} - - timestamp - ${user.name} - - - - - - - - - - no-interruptible-io-solaris - - - java.vendor - Sun Microsystems Inc. - - - - -XX:-UseVMInterruptibleIO - - - - enable-system-gc-jrockit - - - java.vm.name - Oracle JRockit(R) - - - - -XXfullSystemGC -Xverbose:systemgc - - - - ibmj9 - - - java.vm.name - IBM J9 VM - - - - -Xenableexplicitgc - -Xmx256m - - - - - - test-nonstopcache - - - - org.terracotta - maven-forge-plugin - - - **/nonstop/*Test.java - - - **/*$* - - - - java.awt.headless - true - - - - - - - - - - - fast - - true - - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - false - - - true - - - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - true - - - false - - - - - - jboss-releases - http://repository.jboss.org/nexus/content/groups/public-jboss - - true - - - false - - - - - - Java.net Maven 2 - http://download.java.net/maven/2 - - true - - - false - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - false - - - true - - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - true - - - false - - - - - - Index: rctags/ehcache-2.10.9.1.15/terracotta/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/pom.xml (revision 0) @@ -1,74 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - - - net.sf.ehcache.internal - ehcache-terracotta-root - ehcache-terracotta-root - pom - - - bootstrap - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - false - - - true - - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - true - - - false - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - false - - - true - - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - true - - - false - - - - - - - deploy-sonatype - - true - - - - Index: rctags/ehcache-2.10.9.1.15/distribution/events/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/events/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/events/pom.xml (revision 0) @@ -1,248 +0,0 @@ - - 4.0.0 - - org.terracotta.forge - forge-parent - 4.16 - - - net.sf.ehcache.examples - events - 2.10.9.1.15 - events - war - Clustered Ehcache Terracotta as second level cache for Hibernate - - 4.3.9.1.2 - 1.1.116 - 1.1 - true - 9.4.35.v20201120 - - - - org.slf4j - slf4j-api - 1.7.25 - - - ch.qos.logback - logback-classic - 1.2.3 - - - javassist - javassist - 3.8.0.GA - - - h2 - ${h2.version} - com.h2database - - - net.sf.ehcache - ehcache - ${project.version} - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.version} - - - javax.servlet - javax.servlet-api - 3.1.0 - - - org.hibernate - hibernate-core - 3.3.1.GA - - - org.slf4j - slf4j-api - - - javax.transaction - jta - - - - - gf-3122 - gf.javax.transaction - 1.1 - - - - ${project.name} - - - maven-assembly-plugin - 2.3 - - ${project.name} - - src/assemble/distribution.xml - - gnu - - - - package - - single - - - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - ${project.name} - - STOP - - - - hibernate3-maven-plugin - 2.1 - org.codehaus.mojo - - - target/classes/hibernate3hbm2ddl.properties - target/classes/hibernate.cfg.xml - true - true - schema.sql - - - - - com.h2database - h2 - ${h2.version} - - - - - org.terracotta.maven.plugins - tc-maven-plugin - - - org.terracotta - terracotta - ${terracotta.version} - - - - - - - - start-h2 - - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - org.h2.tools.Server - - -tcp - -tcpAllowOthers - - - - - - - - stop-h2 - - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - org.h2.tools.Server - - -tcpShutdown - tcp://localhost:9092 - - - - - - - - 9081 - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - - jetty.port - 9081 - - - 9981 - - - - - - - 9082 - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - - jetty.port - 9082 - - - 9982 - - - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/third-party.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/third-party.txt (revision 11494) +++ rctags/ehcache-2.10.9.1.15/third-party.txt (revision 0) @@ -1,5 +0,0 @@ -This project depends on repackaged GlassFish libraries. -They can be identified by their groupId starting with gf-*. - -The source code for these libraries can be found at https://svn.java.net/svn/glassfish~svn/. -Otherwise contact to get the source code for these libraries. \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/TestCategories.properties =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/TestCategories.properties (revision 11494) +++ rctags/ehcache-2.10.9.1.15/TestCategories.properties (revision 0) @@ -1,328 +0,0 @@ -net.sf.ehcache.AutoVersioningElementTest=production -net.sf.ehcache.CacheClassicLruMemoryStoreTest=production -net.sf.ehcache.CacheCopyOnRwPoolTest=production -net.sf.ehcache.CacheCopyOnRwReplaceRemoveTest=production -net.sf.ehcache.CacheExceptionTest=production -net.sf.ehcache.CacheManagerTest=production -net.sf.ehcache.CachePinningTest=production -net.sf.ehcache.CachePoolPinningTest=production -net.sf.ehcache.CacheTest=production -net.sf.ehcache.ChrisCachePerformanceTest=production -net.sf.ehcache.ClockMemoryStoreTest=production -net.sf.ehcache.DiskStoreTest=production -net.sf.ehcache.DynamicCacheConfigurationTest=production -net.sf.ehcache.ElementTest=production -net.sf.ehcache.ExplicitMaxInMemoryTest=production -net.sf.ehcache.InfiniteCapacityCacheTest=production -net.sf.ehcache.MemoryStoreTester=production -net.sf.ehcache.OverflowCacheTest=production -net.sf.ehcache.PoolCacheManagerTest=production -net.sf.ehcache.RecalculateSizeTest=production -net.sf.ehcache.SameCacheManagerNameTest=production -net.sf.ehcache.StatisticsTest=production -net.sf.ehcache.TerracottaIntegrationTest=production -net.sf.ehcache.XACacheTest=production -net.sf.ehcache.concurrent.ConcurrencyUtilTest=production -net.sf.ehcache.concurrent.ConcurrentCacheMethodsTest=production -net.sf.ehcache.config.CacheConfigConflictTest=production -net.sf.ehcache.config.CacheConfigurationListenerTest=production -net.sf.ehcache.config.CacheConfigurationTest=production -net.sf.ehcache.config.CacheWriterConfigurationTest=production -net.sf.ehcache.config.CoherenceModeConfigTest=production -net.sf.ehcache.config.ConfigurationFactoryTest=production -net.sf.ehcache.config.ConfigurationHelperTest=production -net.sf.ehcache.config.DefaultCacheOptionalTest=production -net.sf.ehcache.config.DynamicCacheConfigurationValidityTest=production -net.sf.ehcache.config.InvalidConfigTest=production -net.sf.ehcache.config.MemoryUnitTest=production -net.sf.ehcache.config.SchemaValidationTest=production -net.sf.ehcache.config.StorageStrategyConfigTest=production -net.sf.ehcache.config.generator.AllConfigurationGeneratedTest=production -net.sf.ehcache.config.generator.ConfigurationGeneratedParsesTest=production -net.sf.ehcache.config.generator.DecoratedCacheConfigTest=production -net.sf.ehcache.config.nonstop.NonStopConfigTest=production -net.sf.ehcache.config.nonstop.NonstopInheritsDefaultConfigTest=production -net.sf.ehcache.constructs.CacheDecoratorFactoryTest=production -net.sf.ehcache.constructs.DecoratorNoNameTest=production -net.sf.ehcache.constructs.DefaultCacheDecoratorFactoryTest=production -net.sf.ehcache.constructs.blocking.BlockingCacheTest=production -net.sf.ehcache.constructs.blocking.SelfPopulatingCacheTest=production -net.sf.ehcache.constructs.blocking.UpdatingSelfPopulatingCacheTest=production -net.sf.ehcache.constructs.locking.ExplicitLockApiTest=production -net.sf.ehcache.constructs.nonstop.BasicNonstopTest=production -net.sf.ehcache.constructs.nonstop.ExecutorServiceTest=production -net.sf.ehcache.constructs.nonstop.NonStopThreadDestroyedTest=production -net.sf.ehcache.constructs.nonstop.NonstopTestUtil=production -net.sf.ehcache.constructs.nonstop.TimeoutOnRejoinTest=production -net.sf.ehcache.distribution.EventMessageTest=production -net.sf.ehcache.distribution.ManualRMIPeerProviderTest=production -net.sf.ehcache.distribution.MulticastRMIPeerProviderTest=production -net.sf.ehcache.distribution.PayloadUtilTest=production -net.sf.ehcache.distribution.RMIBootstrapCacheLoaderTest=production -net.sf.ehcache.distribution.RMICacheManagerPeerListenerTest=production -net.sf.ehcache.distribution.RMICacheManagerPeerTest=production -net.sf.ehcache.distribution.RMICacheReplicatorTest=production -net.sf.ehcache.distribution.RMICacheReplicatorWithLargePayloadTest=production -net.sf.ehcache.distribution.RMIDistributedCacheTest=production -net.sf.ehcache.distribution.ShutdownRMICacheManagerPeerListenerTestImpl=production -net.sf.ehcache.event.BulkOpsEventListenerTest=production -net.sf.ehcache.event.CacheEventListenerTest=production -net.sf.ehcache.event.CacheManagerEventListenerTest=production -net.sf.ehcache.event.EvictionListenerTest=production -net.sf.ehcache.event.ProgrammaticallyCreatedCacheEventListenerTest=production -net.sf.ehcache.event.TestCacheManagerEventListenerFactory=production -net.sf.ehcache.exceptionhandler.CacheExceptionHandlerTest=production -net.sf.ehcache.extension.CacheExtensionTest=production -net.sf.ehcache.extension.TestCacheExtension=production -net.sf.ehcache.extension.TestCacheExtensionFactory=production -net.sf.ehcache.hibernate.EhCacheRegionFactoryTest=production -net.sf.ehcache.hibernate.HibernateAPIUsageTest=production -net.sf.ehcache.hibernate.HibernateCacheTest=production -net.sf.ehcache.hibernate.management.impl.EhcacheStatsImplTest=production -net.sf.ehcache.loader.CacheLoaderTest=production -net.sf.ehcache.loader.CompositeLoaderTest=production -net.sf.ehcache.management.ManagementServiceTest=production -net.sf.ehcache.management.ResourceClassLoaderTest=production -net.sf.ehcache.management.sampled.MBeanRegistrationProviderTest=production -net.sf.ehcache.pool.PoolableStoresTest=production -net.sf.ehcache.pool.TwinCachesTest=production -net.sf.ehcache.pool.sizeof.AgentLoaderRaceTest=production -net.sf.ehcache.pool.sizeof.AgentLoaderSystemPropTest=production -net.sf.ehcache.pool.sizeof.AgentLoaderTest=production -net.sf.ehcache.pool.sizeof.FilteredSizeOfTest=production -net.sf.ehcache.pool.sizeof.ObjectGraphWalkerTest=production -net.sf.ehcache.pool.sizeof.SizeOfTest=production -net.sf.ehcache.pool.sizeof.filter.AnnotationProxyFactoryTest=production -net.sf.ehcache.search.BasicSearchTest=production -net.sf.ehcache.search.QueryExamplesTest=production -net.sf.ehcache.search.SearchTestUtil=production -net.sf.ehcache.search.TestAttributeExtractor=production -net.sf.ehcache.search.TransactionalSearchTest=production -net.sf.ehcache.search.attribute.JavaBeanAttributeExtractorTest=production -net.sf.ehcache.search.attribute.ReflectionAttributeExtractorTest=production -net.sf.ehcache.servermaplocalcache.ServerMapLocalCacheTest=production -net.sf.ehcache.statistics.CacheUsageListenerTest=production -net.sf.ehcache.statistics.DisabledCacheStatisticsTest=production -net.sf.ehcache.statistics.LiveCacheStatisticsTest=production -net.sf.ehcache.store.CacheKeySetTest=production -net.sf.ehcache.store.DiskBackedMemoryStoreTest=production -net.sf.ehcache.store.DiskStoreBootstrapCacheLoaderFactoryTest=production -net.sf.ehcache.store.ElementIdAssigningStoreTest=production -net.sf.ehcache.store.FifoMemoryStoreTest=production -net.sf.ehcache.store.InitialCapacityTest=production -net.sf.ehcache.store.LruClassicMemoryStoreTest=production -net.sf.ehcache.store.LruMemoryStoreTest=production -net.sf.ehcache.store.MemoryOnlyStoreTest=production -net.sf.ehcache.store.MemoryStorePinningTest=production -net.sf.ehcache.store.MemoryStorePoolingTest=production -net.sf.ehcache.store.OffheapStoreInOssTest=production -net.sf.ehcache.store.PoolableMemoryStoreTest=production -net.sf.ehcache.store.XATransactionalStoreTest=production -net.sf.ehcache.store.chm.SelectableConcurrentHashMapTest=production -net.sf.ehcache.store.compound.PartialSerializationCopyStrategyTest=production -net.sf.ehcache.store.compound.TCCLReadWriteSerializationCopyStrategyTest=production -net.sf.ehcache.store.disk.DiskBackMemoryStoreTest=production -net.sf.ehcache.store.disk.DiskStorePoolingTest=production -net.sf.ehcache.store.disk.DiskStoreTest=production -net.sf.ehcache.store.disk.ods.FileAllocationTreeTest=production -net.sf.ehcache.terracotta.BasicRejoinTest=production -net.sf.ehcache.terracotta.BootstrapCacheTest=quarantined -net.sf.ehcache.terracotta.EventReplicationTest=production -net.sf.ehcache.terracotta.KeySnapshotterTest=production -net.sf.ehcache.terracotta.RejoinEventSequenceTest=production -net.sf.ehcache.terracotta.RotatingSnapshotFileTest=production -net.sf.ehcache.terracotta.StorageStrategyInvalidConfigurationTest=production -net.sf.ehcache.terracotta.TerracottaBootstrapCacheLoaderTest=production -net.sf.ehcache.terracotta.TerracottaUnitTesting=production -net.sf.ehcache.terracotta.TerracottaWithLocalOffHeapTest=production -net.sf.ehcache.terracotta.TestRejoinStore=production -net.sf.ehcache.transaction.SoftLockPinningTest=production -net.sf.ehcache.transaction.local.LocalTransactionSizeOfTest=production -net.sf.ehcache.transaction.local.LocalTransactionTest=production -net.sf.ehcache.transaction.xa.TwoPCTest=production -net.sf.ehcache.transaction.xa.XAThreadPoolTest=production -net.sf.ehcache.transaction.xa.XATransactionSizeOfTest=production -net.sf.ehcache.transaction.xa.XATransactionTest=production -net.sf.ehcache.util.LargeCollectionTest=production -net.sf.ehcache.util.MemoryEfficientByteArrayOutputStreamTest=production -net.sf.ehcache.util.MemorySizeParserTest=production -net.sf.ehcache.util.ProductInfoTest=production -net.sf.ehcache.util.SlewClockTest=production -net.sf.ehcache.util.SmokeTests=production -net.sf.ehcache.util.TimestamperTest=production -net.sf.ehcache.util.UpdateCheckerTest=production -net.sf.ehcache.util.WeakIdentityConcurrentMapTest=production -net.sf.ehcache.writer.CacheWriterTest=production -net.sf.ehcache.writer.CoalesceKeysFilterTest=production -net.sf.ehcache.writer.TestCacheWriter=production -net.sf.ehcache.writer.TestCacheWriterException=production -net.sf.ehcache.writer.TestCacheWriterFactory=production -net.sf.ehcache.writer.TestCacheWriterRetries=production -net.sf.ehcache.writer.TestCacheWriterSlow=production -org.terracotta.ehcache.tests.BasicAtomikosXATest=quarantined -org.terracotta.ehcache.tests.BasicBTMXATest=quarantined -org.terracotta.ehcache.tests.BasicStandaloneCacheAndServerTopologyTest=production -org.terracotta.ehcache.tests.BasicStandaloneCacheTest=production -org.terracotta.ehcache.tests.BasicWriteBehindTest=quarantined -org.terracotta.ehcache.tests.CacheBlockingQueueTest=quarantined -org.terracotta.ehcache.tests.CacheConsistencyTest=production -org.terracotta.ehcache.tests.CacheLocksTest=quarantined -org.terracotta.ehcache.tests.CacheWriterBTMXATest=quarantined -org.terracotta.ehcache.tests.ClusterCacheEventsRejoinEnabledTest=quarantined -org.terracotta.ehcache.tests.ClusterEventsRejoinEnabledTest=quarantined -org.terracotta.ehcache.tests.ClusterEventsTest=production -org.terracotta.ehcache.tests.ClusteredCacheRemovalTest=quarantined -org.terracotta.ehcache.tests.CoalescingWriteBehindTest=quarantined -org.terracotta.ehcache.tests.CompressedCacheTest=production -org.terracotta.ehcache.tests.ConcurrencyValueTest=quarantined -org.terracotta.ehcache.tests.CopyOnWriteTest=production -org.terracotta.ehcache.tests.DoubleConfigStandaloneCacheTest=production -org.terracotta.ehcache.tests.EmbeddedConfigNamespaceStandaloneCacheTest=production -org.terracotta.ehcache.tests.EmbeddedConfigStandaloneCacheTest=production -org.terracotta.ehcache.tests.EmbeddedEhcacheJarTest=production -org.terracotta.ehcache.tests.EmbeddedEhcacheJarTestClient=production -org.terracotta.ehcache.tests.ExpiryListenerTest=production -org.terracotta.ehcache.tests.ExplicitlyUnclusteredStandaloneCacheTest=production -org.terracotta.ehcache.tests.ExpressShutdownTest=production -org.terracotta.ehcache.tests.GetKeysSerializedCacheTest=production -org.terracotta.ehcache.tests.HibernateExpressShutdownTest=production -org.terracotta.ehcache.tests.LocalTxTest=production -org.terracotta.ehcache.tests.MemoryStoreEvictionPolicyTest=production -org.terracotta.ehcache.tests.MixedCacheTest=production -org.terracotta.ehcache.tests.NamelessCacheManagerStandaloneCacheTest=production -org.terracotta.ehcache.tests.NoTcConfigStandaloneCacheTest=production -org.terracotta.ehcache.tests.OtherClassLoaderEventTest=production -org.terracotta.ehcache.tests.OtherClassloaderCacheTest=production -org.terracotta.ehcache.tests.OverflowToDiskStandaloneCacheTest=production -org.terracotta.ehcache.tests.SerializationWriteBehindTest=production -org.terracotta.ehcache.tests.SerializedArrayCacheTest=production -org.terracotta.ehcache.tests.SuspendResumeAtomikosXATest=production -org.terracotta.ehcache.tests.SuspendResumeBTMXATest=production -org.terracotta.ehcache.tests.SynchronousWriteBehindTest=production -org.terracotta.ehcache.tests.SystemPropTcConfigTest=production -org.terracotta.ehcache.tests.ThreadLocalTest=production -org.terracotta.ehcache.tests.TwoResourceAtomikosXATest=production -org.terracotta.ehcache.tests.TwoResourceBTMXATest=production -org.terracotta.ehcache.tests.TwoResourceSuspendResumeAtomikosXATest=production -org.terracotta.ehcache.tests.TwoResourceSuspendResumeBTMXATest=production -org.terracotta.ehcache.tests.UrlConfigStandaloneCacheTest=production -org.terracotta.ehcache.tests.XAResourceTest=production -org.terracotta.ehcache.tests.coherence.CacheCoherenceExpressTest=quarantined -org.terracotta.ehcache.tests.coherence.IncoherentNodesTest=quarantined -org.terracotta.ehcache.tests.coherence.RestartingL1ExpressTest=quarantined -org.terracotta.ehcache.tests.container.BasicContainerJTATest=production -org.terracotta.ehcache.tests.container.BasicContainerTest=production -org.terracotta.ehcache.tests.container.BasicJTATestServlet=production -org.terracotta.ehcache.tests.container.BasicTestServlet=production -org.terracotta.ehcache.tests.container.EARContainerTest=production -org.terracotta.ehcache.tests.container.TwoResourceContainerJTATest=production -org.terracotta.ehcache.tests.container.TwoResourceJTATestServlet=production -org.terracotta.ehcache.tests.container.hibernate.BaseClusteredRegionFactoryTest=production -org.terracotta.ehcache.tests.container.hibernate.BaseClusteredRegionFactoryTestServlet=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.EhCacheClusteredHibernateCacheTest=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.EmptySecondLevelCacheEntryTest=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.KeyDeserializationSecondLevelCacheEntryTest=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.KeyDeserializationSecondLevelCacheEntryTestServlet=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.NonEternalSecondLevelCacheTest=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.NonEternalSecondLevelCacheTestServlet=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.NonTransactionalCacheTest=production -org.terracotta.ehcache.tests.container.hibernate.nontransactional.QueryCacheInvalidationTest=production -org.terracotta.ehcache.tests.loader.LoaderTest=production -org.terracotta.ehcache.tests.servermap.BasicServerMapExpressCacheTest=production -org.terracotta.ehcache.tests.servermap.BasicServerMapExpressTestHelper=production -org.terracotta.ehcache.tests.servermap.CacheSizeTest=production -org.terracotta.ehcache.tests.servermap.LockGCNotFlushingEntriesTest=production -org.terracotta.ehcache.tests.servermap.LockGCNotFlushingEntriesTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapCapacityEvictionExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapCapacityEvictionExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapClearExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapClearExpressTestClient1=production -org.terracotta.ehcache.tests.servermap.ServerMapClearExpressTestClient2=production -org.terracotta.ehcache.tests.servermap.ServerMapClearTestHelper=production -org.terracotta.ehcache.tests.servermap.ServerMapElementTTIExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapElementTTIExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapElementTTLExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapElementTTLExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapL1CapacityEvictionExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapL1CapacityEvictionExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapL1CapacityExpirationExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapL1CapacityExpirationExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapL1EvictionOffHeapDestroyExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapL1EvictionOffHeapDestroyExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapL2EvictionReachesL1Test=production -org.terracotta.ehcache.tests.servermap.ServerMapL2EvictionReachesL1TestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapL2EvictionReachesOneL1Test=production -org.terracotta.ehcache.tests.servermap.ServerMapL2EvictionReachesOneL1TestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapLocalSizeTest=production -org.terracotta.ehcache.tests.servermap.ServerMapTTIExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapTTIExpressTestClient=production -org.terracotta.ehcache.tests.servermap.ServerMapTTLExpressTest=production -org.terracotta.ehcache.tests.servermap.ServerMapTTLExpressTestClient=production -org.terracotta.modules.ehcache.LocalVMResourcesTestUtil=production -org.terracotta.modules.ehcache.bulkops.BulkOpsBasicSerializationSanityTest=production -org.terracotta.modules.ehcache.bulkops.BulkOpsExplictLockingTest=production -org.terracotta.modules.ehcache.bulkops.BulkOpsGenericSanityTest=production -org.terracotta.modules.ehcache.bulkops.GetAllCustomMapTest=production -org.terracotta.modules.ehcache.bulkops.GetAllNonLiteralTest=production -org.terracotta.modules.ehcache.bulkops.GetAllTest=production -org.terracotta.modules.ehcache.cluster.CacheClusterTest=production -org.terracotta.modules.ehcache.cluster.ClusterTopologyListenerTest=production -org.terracotta.modules.ehcache.cluster.FailoverDuringPassiveSyncTest=production -org.terracotta.modules.ehcache.cluster.FailoverToOutOfSyncPassivesTest=production -org.terracotta.modules.ehcache.coherence.CacheCoherenceTest=production -org.terracotta.modules.ehcache.coherence.CacheCoherenceTestL1Client=production -org.terracotta.modules.ehcache.coherence.GetSizeTest=production -org.terracotta.modules.ehcache.coherence.NoLocksCreatedEventualTest=production -org.terracotta.modules.ehcache.coherence.NoLocksCreatedTest=production -org.terracotta.modules.ehcache.event.ClusterTopologyTest=production -org.terracotta.modules.ehcache.event.ClusteredEventsAllTest=production -org.terracotta.modules.ehcache.event.ClusteredEventsEvictionExpiryTest=production -org.terracotta.modules.ehcache.event.ClusteredEventsLocalTest=production -org.terracotta.modules.ehcache.event.ClusteredEventsRemoteTest=production -org.terracotta.modules.ehcache.event.ClusteredEventsSerializationTest=production -org.terracotta.modules.ehcache.l1bm.L1BMCacheManagerRecreateTest=production -org.terracotta.modules.ehcache.l1bm.L1BMCacheStatisticsTest=production -org.terracotta.modules.ehcache.l1bm.L1BMDynamicConfigurationTest=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapActivePassiveSanityTest=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapBasicSanityTestApp=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapReadWriteTest=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapSanityTest=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapWithTTISanityTest=production -org.terracotta.modules.ehcache.l1bm.L1BMOnHeapWithTTLSanityTest=production -org.terracotta.modules.ehcache.l1bm.L1BMUpdateInvalidatedEntryTest=production -org.terracotta.modules.ehcache.store.BasicCacheSyncWriteTest=production -org.terracotta.modules.ehcache.store.BasicCacheTest=production -org.terracotta.modules.ehcache.store.BlockingCacheTest=production -org.terracotta.modules.ehcache.store.CachePinningTest=production -org.terracotta.modules.ehcache.store.ClassicIsInvalidTest=production -org.terracotta.modules.ehcache.store.ConcurrentCacheMethodsTest=production -org.terracotta.modules.ehcache.store.CopyOnReadTest=production -org.terracotta.modules.ehcache.store.DCV2ConfigurationChangePropagationTest=production -org.terracotta.modules.ehcache.store.DynamicCacheConfigurationTest=production -org.terracotta.modules.ehcache.store.EvictionListenerTest=production -org.terracotta.modules.ehcache.store.ExpirationListenerTest=production -org.terracotta.modules.ehcache.store.GetKeysSerializedCacheTest=production -org.terracotta.modules.ehcache.store.InlineExpirationTest=production -org.terracotta.modules.ehcache.store.LocalBufferedMapTest=production -org.terracotta.modules.ehcache.store.LocalReadsGetKeysTest=production -org.terracotta.modules.ehcache.store.NoCacheWithMaxBytesLocalDiskTest=production -org.terracotta.modules.ehcache.store.PinnedCacheTest=production -org.terracotta.modules.ehcache.store.PrimitiveClassTest=production -org.terracotta.modules.ehcache.store.ProgrammaticCacheTest=production -org.terracotta.modules.ehcache.store.ProgrammaticConfigTest=production -org.terracotta.modules.ehcache.store.SampledStatisticTimerTest=production -org.terracotta.modules.ehcache.store.SerializedCacheCopyOnReadTest=production -org.terracotta.modules.ehcache.store.SerializedCacheTest=production -org.terracotta.modules.ehcache.store.ServerMapBasicCacheTest=production -org.terracotta.modules.ehcache.store.SimpleVersionTest=production -org.terracotta.modules.ehcache.store.StorageStrategyNotSupportedTest=production -org.terracotta.modules.ehcache.store.TTICacheTest=production -org.terracotta.modules.ehcache.store.TTLCacheTest=production -org.terracotta.modules.ehcache.store.TotalCapacityTest=production -org.terracotta.modules.ehcache.store.backend.BulkLoadInternalKeyRepresentationExposedTest=production -org.terracotta.modules.ehcache.writebehind.AsyncWriteBehindTest=production -org.terracotta.modules.ehcache.writebehind.BasicWriteBehindTest=production -org.terracotta.modules.ehcache.writebehind.CacheSeparationWriteBehindTest=production -org.terracotta.modules.ehcache.writebehind.CoalescingWriteBehindTest=production -org.terracotta.modules.ehcache.writebehind.RemovingCacheWriteBehindTest=production -org.terracotta.modules.ehcache.writebehind.SerializationWriteBehindTest=production Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-common/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-common/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-common/pom.xml (revision 0) @@ -1,87 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.9.1.15 - .. - - - management-ehcache-common - management-ehcache-common - A common library shared between different management-ehcache implementation versions - - - - org.terracotta - management-core-resources - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - javax.servlet - javax.servlet-api - - - org.eclipse.jetty - jetty-servlet - - - commons-io - commons-io - 2.6 - test - - - org.easymock - easymock - test - - - org.powermock - powermock-api-easymock - test - - - org.powermock - powermock-module-junit4 - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v2/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v2/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v2/pom.xml (revision 0) @@ -1,137 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.9.1.15 - .. - - - management-ehcache-impl-v2 - management-ehcache-impl-v2 - A product library integrating with ehcache to construct the relevant management resource entities V1 - - - - net.sf.ehcache - management-ehcache-v2 - ${project.version} - - - net.sf.ehcache - management-ehcache-common - ${project.version} - - - org.terracotta - management-core-resources - ${management-core.version} - test-jar - test - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - net.sf.ehcache.internal - ehcache-terracotta-bootstrap - ${project.version} - provided - - - org.terracotta.toolkit - terracotta-toolkit-api - 2.10 - provided - - - org.terracotta.toolkit - terracotta-toolkit-api-internal - provided - - - javax.servlet - javax.servlet-api - runtime - - - org.easymock - easymock - test - - - org.eclipse.jetty - jetty-servlet - test - - - org.mockito - mockito-core - test - - - org.powermock - powermock-api-easymock - test - - - org.powermock - powermock-module-junit4 - test - - - org.hamcrest - hamcrest - 2.1 - test - - - commons-io - commons-io - 2.6 - test - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/pom.xml (revision 0) @@ -1,49 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - ehcache-scheduled-refresh - net.sf.ehcache.internal - ehcache-scheduled-refresh - Ehcache functionality for Scheduled Refresh; uses the Quartz Job Scheduler - - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - - - org.quartz-scheduler - quartz - provided - - - org.slf4j - slf4j-jdk14 - provided - - - junit - junit - - - org.hamcrest - hamcrest - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - Index: rctags/ehcache-2.10.9.1.15/README.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/README.txt (revision 11494) +++ rctags/ehcache-2.10.9.1.15/README.txt (revision 0) @@ -1,18 +0,0 @@ -1. To compile: - %> mvn install -DskipTests - -Note: the final Ehcache jar is found under ehcache/target - - -2. To build Ehcache distribution kit: - - %> cd distribution - - %> mvn package (build without an embedded Terracotta kit, lean and mean Ehcache kit) - - %> mvn package -Dtc-kit-url=http://url/to/teracotta.tar.gz (built with Terracotta kit, offical distribution kit) - -3. To deploy Maven central repo (via Sonatype) - - %> mvn clean deploy -P sign-artifacts,deploy-sonatype -DskipTests - \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache/pom.xml (revision 0) @@ -1,418 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - ehcache - jar - ehcache - Ehcache is an open source, standards-based cache used to boost performance, - offload the database and simplify scalability. Ehcache is robust, proven and full-featured and - this has made it the most widely-used Java-based cache. - - - - The Apache Software License, Version 2.0 - src/assemble/EHCACHE-CORE-LICENSE.txt - - - http://ehcache.org - - - ${project.artifactId}-${project.version}-distribution - ${project.build.directory}/${kit.name} - ${project.build.directory}/tmp/terracotta - 2.1.1 - false - true - - - - - - net.sf.ehcache.internal - ehcache-terracotta-bootstrap - ${project.version} - - - net.sf.ehcache.internal - ehcache-rest-agent - ${project.version} - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - - - net.sf.ehcache.internal - ehcache-scheduled-refresh - ${project.version} - - - net.sf.ehcache.internal - ehcache-search-parser - ${project.version} - - - junit - junit - - - org.terracotta - product-upgradability-testing-utils - 0.9.4 - test - - - org.codehaus.btm - btm - 2.1.3 - test - - - org.quartz-scheduler - quartz - 2.2.3 - test - - - org.slf4j - slf4j-jdk14 - - - - - - - ${basedir}/src/main/resources - true - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-TIMs - - org.terracotta.modules - ${project.build.outputDirectory}/META-INF/terracotta/TIMs - - process-resources - - copy-dependencies - - - - - - org.terracotta - maven-forge-plugin - - - create-manifest - package - - manifest - - - ${basedir}/.. - ${project.build.directory}/MANIFEST.MF - - Apache Software License, Version 2.0 - Supported - ${project.artifactId} - ${project.description} - - - - - enforce-dependencies - - enforceDependencies - - verify - - net.sf.ehcache.internal - ehcache-core - ${project.version} - - - - - - - - - - devmode - - - devmode - true - - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - list-dependencies - - ${project.build.outputDirectory}/META-INF/devmode/${project.groupId}/${project.artifactId}/dependencies.txt - - - list - - compile - - - - - - - - - fullmode - - - devmode - false - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - - create-javadoc - prepare-package - - jar - - - - - org.hibernate - hibernate-core - ${hibernate-core.version} - - - none - ${skipJavadoc} - true - 128m - 512 - true -
ehcache]]>
- ${project.name} ${project.version} API - ${project.name} ${project.version} API - Copyright 2001-{currentYear}, Terracotta, Inc. - ${basedir}/src/main/java/net/sf/ehcache/overview.html - true - - net.sf.ehcache.internal:ehcache-core - - 8 -
-
-
-
- - - org.apache.maven.plugins - maven-shade-plugin - - record-shader - true - true - - - net.sf.ehcache.internal:* - org.terracotta.internal:statistics - com.terracotta:clustered-entity-management - - - - - *:* - - META-INF/maven/com.terracotta/** - META-INF/maven/net.sf.ehcache.internal/** - META-INF/maven/org.terracotta.internal/** - **/license.txt - **/thirdpartylicenses.txt - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - **/LICENSE - **/LICENSE.txt - **/NOTICE - **/NOTICE.txt - **/ASL2.0 - **/DEPENDENCIES - - - - true - ${project.build.directory}/dependency-reduced-pom.xml - - - MANIFEST.MF - - - META-INF/MANIFEST.MF - ${project.build.directory}/MANIFEST.MF - - - - - - shade-jar - package - - shade - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - unpack-jar-for-bundling - package - - run - - - - - - - - - - - org.apache.felix - maven-bundle-plugin - 4.2.1 - - ${project.build.directory} - - bitronix.tm;resolution:=optional, - bitronix.tm.resource.ehcache;resolution:=optional, - com.atomikos.*;resolution:=optional, - com.atomikos.icatch.jta;resolution:=optional, - weblogic.transaction;resolution:=optional, - javax.transaction.*;resolution:=optional, - javax.servlet;resolution:=optional, - javax.net.ssl;resolution:=optional, - javax.activation;resolution:=optional, - javax.xml.stream;resolution:=optional, - javax.xml.transform;resolution:=optional, - javax.xml.transform.sax;resolution:=optional, - javax.xml.transform.dom;resolution:=optional, - javax.xml.transform.stream;resolution:=optional, - org.w3c.dom;resolution:=optional, - org.hibernate.*;resolution:=optional, - org.terracotta.toolkit.*;resolution:=optional, - org.quartz.*;resolution:=optional, - org.terracotta.quartz.*;resolution:=optional, - com.sun.management.*;resolution:="optional", - net.sf.ehcache.terracotta.security;resolution:=optional, - org.jboss.vfs;resolution:=optional, - sun.management.*;resolution:=optional, - !com.google.apphosting.api, - !sun.misc,* - - net.sf.ehcache.* - org.terracotta.* - JavaSE-1.8 - - *;scope=provided|runtime - - - - generate-osgi-headers - package - - manifest - - - - - - org.codehaus.gmaven - groovy-maven-plugin - ${groovy-maven-plugin.version} - - - repackage-jar - package - - execute - - - - def jarFile = new File(project.build.directory, "${project.artifactId}-${project.version}.jar") - ant.copy(file: new File(project.build.directory, "dependency-reduced-pom.xml"), - tofile: new File(project.build.outputDirectory, "META-INF/maven/${project.groupId}/${project.artifactId}/pom.xml")) - ant.jar(destfile: jarFile, basedir: new File(project.build.outputDirectory).getAbsolutePath(), manifest: new File(project.build.directory, "MANIFEST.MF")) - - - - - -
-
-
-
- - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - JIRA - https://jira.terracotta.org/jira/browse/EHC - - -
Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/pom.xml (revision 0) @@ -1,98 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache.internal - ehcache-terracotta-root - 2.10.9.1.15 - - - ehcache-terracotta-bootstrap - ehcache-terracotta-bootstrap - jar - - - false - 1.19 - 0.11.1 - - - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - org.terracotta.toolkit - terracotta-toolkit-api-internal - ${terracotta-toolkit-api-internal.version} - - - com.terracotta - clustered-entity-management - ${clustered-entity-management.version} - - - org.mockito - mockito-core - 3.0.0 - test - - - junit - junit - 4.12 - test - - - org.hamcrest - hamcrest-core - - - - - org.hamcrest - hamcrest - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - - deploy-sonatype - - true - - - - Index: rctags/ehcache-2.10.9.1.15/distribution/colorcache/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/colorcache/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/colorcache/pom.xml (revision 0) @@ -1,152 +0,0 @@ - - 4.0.0 - - org.terracotta.forge - forge-parent - 4.16 - - - net.sf.ehcache.examples - colorcache - 2.10.9.1.15 - colorcache - war - Clustered Ehcache sample with Terracotta - - 4.3.9.1.2 - true - 9.4.35.v20201120 - - - ${project.name} - - - maven-assembly-plugin - 2.3 - - ${project.name} - - src/assemble/distribution.xml - - gnu - - - - package - - single - - - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - ${project.name} - - STOP - - - - org.terracotta.maven.plugins - tc-maven-plugin - - - org.terracotta - terracotta - ${terracotta.version} - - - - - - - - net.sf.ehcache - ehcache - ${project.version} - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.version} - - - javax.servlet - javax.servlet-api - 3.1.0 - - - org.slf4j - slf4j-jdk14 - 1.7.25 - - - - - 9081 - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - - jetty.port - 9081 - - - 9981 - - - - - - - 9082 - - - - jetty-maven-plugin - ${jetty.version} - org.eclipse.jetty - - - - jetty.port - 9082 - - - 9982 - - - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v2/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v2/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v2/pom.xml (revision 0) @@ -1,72 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - management-ehcache-v2 - management-ehcache-v2 - A library defining the ehcache management resource services and resource entities, version 2 - - - - org.terracotta - management-common-resources-v2 - ${management-core.version} - - - - - junit - junit - test - - - org.easymock - easymock - test - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/distribution/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/pom.xml (revision 0) @@ -1,298 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - - - ehcache-kit - pom - ehcache-kit - - project to build distribution kit - - - colorcache - events - - - - ehcache - ${productName}-${project.version} - ${kitFolder}-distribution - ${project.build.directory}/${kitFolder} - ${project.build.directory}/tmp/terracotta - - - - - net.sf.ehcache - ehcache - ${project.version} - provided - - - org.slf4j - slf4j-api - provided - - - org.slf4j - slf4j-jdk14 - provided - - - - - - includeJavadoc - - - !skipJavadoc - - - - - net.sf.ehcache - ehcache - ${project.version} - javadoc - provided - - - - - - - - - com.github.goldin - copy-maven-plugin - 0.2.3.8 - - false - - - - {{ new File( project.build.directory, "${kitFolder}" ).isDirectory() }} - ${root.dir} - - **/** - - true - true - - - - ${root.dir} - ${basedir}/src/main/assembly/root - true - true - - - - ${root.dir} - ${basedir}/../ehcache-core/src/main/config - true - - - - ${root.dir}/src - - - net.sf.ehcache - ehcache - sources - - - true - - - - false - ${root.dir}/javadoc - - - net.sf.ehcache - ehcache - javadoc - - - true - - - - {{ new File(project.properties['terracotta.kit.path']).isDirectory() }} - ${root.dir}/samples - - - net.sf.ehcache.examples - events - ${project.version} - distribution - tar.gz - - - net.sf.ehcache.examples - colorcache - ${project.version} - distribution - tar.gz - - - true - - - - {{ new File(project.properties['terracotta.kit.path']).isDirectory() }} - ${root.dir}/terracotta - ${terracotta.kit.path} - - **/ehcache/** - **/quartz/** - **/sessions/** - - true - - - {{ new File(project.properties['terracotta.kit.path']).isDirectory() }} - ${root.dir}/samples - ${terracotta.kit.path}/ehcache/samples - true - - - {{ new File(project.properties['terracotta.kit.path']).isDirectory() }} - ${root.dir}/samples/colorcache/bin - ${basedir}/src/main/assembly - - relative-paths.* - - - - {{ new File(project.properties['terracotta.kit.path']).isDirectory() }} - ${root.dir}/samples/events/bin - ${basedir}/src/main/assembly - - relative-paths.* - - - - - - - package-with-no-tc - package - - copy - - - - - - - org.terracotta - maven-forge-plugin - - - package-lib - package - - copy-dependencies - - - ${root.dir}/lib - false - - net.sf.ehcache:ehcache:${project.version} - org.slf4j:slf4j-api:${slf4j.version} - org.slf4j:slf4j-jdk14:${slf4j.version} - - - - - - - org.codehaus.gmaven - groovy-maven-plugin - - - create-tarball - package - - execute - - - - def srcdir = new File(project.basedir, "target/${kitFolder}") - def destFile = new File(project.basedir, "target/${tarballName}.tar.gz") - ant.tar(destfile: "${destFile}", longfile: "gnu", compression: "gzip") { - tarfileset(dir: "${srcdir}", prefix: "${kitFolder}", excludes: "**/bin/**,**/lib/**,**/*.sh,**/*.bat") - tarfileset(dir: "${srcdir}", prefix: "${kitFolder}", includes: "**/bin/**,**/lib/**,**/*.sh,**/*.bat", filemode: "755") - } - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.5 - - - attach-distribution - package - - attach-artifact - - - - - ${project.build.directory}/${tarballName}.tar.gz - tar.gz - distribution - - - - - - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - evgenyg.artifactoryonline.com - http://evgenyg.artifactoryonline.com/evgenyg/repo/ - - true - - - false - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-search-parser/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-search-parser/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-search-parser/pom.xml (revision 0) @@ -1,56 +0,0 @@ - - - 4.0.0 - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - net.sf.ehcache.internal - ehcache-search-parser - ehcache-search-parser - A parser for Big Memory Structured Query Language. - - - - - org.codehaus.mojo - javacc-maven-plugin - 2.6 - - - javacc - - javacc - - - - - - - - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - - - junit - junit - - - org.hamcrest - hamcrest - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/pom.xml (revision 0) @@ -1,43 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - management-ehcache-impl-parent - management-ehcache-impl-parent - pom - - - management-ehcache-impl-v1 - management-ehcache-impl-v2 - management-ehcache-common - ehcache-rest-agent - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v1/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v1/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v1/pom.xml (revision 0) @@ -1,72 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.9.1.15 - .. - - - management-ehcache-v1 - management-ehcache-v1 - A library defining the ehcache management resource services and resource entities, version 1 - - - - org.terracotta - management-common-resources-v1 - ${management-core.version} - - - - - junit - junit - test - - - org.easymock - easymock - test - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/ehcache-rest-agent/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/ehcache-rest-agent/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/ehcache-rest-agent/pom.xml (revision 0) @@ -1,223 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.9.1.15 - .. - - - net.sf.ehcache.internal - ehcache-rest-agent - ehcache-rest-agent - - Ehcache REST implementation - - - rest-management-private-classpath - .class_terracotta - true - false - 2.3.2 - - - - - net.sf.ehcache - management-ehcache-impl-v1 - ${project.version} - - - net.sf.ehcache - management-ehcache-impl-v2 - ${project.version} - - - javax.servlet - javax.servlet-api - 3.1.0 - runtime - - - org.eclipse.jetty - jetty-servlet - - - org.glassfish.jaxb - jaxb-runtime - ${jaxb-runtime.version} - runtime - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - devmode - - - devmode - true - - true - - - - .class - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - list-dependencies - - ${project.build.outputDirectory}/META-INF/devmode/${project.groupId}/${project.artifactId}/dependencies.txt - - - list - - compile - - - - - - org.apache.maven.plugins - maven-shade-plugin - - reduced-pom-only-shader - ${project.build.directory}/dependency-reduced-pom.xml - true - true - false - false - - - - org.slf4j:* - - - - - - package - - shade - - - - - - - - - - fullmode - - - devmode - false - - - - - - org.apache.maven.plugins - maven-shade-plugin - - record-shader - ${project.build.directory}/dependency-reduced-pom.xml - true - true - false - true - - - - org.slf4j:* - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - - package - - shade - - - - - - org.codehaus.gmaven - groovy-maven-plugin - - - fix-content - package - - execute - - - - ${basedir}/src/scripts - - - import Util - Util.packageAgentJar(project) - - - - - - - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/pom.xml (revision 0) @@ -1,486 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-parent - 2.25 - - - - ehcache-root - net.sf.ehcache - ehcache-root - pom - 2.10.9.1.15 - - - scm:svn:https://svn.terracotta.org/repo/ehcache/trunk/ehcache - - - - 1.7.25 - 1.0.1 - 2.1.1 - 1.19 - 2.1.25.1 - 0.11.1 - 1.0.5 - 2.2.3 - 9.4.35.v20201120 - 2.3.2 - 3.5.1-Final - 1.2 - false - - - - ehcache-core - terracotta - ehcache - management-ehcache-v1 - management-ehcache-v2 - management-ehcache-impl - ehcache-scheduled-refresh - ehcache-search-parser - - - - - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.terracotta.internal - statistics - ${statistics.version} - - - org.terracotta - management-core-resources - ${management-core.version} - - - com.terracotta - clustered-entity-management - ${clustered-entity-management.version} - - - org.eclipse.jetty - jetty-servlet - ${jetty.version} - - - javax.servlet - javax.servlet-api - - - - - - - - - org.terracotta.toolkit - terracotta-toolkit-api-internal - ${terracotta-toolkit-api-internal.version} - provided - - - javax.servlet - javax.servlet-api - 3.1.0 - provided - - - org.hibernate - hibernate-core - ${hibernate-core.version} - provided - - - javax.transaction - jta - 1.1 - provided - - - net.sf.ehcache - sizeof-agent - ${sizeof-agent.version} - provided - - - - - org.slf4j - slf4j-jdk14 - ${slf4j.version} - test - - - commons-logging - commons-logging - ${commons-logging.version} - test - - - org.codehaus.btm - btm - 2.1.3 - test - - - net.sf.hibernate - hibernate - 2.1.8 - test - - - org.hamcrest - hamcrest - 2.1 - test - - - junit - junit - 4.12 - test - - - hamcrest-core - org.hamcrest - - - - - dom4j - dom4j - 1.6.1 - test - - - javassist - javassist - 3.4.GA - test - - - org.hibernate - hibernate-ehcache - 3.3.2.GA - test - - - ehcache - net.sf.ehcache - - - - - org.apache.derby - derby - 10.5.3.0_1 - test - - - org.mockito - mockito-core - 3.0.0 - test - - - com.sun.xsom - xsom - 20100725 - test - - - org.beanshell - bsh - 1.3.0 - test - - - org.quartz-scheduler - quartz - ${quartz.version} - - - org.easymock - easymock - 4.0.2 - test - - - org.powermock - powermock-api-easymock - 2.0.2 - test - - - org.powermock - powermock-module-junit4 - 2.0.2 - test - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.1.2 - - - - true - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - ${skipJavadoc} - 8 - -Xdoclint:all,-Xdoclint:-missing - true - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.0 - - - org.apache.maven.plugins - maven-dependency-plugin - 3.1.1 - - - org.codehaus.mojo - build-helper-maven-plugin - 1.7 - - - org.apache.maven.plugins - maven-antrun-plugin - 1.3 - - - org.terracotta - maven-forge-plugin - ${maven-forge-plugin.version} - - -Djava.net.preferIPv4Stack=true - - - - org.apache.maven.plugins - maven-shade-plugin - 2.3 - - - org.terracotta.maven.plugins - terracotta-shader - 1.2 - - - - - org.codehaus.gmaven - groovy-maven-plugin - ${groovy-maven-plugin.version} - - - org.codehaus.mojo - rmic-maven-plugin - 1.3 - - - - - - org.terracotta - maven-forge-plugin - - - generateBuildInfoFile - generate-resources - - buildinfo - - - true - ${project.build.outputDirectory} - - - - default-test - test - - test - - - - - - - - - - system-tests - - system-tests - - - - dist - - distribution - - - - - - check-short - - true - true - - - - - org.reflections - reflections-maven - 0.9.9-RC1 - - org.reflections.scanners.TypeAnnotationsScanner - ${project.build.directory}/reflections.xml - true - true - - - - - reflections - - process-test-classes - - - - - org.terracotta - maven-forge-plugin - - true - org.terracotta.test.categories.CheckShorts - - - java.awt.headless - true - - - - - - - - - - deploy-terracotta - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.1 - true - - - http://nexus.terracotta.eur.ad.sag - - terracotta-nexus-staging - ${skipDeploy} - - - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - - - - - - - deploy-sonatype - - - sonatype-nexus-staging - http://oss.sonatype.org/service/local/staging/deploy/maven2 - - - sonatype-nexus-snapshots - https://oss.sonatype.org/content/repositories/snapshots - - - - - - - - terracotta-nexus-staging - Terracotta Nexus Staging Repository - ${terracotta-nexus-staging-url} - - - terracotta-os-snapshots - false - Terracotta OS Snapshots Repository - ${terracotta-os-snapshots-url} - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/pom.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/pom.xml (revision 0) @@ -1,110 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.9.1.15 - .. - - - management-ehcache-impl-v1 - management-ehcache-impl-v1 - A product library integrating with ehcache to construct the relevant management resource entities V1 - - - - net.sf.ehcache - management-ehcache-v1 - ${project.version} - - - net.sf.ehcache - management-ehcache-common - ${project.version} - - - org.terracotta - management-core-resources - ${management-core.version} - test-jar - test - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - javax.servlet - javax.servlet-api - - - org.easymock - easymock - test - - - org.eclipse.jetty - jetty-servlet - test - - - org.mockito - mockito-core - - - org.powermock - powermock-api-easymock - test - - - org.powermock - powermock-module-junit4 - test - - - org.hamcrest - hamcrest - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - - - terracotta-snapshots - http://www.terracotta.org/download/reflector/snapshots - - - terracotta-releases - http://www.terracotta.org/download/reflector/releases - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SetAsList.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SetAsList.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SetAsList.java (revision 0) @@ -1,212 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; - -/** - * Wraps a set to provide a list interface. - * All list methods not application to set throws an {@link UnsupportedOperationException} - * - * @author Chris Dennis - * @param - */ -public class SetAsList implements List { - - private final Set set; - private transient Object[] array; - - /** - * @param set - */ - public SetAsList(Set set) { - this.set = set; - } - - /** - * {@inheritDoc} - */ - public int size() { - return set.size(); - } - - /** - * {@inheritDoc} - */ - public boolean isEmpty() { - return set.isEmpty(); - } - - /** - * {@inheritDoc} - */ - public boolean contains(Object o) { - return set.contains(o); - } - - /** - * {@inheritDoc} - */ - public Iterator iterator() { - return set.iterator(); - } - - /** - * {@inheritDoc} - */ - public Object[] toArray() { - return set.toArray(); - } - - /** - * {@inheritDoc} - */ - public T[] toArray(T[] a) { - return set.toArray(a); - } - - /** - * {@inheritDoc} - */ - public boolean add(E e) { - return set.add(e); - } - - /** - * {@inheritDoc} - */ - public boolean remove(Object o) { - return set.remove(o); - } - - /** - * {@inheritDoc} - */ - public boolean containsAll(Collection c) { - return set.containsAll(c); - } - - /** - * {@inheritDoc} - */ - public boolean addAll(Collection c) { - return set.addAll(c); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public boolean addAll(int index, Collection c) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * {@inheritDoc} - */ - public boolean removeAll(Collection c) { - return set.removeAll(c); - } - - /** - * {@inheritDoc} - */ - public boolean retainAll(Collection c) { - return set.retainAll(c); - } - - /** - * {@inheritDoc} - */ - public void clear() { - set.clear(); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - * - * @param index Index - */ - public E get(int index) { - if (this.array == null) { - this.array = toArray(); - } - if (array.length <= index) { - throw new IndexOutOfBoundsException(); - } - return (E) this.array[index]; - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public E set(int index, E element) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public void add(int index, E element) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public E remove(int index) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public int indexOf(Object o) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public int lastIndexOf(Object o) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public ListIterator listIterator() { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public ListIterator listIterator(int index) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } - - /** - * Does not support List methods {@link UnsupportedOperationException}. - */ - public List subList(int fromIndex, int toIndex) { - throw new UnsupportedOperationException("Delegates to set, operation not supported"); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/LongSequence.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/LongSequence.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/LongSequence.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.util; - -/** - * A sequence producing longs - * - * @author teck - */ -public interface LongSequence { - - /** - * Get the next value in the sequence - * - * @return the next value - */ - long next(); -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CompositeLoaderTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CompositeLoaderTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CompositeLoaderTest.java (revision 0) @@ -1,69 +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 org.junit.After; -import org.junit.Before; -import org.junit.Test; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * ComponentA is composed of ComponentB and some other fields. Tests the interactions between two loaders, where the first component's - * loader loads component B by using getWithLoader, which in turn invokes component B's loader. - * - * @author Greg Luck - * @version $Id: CompositeLoaderTest.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class CompositeLoaderTest { - - private static final Logger LOG = LoggerFactory.getLogger(CompositeLoaderTest.class.getName()); - - /** - * Sets up the fixture, for example, open a network connection. - * This method is called before a test is executed. - */ - @Before - public void setUp() throws Exception { - CacheHelper.init(); - } - - /** - * Tears down the fixture, for example, close a network connection. - * This method is called after a test is executed. - */ - @After - public void tearDown() throws Exception { - CacheHelper.shutdown(); - } - - /** - * This test reproduces a deadlock found in 1.4-beta1 around loading interactions and getWithLoader. Now fixed. - */ - @Test - public void testCompositeLoad() { - LOG.info("Getting from cache"); - ComponentA compA = (ComponentA) CacheHelper.get("ehcache-loaderinteractions.xml", "ACache", "key1"); - LOG.info(compA.toString()); - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/cluster/NoopCacheCluster.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/cluster/NoopCacheCluster.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/cluster/NoopCacheCluster.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.cluster; - -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * This is a dummy implementation of the CacheCluster (Null Object Pattern). It ignores - * all listeners and reports no nodes. - * - * @author Geert Bevin - * @since 2.0 - */ -public class NoopCacheCluster implements CacheCluster { - - /** - * A singleton instance you can use rather than constructing your own. - */ - public static final CacheCluster INSTANCE = new NoopCacheCluster(); - - /** - * {@inheritDoc} - */ - public Collection getNodes() { - return Collections.emptyList(); - } - - /** - * Always returns the ClusterScheme.NONE - * - * @return {@link ClusterScheme#NONE} - */ - public ClusterScheme getScheme() { - return ClusterScheme.NONE; - } - - /** - * {@inheritDoc} - */ - public boolean addTopologyListener(ClusterTopologyListener listener) { - return false; - } - - /** - * {@inheritDoc} - */ - public boolean removeTopologyListener(ClusterTopologyListener listener) { - return false; - } - - /** - * {@inheritDoc} - */ - public boolean isClusterOnline() { - return true; - } - - /** - * {@inheritDoc} - */ - public ClusterNode getCurrentNode() { - return null; - } - - /** - * {@inheritDoc} - */ - public ClusterNode waitUntilNodeJoinsCluster() { - return null; - } - - /** - * {@inheritDoc} - */ - public List getTopologyListeners() { - return Collections.emptyList(); - } - - @Override - public void removeAllListeners() { - // - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionTimeoutException.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionTimeoutException.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/TransactionTimeoutException.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; - -/** - * This exception is thrown when a transactional operation times out - * - * @author Ludovic Orban - */ -public class TransactionTimeoutException extends TransactionException { - - /** - * Create a new TransactionTimeoutException - * @param message the error message - */ - public TransactionTimeoutException(String message) { - super(message); - } -} Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/CacheConfigChangeBridgeTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/CacheConfigChangeBridgeTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/CacheConfigChangeBridgeTest.java (revision 0) @@ -1,132 +0,0 @@ -package org.terracotta.modules.ehcache.store; - -import net.sf.ehcache.config.CacheConfiguration; -import org.junit.Before; -import org.junit.Test; -import org.terracotta.toolkit.config.AbstractConfiguration; -import org.terracotta.toolkit.config.Configuration; -import org.terracotta.toolkit.events.ToolkitNotifier; -import org.terracotta.toolkit.internal.cache.ToolkitCacheInternal; -import org.terracotta.toolkit.store.ToolkitConfigFields; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; - -/** - * @author tim - */ -public class CacheConfigChangeBridgeTest { - - private ToolkitCacheInternal backend; - private CacheConfiguration cacheConfiguration; - private ToolkitNotifier notifier; - private TestConfiguration toolkitCacheConfig; - - @Before - public void setUp() throws Exception { - toolkitCacheConfig = new TestConfiguration(); - backend = when(mock(ToolkitCacheInternal.class).getConfiguration()) - .thenReturn(toolkitCacheConfig).getMock(); - cacheConfiguration = spy(new CacheConfiguration()); - notifier = mock(ToolkitNotifier.class); - } - - @Test - public void testConnectConfigsSetsUpLocalCacheConfiguration() throws Exception { - cacheConfiguration.freezeConfiguration(); - - CacheConfigChangeBridge bridge = new CacheConfigChangeBridge("foo", - backend, notifier, cacheConfiguration); - - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TOTAL_COUNT_FIELD_NAME, 123); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TTI_SECONDS_FIELD_NAME, 321); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TTL_SECONDS_FIELD_NAME, 456); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_COUNT_LOCAL_HEAP_FIELD_NAME, 42); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_BYTES_LOCAL_HEAP_FIELD_NAME, 1L); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_BYTES_LOCAL_OFFHEAP_FIELD_NAME, 2L); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.OFFHEAP_ENABLED_FIELD_NAME, true); - - bridge.connectConfigs(); - - assertThat(cacheConfiguration.getMaxEntriesInCache(), is(123L)); - assertThat(cacheConfiguration.getTimeToLiveSeconds(), is(456L)); - assertThat(cacheConfiguration.getTimeToIdleSeconds(), is(321L)); - assertThat(cacheConfiguration.isEternal(), is(false)); - assertThat(cacheConfiguration.getMaxEntriesLocalHeap(), is(42L)); - assertThat(cacheConfiguration.getMaxBytesLocalHeap(), is(1L)); - assertThat(cacheConfiguration.getMaxBytesLocalOffHeap(), is(2L)); - assertThat(cacheConfiguration.isOverflowToOffHeap(), is(true)); - } - - @Test - public void testEmptyConfigFromToolkitCache() throws Exception { - CacheConfigChangeBridge bridge = new CacheConfigChangeBridge("foo", - backend, notifier, cacheConfiguration); - - bridge.connectConfigs(); - - // Empty config so only check for registration of the listener and nothing else. - verify(cacheConfiguration).addConfigurationListener(bridge); - verifyNoMoreInteractions(cacheConfiguration); - } - - @Test - public void testOverrideLocallyConfiguredExpiry() throws Exception { - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(123); - cacheConfiguration.setTimeToIdleSeconds(321); - - CacheConfigChangeBridge bridge = new CacheConfigChangeBridge("foo", - backend, notifier, cacheConfiguration); - - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TTI_SECONDS_FIELD_NAME, 0); - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TTL_SECONDS_FIELD_NAME, 0); - - bridge.connectConfigs(); - - assertThat(cacheConfiguration.isEternal(), is(false)); - assertThat(cacheConfiguration.getTimeToLiveSeconds(), is(0L)); - assertThat(cacheConfiguration.getTimeToIdleSeconds(), is(0L)); - } - - @Test - public void testSetUnlimitedMaxEntriesInCache() throws Exception { - CacheConfigChangeBridge bridge = new CacheConfigChangeBridge("foo", - backend, notifier, cacheConfiguration); - - toolkitCacheConfig.internalSetConfigMapping(ToolkitConfigFields.MAX_TOTAL_COUNT_FIELD_NAME, -1); - - bridge.connectConfigs(); - - assertThat(cacheConfiguration.getMaxEntriesInCache(), is(0L)); - } - - private static class TestConfiguration extends AbstractConfiguration { - private final Map map = new HashMap(); - - @Override - protected void internalSetConfigMapping(final String key, final Serializable value) { - map.put(key, value); - } - - @Override - public Set getKeys() { - return map.keySet(); - } - - @Override - public Serializable getObjectOrNull(final String name) { - return map.get(name); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/CacheDecoratorFactoryTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/CacheDecoratorFactoryTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/CacheDecoratorFactoryTest.java (revision 0) @@ -1,99 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import junit.framework.TestCase; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.constructs.MockDecoratorFactory.MockDecoratorFactoryCache; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.test.categories.CheckShorts; - -/** - * @author Abhishek Sanoujam - */ -@Category(CheckShorts.class) -public class CacheDecoratorFactoryTest extends TestCase { - - private static final Logger LOG = LoggerFactory.getLogger(CacheDecoratorFactoryTest.class); - - @Test - public void testCacheDecoratorFactory() { - CacheManager cacheManager = new CacheManager(getClass().getResourceAsStream("/ehcache-decorator-test.xml")); - List cacheNames = Arrays.asList(cacheManager.getCacheNames()); - LOG.info("" + cacheNames); - - assertEquals(12, cacheNames.size()); - - assertTrue(cacheNames.contains("noDecoratorCache")); - assertTrue(cacheNames.contains("oneDecoratorCache")); - assertTrue(cacheNames.contains("oneDecoratorFirst")); - assertTrue(cacheNames.contains("twoDecoratorCache")); - assertTrue(cacheNames.contains("twoDecoratorFirst")); - assertTrue(cacheNames.contains("twoDecoratorSecond")); - assertTrue(cacheNames.contains("fiveDecoratorCache")); - assertTrue(cacheNames.contains("fiveDecoratorFirst")); - assertTrue(cacheNames.contains("fiveDecoratorSecond")); - assertTrue(cacheNames.contains("fiveDecoratorThird")); - assertTrue(cacheNames.contains("fiveDecoratorFourth")); - assertTrue(cacheNames.contains("fiveDecoratorFifth")); - - cacheManager.shutdown(); - - } - - @Test - public void testCacheDecoratorFactoryProperties() { - CacheManager cacheManager = new CacheManager(getClass().getResourceAsStream("/ehcache-decorator-test.xml")); - List cacheNames = Arrays.asList(cacheManager.getCacheNames()); - assertEquals(12, cacheNames.size()); - - MockDecoratorFactoryCache cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("oneDecoratorFirst"); - assertEquals("oneFirst", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("twoDecoratorFirst"); - assertEquals("twoFirst", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("twoDecoratorSecond"); - assertEquals("twoSecond", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("fiveDecoratorFirst"); - assertEquals("fiveFirst", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("fiveDecoratorSecond"); - assertEquals("fiveSecond", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("fiveDecoratorThird"); - assertEquals("fiveThird", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("fiveDecoratorFourth"); - assertEquals("fiveFourth", cache.getProperties().getProperty("someKey")); - - cache = (MockDecoratorFactoryCache) cacheManager.getEhcache("fiveDecoratorFifth"); - assertEquals("fiveFifth", cache.getProperties().getProperty("someKey")); - - cacheManager.shutdown(); - - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionUtils.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionUtils.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionUtils.java (revision 0) @@ -1,117 +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.awt.Color; - -/** - * CacheRegionUtils - * - * @author gkeim - */ -public abstract class CacheRegionUtils { - /** - * HIT_COLOR - */ - public static final Color HIT_COLOR = Color.green; - - /** - * MISS_COLOR - */ - public static final Color MISS_COLOR = Color.red; - - /** - * PUT_COLOR - */ - public static final Color PUT_COLOR = Color.blue; - - /** - * HIT_FILL_COLOR - */ - public static final Color HIT_FILL_COLOR = CacheRegionUtils.HIT_COLOR.brighter().brighter().brighter(); - - /** - * MISS_FILL_COLOR - */ - public static final Color MISS_FILL_COLOR = CacheRegionUtils.MISS_COLOR.brighter().brighter().brighter(); - - /** - * PUT_FILL_COLOR - */ - public static final Color PUT_FILL_COLOR = CacheRegionUtils.PUT_COLOR.brighter().brighter().brighter(); - - /** - * HIT_DRAW_COLOR - */ - public static final Color HIT_DRAW_COLOR = CacheRegionUtils.HIT_COLOR.darker(); - - /** - * MISS_DRAW_COLOR - */ - public static final Color MISS_DRAW_COLOR = CacheRegionUtils.MISS_COLOR.darker(); - - /** - * PUT_DRAW_COLOR - */ - public static final Color PUT_DRAW_COLOR = CacheRegionUtils.PUT_COLOR.darker(); - - - /** - * determineShortName - * - * @param fullName - */ - public static String determineShortName(String fullName) { - String result = fullName; - - if (fullName != null) { - String[] comps = fullName.split("\\."); - if (comps.length == 1) { - return fullName; - } - boolean truncate = true; - for (int i = 0; i < comps.length; i++) { - String comp = comps[i]; - char c = comp.charAt(0); - if (truncate && Character.isUpperCase(c)) { - truncate = false; - } - if (truncate) { - comps[i] = Character.toString(c); - } - } - result = join(comps, '.'); - } - - return result; - } - - /** - * join - * - * @param elements - * @param c - */ - private static String join(String[] elements, char c) { - if (elements == null) { return null; } - StringBuilder sb = new StringBuilder(); - for (String s : elements) { - sb.append(s).append(c); - } - return sb.length() > 0 ? sb.substring(0, sb.length() - 1) : ""; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/ExtendedStatistics.java (revision 0) @@ -1,552 +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 net.sf.ehcache.CacheOperationOutcomes; -import net.sf.ehcache.store.StoreOperationOutcomes; -import net.sf.ehcache.transaction.xa.XaCommitOutcome; -import net.sf.ehcache.transaction.xa.XaRecoveryOutcome; -import net.sf.ehcache.transaction.xa.XaRollbackOutcome; -import org.terracotta.statistics.archive.Timestamped; - -import java.util.EnumSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -/** - * The ExtendedStatistics interface. - * - * @author cschanck - */ -public interface ExtendedStatistics { - - /** The Constant ALL_CACHE_PUT_OUTCOMES. */ - static final Set ALL_CACHE_PUT_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.PutOutcome.class); - - /** The Constant ALL_CACHE_GET_OUTCOMES. */ - static final Set ALL_CACHE_GET_OUTCOMES = EnumSet.allOf(CacheOperationOutcomes.GetOutcome.class); - - /** The Constant ALL_CACHE_MISS_OUTCOMES. */ - static final Set ALL_CACHE_MISS_OUTCOMES = EnumSet.of( - CacheOperationOutcomes.GetOutcome.MISS_EXPIRED, CacheOperationOutcomes.GetOutcome.MISS_NOT_FOUND); - - /** The Constant ALL_STORE_PUT_OUTCOMES. */ - static final Set ALL_STORE_PUT_OUTCOMES = EnumSet.allOf(StoreOperationOutcomes.PutOutcome.class); - - /** - * Sets the time to disable. - * - * @param time the time - * @param unit the unit - */ - void setTimeToDisable(long time, TimeUnit unit); - - /** - * Sets the always on. - * - * @param alwaysOn the new always on - */ - void setAlwaysOn(boolean alwaysOn); - - /** - * Gets the. - * - * @return the operation - */ - Operation get(); - - /** - * Put. - * - * @return the operation - */ - Operation put(); - - /** - * Removes the. - * - * @return the operation - */ - Operation remove(); - - /** - * single arg replace operation - * @return - */ - Operation replaceOneArg(); - - /** - * two arg replace operation - * @return - */ - Operation replaceTwoArg(); - - /** - * put if absent operation - * @return - */ - Operation putIfAbsent(); - - /** - * remove element operation - * @return - */ - Operation removeElement(); - - /** - * Heap get. - * - * @return the operation - */ - Operation heapGet(); - - /** - * Offheap get. - * - * @return the operation - */ - Operation offheapGet(); - - /** - * Disk get. - * - * @return the operation - */ - Operation diskGet(); - - /** - * Heap put. - * - * @return the operation - */ - Operation heapPut(); - - /** - * Offheap put. - * - * @return the operation - */ - Operation offheapPut(); - - /** - * Disk put. - * - * @return the operation - */ - Operation diskPut(); - - /** - * Heap remove. - * - * @return the operation - */ - Operation heapRemove(); - - /** - * Offheap remove. - * - * @return the operation - */ - Operation offheapRemove(); - - /** - * Disk remove. - * - * @return the operation - */ - Operation diskRemove(); - - /** - * Search. - * - * @return the operation - */ - Operation search(); - - /** - * Xa commit. - * - * @return the operation - */ - Operation xaCommit(); - - /** - * Xa rollback. - * - * @return the operation - */ - Operation xaRollback(); - - /** - * Xa recovery. - * - * @return the operation - */ - Operation xaRecovery(); - - /** - * Eviction. - * - * @return the operation - */ - Operation eviction(); - - /** - * Expiry. - * - * @return the operation - */ - Operation expiry(); - - /** - * Cluster events - * - * @return the operation - */ - Operation clusterEvent(); - - /** - * Nonstop events - * - * @return the operation - */ - Operation nonstop(); - - /** - * All get. - * - * @return the result - */ - Result allGet(); - - /** - * All miss. - * - * @return the result - */ - Result allMiss(); - - /** - * All put. - * - * @return the result - */ - Result allPut(); - - /** - * Heap all put. - * - * @return the result - */ - Result heapAllPut(); - - /** - * Off heap all put. - * - * @return the result - */ - Result offHeapAllPut(); - - /** - * Disk all put. - * - * @return the result - */ - Result diskAllPut(); - - /** - * Cache hit ratio. - * @return - */ - Statistic cacheHitRatio(); - - /** - * Nonstop timeout ratio - * @return - */ - Statistic nonstopTimeoutRatio(); - - /** - * Operations. - * - * @param the generic type - * @param outcome the outcome - * @param name the name - * @param tags the tags - * @return the sets the - */ - > Set> operations(Class outcome, String name, String... tags); - - /** - * Get the set of cache specific pass thru statistics for a nam/tags pair. Used for - * custom pass thru statistics, as opposed to well known standard ones. - * @param name name - * @param tags set of tags - * @return - */ - Set> passthru(String name, Set tags); - - /** - * The Interface Operation. - * - * @param the generic type - */ - public interface Operation> { - - /** - * Type. - * - * @return the class - */ - Class type(); - - /** - * Component. - * - * @param result the result - * @return the result - */ - Result component(T result); - - /** - * Compound. - * - * @param results the results - * @return the result - */ - Result compound(Set results); - - /** - * Ratio of. - * - * @param numerator the numerator - * @param denomiator the denomiator - * @return the statistic - */ - Statistic ratioOf(Set numerator, Set denomiator); - - /** - * Sets the always on. - * - * @param enable the new always on - */ - void setAlwaysOn(boolean enable); - - /** - * Checks if is always on. - * - * @return true, if is always on - */ - boolean isAlwaysOn(); - - /** - * Sets the window. - * - * @param time the time - * @param unit the unit - */ - void setWindow(long time, TimeUnit unit); - - /** - * Sets the history. - * - * @param samples the samples - * @param time the time - * @param unit the unit - */ - void setHistory(int samples, long time, TimeUnit unit); - - /** - * Gets the window size. - * - * @param unit the unit - * @return the window size - */ - long getWindowSize(TimeUnit unit); - - /** - * Gets the history sample size. - * - * @return the history sample size - */ - int getHistorySampleSize(); - - /** - * Gets the history sample time. - * - * @param unit the unit - * @return the history sample time - */ - long getHistorySampleTime(TimeUnit unit); - - } - - /** - * The Interface Result. - */ - public interface Result { - - /** - * Count. - * - * @return the statistic - */ - Statistic count(); - - /** - * Rate. - * - * @return the statistic - */ - Statistic rate(); - - /** - * Latency. - * - * @return the latency - */ - Latency latency(); - } - - /** - * The Latency interface. Provides min/max/average. - */ - public interface Latency { - - /** - * Minimum latency observed. - * - * @return Minimum observed latency. NULL if no operation was observed. - */ - Statistic minimum(); - - /** - * Maximum latency observed. - * - * @return Maximum observed latency. NULL if no operation was observed. - */ - Statistic maximum(); - - /** - * Average observed latency. - * - * @return Average observed latency. NULL if no operation was observed. - */ - Statistic average(); - } - - /** - * The Interface Statistic. - * - * @param the generic type - */ - public interface Statistic { - - /** - * Active. - * - * @return true, if successful - */ - boolean active(); - - /** - * Value. - * - * @return the t - */ - T value(); - - /** - * History. - * - * @return the list - */ - List> history(); - } - - /** - * Gets the size. - * - * @return the size - */ - Statistic size(); - - /** - * Gets the local heap size. - * - * @return the local heap size - */ - Statistic localHeapSize(); - - /** - * Gets the local heap size in bytes. - * - * @return the local heap size in bytes - */ - Statistic localHeapSizeInBytes(); - - /** - * Gets the local off heap size. - * - * @return the local off heap size - */ - Statistic localOffHeapSize(); - - /** - * Gets the local off heap size in bytes. - * - * @return the local off heap size in bytes - */ - Statistic localOffHeapSizeInBytes(); - - /** - * Gets the local disk size. - * - * @return the local disk size - */ - Statistic localDiskSize(); - - /** - * Gets the local disk size in bytes. - * - * @return the local disk size in bytes - */ - Statistic localDiskSizeInBytes(); - - /** - * Gets the remote size. - * - * @return the remote size - */ - Statistic remoteSize(); - - /** - * Gets the writer queue length. - * - * @return the writer queue length - */ - Statistic writerQueueLength(); - - /** - * Get the timestamp (millis) of the last cluster rejoin event - * - * @return statistic for cluster rejoin timestamp - */ - Statistic mostRecentRejoinTimeStampMillis(); - -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/eventual/package.html (revision 0) @@ -1,10 +0,0 @@ - - - - -

Construct related to eventual operations

- -This package contains a decorator which offers a strong view on an eventual consistent cache. - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheEventListenerFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheEventListenerFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheEventListenerFactory.java (revision 0) @@ -1,39 +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.event; - -import java.util.Properties; - -/** - * An abstract factory for creating listeners. Implementers should provide their own - * concrete factory extending this factory. It can then be configured in ehcache.xml. - * - * @author Greg Luck - * @version $Id: CacheEventListenerFactory.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public abstract class CacheEventListenerFactory { - - /** - * Create a CacheEventListener - * - * @param properties implementation specific properties. These are configured as comma - * separated name value pairs in ehcache.xml - * @return a constructed CacheEventListener - */ - public abstract CacheEventListener createCacheEventListener(Properties properties); - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/classloader/package.html (revision 0) @@ -1,10 +0,0 @@ - - - - -

ClassLoader contstructs package

- -This package contains decorators that are concerned with classloaders - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ConfigurationElement.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ConfigurationElement.java (revision 0) @@ -1,197 +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 java.util.List; - -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; -import net.sf.ehcache.config.FactoryConfiguration; -import net.sf.ehcache.config.ManagementRESTServiceConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.config.TerracottaClientConfiguration; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * Element representing the {@link Configuration}. This element does not have a parent and is always null. - * - * @author Abhishek Sanoujam - * - */ -public class ConfigurationElement extends SimpleNodeElement { - - private final CacheManager cacheManager; - private final Configuration configuration; - - /** - * Constructor accepting the {@link Configuration}. This element does not have a parent and is always null. - * - * @param configuration - */ - public ConfigurationElement(Configuration configuration) { - super(null, "ehcache"); - this.cacheManager = null; - this.configuration = configuration; - init(); - } - - /** - * Constructor accepting the {@link CacheManager}. This element does not have a parent and is always null. - * - * @param cacheManager - */ - public ConfigurationElement(CacheManager cacheManager) { - super(null, "ehcache"); - this.cacheManager = cacheManager; - this.configuration = cacheManager.getConfiguration(); - init(); - } - - private void init() { - if (configuration == null) { - return; - } - // add the attributes - addAttribute(new SimpleNodeAttribute("name", configuration.getName()).optional(true)); - addAttribute(new SimpleNodeAttribute("monitoring", configuration.getMonitoring()).optional(true).defaultValue( - Configuration.DEFAULT_MONITORING.name().toLowerCase())); - addAttribute(new SimpleNodeAttribute("dynamicConfig", configuration.getDynamicConfig()).optional(true).defaultValue( - String.valueOf(Configuration.DEFAULT_DYNAMIC_CONFIG))); - addAttribute(new SimpleNodeAttribute("defaultTransactionTimeoutInSeconds", configuration.getDefaultTransactionTimeoutInSeconds()) - .optional(true).defaultValue(String.valueOf(Configuration.DEFAULT_TRANSACTION_TIMEOUT))); - testAddMaxBytesLocalHeapAttribute(); - testAddMaxBytesLocalOffHeapAttribute(); - testAddMaxBytesLocalDiskAttribute(); - - // add the child elements - testAddDiskStoreElement(); - testAddSizeOfPolicyElement(); - testAddTransactionManagerLookupElement(); - testAddManagementRESTService(); - testAddCacheManagerEventListenerFactoryElement(); - testAddCacheManagerPeerProviderFactoryElement(); - testAddCacheManagerPeerListenerFactoryElement(); - - addChildElement(new DefaultCacheConfigurationElement(this, configuration, configuration.getDefaultCacheConfiguration())); - - if (cacheManager != null) { - for (String cacheName : cacheManager.getCacheNames()) { - boolean decoratedCache = false; - Ehcache cache = cacheManager.getCache(cacheName); - if (cache == null) { - cache = cacheManager.getEhcache(cacheName); - decoratedCache = true; - } - CacheConfiguration config = decoratedCache ? cache.getCacheConfiguration().clone().name(cacheName) : cache.getCacheConfiguration(); - addChildElement(new CacheConfigurationElement(this, configuration, config)); - } - } else { - for (CacheConfiguration cacheConfiguration : configuration.getCacheConfigurations().values()) { - addChildElement(new CacheConfigurationElement(this, configuration, cacheConfiguration)); - } - } - - testAddTerracottaElement(); - } - - private void testAddMaxBytesLocalHeapAttribute() { - if (configuration.getMaxBytesLocalHeap() > 0) { - addAttribute(new SimpleNodeAttribute("maxBytesLocalHeap", configuration.getMaxBytesLocalHeapAsString()) - .optional(true).defaultValue(String.valueOf(Configuration.DEFAULT_MAX_BYTES_ON_HEAP))); - } - } - - private void testAddMaxBytesLocalOffHeapAttribute() { - if (configuration.getMaxBytesLocalOffHeap() > 0) { - addAttribute(new SimpleNodeAttribute("maxBytesLocalOffHeap", configuration.getMaxBytesLocalOffHeapAsString()) - .optional(true).defaultValue(String.valueOf(Configuration.DEFAULT_MAX_BYTES_OFF_HEAP))); - } - } - - private void testAddMaxBytesLocalDiskAttribute() { - if (configuration.getMaxBytesLocalDisk() > 0) { - addAttribute(new SimpleNodeAttribute("maxBytesLocalDisk", configuration.getMaxBytesLocalDiskAsString()) - .optional(true).defaultValue(String.valueOf(Configuration.DEFAULT_MAX_BYTES_ON_DISK))); - } - } - - private void testAddDiskStoreElement() { - DiskStoreConfiguration diskStoreConfiguration = configuration.getDiskStoreConfiguration(); - if (diskStoreConfiguration != null) { - addChildElement(new DiskStoreConfigurationElement(this, diskStoreConfiguration)); - } - } - - private void testAddSizeOfPolicyElement() { - SizeOfPolicyConfiguration sizeOfPolicyConfiguration = configuration.getSizeOfPolicyConfiguration(); - if (sizeOfPolicyConfiguration != null && - !Configuration.DEFAULT_SIZEOF_POLICY_CONFIGURATION.equals(sizeOfPolicyConfiguration)) { - addChildElement(new SizeOfPolicyConfigurationElement(this, sizeOfPolicyConfiguration)); - } - } - - private void testAddTransactionManagerLookupElement() { - FactoryConfiguration transactionManagerLookupConfiguration = configuration.getTransactionManagerLookupConfiguration(); - if (transactionManagerLookupConfiguration != null - && !transactionManagerLookupConfiguration.equals(Configuration.DEFAULT_TRANSACTION_MANAGER_LOOKUP_CONFIG)) { - addChildElement(new FactoryConfigurationElement(this, "transactionManagerLookup", transactionManagerLookupConfiguration)); - } - } - - private void testAddManagementRESTService() { - ManagementRESTServiceConfiguration managementRESTServiceConfiguration = configuration.getManagementRESTService(); - if (managementRESTServiceConfiguration != null) { - addChildElement(new ManagementRESTServiceConfigurationElement(this, managementRESTServiceConfiguration)); - } - } - - private void testAddCacheManagerEventListenerFactoryElement() { - FactoryConfiguration cacheManagerEventListenerFactoryConfiguration = configuration - .getCacheManagerEventListenerFactoryConfiguration(); - if (cacheManagerEventListenerFactoryConfiguration != null) { - addChildElement(new FactoryConfigurationElement(this, "cacheManagerEventListenerFactory", - cacheManagerEventListenerFactoryConfiguration)); - } - } - - private void testAddCacheManagerPeerProviderFactoryElement() { - List cacheManagerPeerProviderFactoryConfiguration = configuration - .getCacheManagerPeerProviderFactoryConfiguration(); - if (cacheManagerPeerProviderFactoryConfiguration != null) { - addAllFactoryConfigsAsChildElements(this, "cacheManagerPeerProviderFactory", cacheManagerPeerProviderFactoryConfiguration); - } - } - - private void testAddCacheManagerPeerListenerFactoryElement() { - List cacheManagerPeerListenerFactoryConfigurations = configuration - .getCacheManagerPeerListenerFactoryConfigurations(); - if (cacheManagerPeerListenerFactoryConfigurations != null && !cacheManagerPeerListenerFactoryConfigurations.isEmpty()) { - addAllFactoryConfigsAsChildElements(this, "cacheManagerPeerListenerFactory", cacheManagerPeerListenerFactoryConfigurations); - } - } - - private void testAddTerracottaElement() { - TerracottaClientConfiguration terracottaConfiguration = configuration.getTerracottaConfiguration(); - if (terracottaConfiguration != null) { - addChildElement(new TerracottaConfigConfigurationElement(this, terracottaConfiguration)); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/config/generator/xsom/XSDAttributeValueType.java (revision 0) @@ -1,264 +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.xsom; - -import net.sf.ehcache.config.MemoryUnit; - -import java.util.Iterator; -import java.util.Random; - -import com.sun.xml.xsom.XSAttributeDecl; -import com.sun.xml.xsom.XSFacet; -import com.sun.xml.xsom.XSRestrictionSimpleType; -import com.sun.xml.xsom.XSSimpleType; - -public abstract class XSDAttributeValueType { - - protected static final Random RANDOM = new Random(System.currentTimeMillis()); - protected String pattern; - public enum XsdType { - BOOLEAN, INTEGER, POSITIVE_INTEGER, NON_NEGATIVE_INTEGER, STRING, ANY_SIMPLE_TYPE, ENUMERATION; - } - protected String maxValue; - protected String minValue; - protected String length; - protected String maxLength; - protected String minLength; - - protected String totalDigits; - - private final XsdType type; - - public XSDAttributeValueType(XsdType type) { - this.type = type; - } - - public abstract String getRandomAllowedValue(); - - protected void fillUpRestrictions(XSAttributeDecl attributeDecl) { - XSSimpleType localType = attributeDecl.getType(); - XSRestrictionSimpleType restriction = localType.asRestriction(); - if (restriction != null) { - Iterator i = restriction.getDeclaredFacets().iterator(); - while (i.hasNext()) { - XSFacet facet = i.next(); - if (facet.getName().equals(XSFacet.FACET_MAXINCLUSIVE)) { - maxValue = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_MININCLUSIVE)) { - minValue = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_MAXEXCLUSIVE)) { - maxValue = String.valueOf(Integer.parseInt(facet.getValue().value) - 1); - } - if (facet.getName().equals(XSFacet.FACET_MINEXCLUSIVE)) { - minValue = String.valueOf(Integer.parseInt(facet.getValue().value) + 1); - } - if (facet.getName().equals(XSFacet.FACET_LENGTH)) { - length = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_MAXLENGTH)) { - maxLength = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_MINLENGTH)) { - minLength = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_PATTERN)) { - pattern = facet.getValue().value; - } - if (facet.getName().equals(XSFacet.FACET_TOTALDIGITS)) { - totalDigits = facet.getValue().value; - } - } - } - } - - public static class XSDAttributeValueBooleanType extends XSDAttributeValueType { - - public XSDAttributeValueBooleanType() { - super(XsdType.BOOLEAN); - } - - @Override - public String getRandomAllowedValue() { - return RANDOM.nextInt() % 2 == 0 ? getTrue() : getFalse(); - } - - public String getTrue() { - return String.valueOf(true); - } - - public String getFalse() { - return String.valueOf(false); - } - - } - - public static class XSDAttributeValueIntegerType extends XSDAttributeValueType { - - public XSDAttributeValueIntegerType() { - super(XsdType.INTEGER); - } - - @Override - public String getRandomAllowedValue() { - return String.valueOf(RANDOM.nextInt()); - } - - } - - public static class XSDAttributeValuePositiveIntegerType extends XSDAttributeValueType { - - public XSDAttributeValuePositiveIntegerType() { - super(XsdType.POSITIVE_INTEGER); - } - - @Override - public String getRandomAllowedValue() { - return String.valueOf(Math.abs(RANDOM.nextInt() + 1)); - } - - } - - public static class XSDAttributeValueNonNegativeIntegerType extends XSDAttributeValueType { - - public XSDAttributeValueNonNegativeIntegerType() { - super(XsdType.NON_NEGATIVE_INTEGER); - } - - @Override - public String getRandomAllowedValue() { - return String.valueOf(Math.abs(RANDOM.nextInt())); - } - - } - - public static class XSDAttributeValueMemoryUnitType extends XSDAttributeValueType { - - public static final char[] unitChars; - - static { - MemoryUnit[] values = MemoryUnit.values(); - char [] chars = new char[values.length * 2]; - int i = 0; - for (MemoryUnit memoryUnit : values) { - chars[i++] = Character.toLowerCase(memoryUnit.getUnit()); - chars[i++] = Character.toUpperCase(memoryUnit.getUnit()); - } - unitChars = chars; - } - - public XSDAttributeValueMemoryUnitType() { - super(XsdType.NON_NEGATIVE_INTEGER); - } - - @Override - public String getRandomAllowedValue() { - int index = RANDOM.nextInt(unitChars.length + 1); - if(index < unitChars.length) { - return String.valueOf(Math.abs(RANDOM.nextInt())) + unitChars[index]; - } - return String.valueOf(Math.abs(RANDOM.nextInt())); - } - - } - - public static class XSDAttributeValueMemoryUnitOrPercentageType extends XSDAttributeValueType { - - public static final char[] unitChars; - - static { - MemoryUnit[] values = MemoryUnit.values(); - char [] chars = new char[values.length * 2 + 1]; - int i = 0; - for (MemoryUnit memoryUnit : values) { - chars[i++] = Character.toLowerCase(memoryUnit.getUnit()); - chars[i++] = Character.toUpperCase(memoryUnit.getUnit()); - } - chars[i] = '%'; - unitChars = chars; - } - - public XSDAttributeValueMemoryUnitOrPercentageType() { - super(XsdType.NON_NEGATIVE_INTEGER); - } - - @Override - public String getRandomAllowedValue() { - int index = RANDOM.nextInt(unitChars.length + 1); - if(index < unitChars.length) { - switch (unitChars[index]) { - case '%' : - return String.valueOf(Math.abs(RANDOM.nextInt(100) + 1)) + unitChars[index]; - default: - return String.valueOf(Math.abs(RANDOM.nextInt())) + unitChars[index]; - } - } - return String.valueOf(Math.abs(RANDOM.nextInt())); - } - - } - - public static class XSDAttributeValueStringType extends XSDAttributeValueType { - - private static final String[] RANDOM_VALUES = {"random_string_one", "random_string_two", "random_string_three", "random_string_four", - "random_string_five", }; - - public XSDAttributeValueStringType() { - super(XsdType.STRING); - } - - @Override - public String getRandomAllowedValue() { - return RANDOM_VALUES[RANDOM.nextInt(RANDOM_VALUES.length)]; - } - - } - - public static class XSDAttributeValueAnySimpleType extends XSDAttributeValueType { - - private static final String[] RANDOM_VALUES = {"any_simple_type_random_one", "any_simple_type_random_two", - "any_simple_type_random_three", "any_simple_type_random_four", "any_simple_type_random_five", }; - - public XSDAttributeValueAnySimpleType() { - super(XsdType.ANY_SIMPLE_TYPE); - } - - @Override - public String getRandomAllowedValue() { - return RANDOM_VALUES[RANDOM.nextInt(RANDOM_VALUES.length)]; - } - - } - - public static class XSDAttributeValueEnumerationType extends XSDAttributeValueType { - - private final String[] enumeration; - - public XSDAttributeValueEnumerationType(String[] enumeration) { - super(XsdType.ENUMERATION); - this.enumeration = enumeration; - } - - @Override - public String getRandomAllowedValue() { - return enumeration[RANDOM.nextInt(enumeration.length)]; - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ElementValueComparatorConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ElementValueComparatorConfigurationElement.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/ElementValueComparatorConfigurationElement.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.model.elements; - -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * {@link net.sf.ehcache.config.generator.model.NodeElement} representing the - * {@link net.sf.ehcache.config.ElementValueComparatorConfiguration} - * - * @author Ludovic Orban - * - */ -public class ElementValueComparatorConfigurationElement extends SimpleNodeElement { - - private final ElementValueComparatorConfiguration elementValueComparatorConfiguration; - - /** - * Constructor accepting the parent and the {@link net.sf.ehcache.config.ElementValueComparatorConfiguration} - * - * @param parent - * @param elementValueComparatorConfiguration - */ - public ElementValueComparatorConfigurationElement(NodeElement parent, - ElementValueComparatorConfiguration elementValueComparatorConfiguration) { - super(parent, "elementValueComparator"); - this.elementValueComparatorConfiguration = elementValueComparatorConfiguration; - init(); - } - - private void init() { - if (elementValueComparatorConfiguration == null) { - return; - } - addAttribute(new SimpleNodeAttribute("class", elementValueComparatorConfiguration.getClassName()).optional(false)); - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/util/RetryAssert.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/util/RetryAssert.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/util/RetryAssert.java (revision 0) @@ -1,80 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package net.sf.ehcache.util; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.store.Store; - -import org.hamcrest.Matcher; -import org.junit.Assert; - -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; - -public class RetryAssert { - protected RetryAssert() { - // static only class - } - - public static void assertBy(long time, TimeUnit unit, Callable value, Matcher matcher) { - boolean interrupted = false; - long start = System.nanoTime(); - long end = start + unit.toNanos(time); - long sleep = Math.max(50, unit.toMillis(time) / 10); - AssertionError latest; - try { - while (true) { - try { - Assert.assertThat(value.call(), matcher); - return; - } catch (AssertionError e) { - latest = e; - } catch (Exception e) { - latest = new AssertionError(e); - } - - if (System.nanoTime() > end) { - break; - } else { - try { - Thread.sleep(sleep); - } catch (InterruptedException e) { - interrupted = true; - } - } - } - } finally { - if (interrupted) { - Thread.currentThread().interrupt(); - } - } - throw latest; - } - - public static Callable elementAt(final Ehcache cache, final Object key) { - return new Callable() { - public Element call() { - return cache.get(key); - } - }; - } - - public static Callable sizeOf(final Ehcache cache) { - return new Callable() { - public Integer call() throws Exception { - return cache.getSize(); - } - }; - } - - public static Callable sizeOnDiskOf(final Store store) { - return new Callable() { - public Integer call() throws Exception { - return store.getOnDiskSize(); - } - }; - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/Person.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/Person.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/domain/Person.java (revision 0) @@ -1,108 +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.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.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsExplictLockingTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsExplictLockingTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsExplictLockingTest.java (revision 0) @@ -1,229 +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.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.Set; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class BulkOpsExplictLockingTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsExplictLockingTest(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 dcv2Strong = createCache("dcv2Strong", cacheManager, Consistency.STRONG); - testBulkOpsWithExplictLocking(dcv2Strong); - Cache dcv2Eventual = createCache("dcv2Eventual", cacheManager, Consistency.EVENTUAL); - testBulkOpsWithExplictLocking(dcv2Eventual); - - } - - private void testBulkOpsWithExplictLocking(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))); - } - Key key = new Key("key0", 0); - if (index == 0) { - cache.acquireWriteLockOnKey(key); - cache.putAll(elements); - } - - barrier.await(); - if (index == 0) { - Assert.assertTrue(cache.isWriteLockedByCurrentThread(key)); - } else { - Assert.assertFalse(cache.isWriteLockedByCurrentThread(key)); - } - - if (index == 0) { - cache.releaseWriteLockOnKey(key); - } - Assert.assertFalse(cache.isWriteLockedByCurrentThread(key)); - 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)); - } - - cache.acquireReadLockOnKey(key); - Map rv = cache.getAll(keySet1); - cache.releaseReadLockOnKey(key); - Assert.assertEquals(numOfElements, rv.size()); - - for (Element element : rv.values()) { - Assert.assertTrue(elements.contains(element)); - } - - Collection values = rv.values(); - 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 (Element element : rv.values()) { - Assert.assertTrue(elements.contains(element)); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.acquireWriteLockOnKey(key); - cache.removeAll(keySet2); - cache.releaseWriteLockOnKey(key); - System.out.println("removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - } - barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("now checking removed in " + cache.getName() + " by client"); - for (Object k : keySet2) { - Assert.assertNull(cache.get(k)); - } - System.out.println("client, I am 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.STRONG); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - 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; - } - - } - - 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; - } - - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-unloadablecachemanagerlistenerclass.xml (revision 0) @@ -1,175 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/JavaBeanAttributeExtractor.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/JavaBeanAttributeExtractor.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/JavaBeanAttributeExtractor.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.attribute; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import net.sf.ehcache.Element; - -/** - * Extracts a search attribute determining the value as a javabean property on either - * the key or the value. If the property exists on both the key and the value an exception is thrown - * - * @author teck - */ -public class JavaBeanAttributeExtractor implements AttributeExtractor { - - private static final Object NO_VALUE = new Object(); - - private transient volatile MethodRef lastKeyMethod; - private transient volatile MethodRef lastValueMethod; - - private final String beanProperty; - - /** - * Constructor - * - * @param beanProperty the bean property name to extract - */ - public JavaBeanAttributeExtractor(String beanProperty) { - if (beanProperty == null) { - throw new NullPointerException(); - } - - beanProperty = beanProperty.trim(); - - if (beanProperty.length() == 0) { - throw new IllegalArgumentException("bean property empty"); - } - - this.beanProperty = beanProperty; - } - - /** - * {@inheritDoc} - */ - public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { - Object attribute = NO_VALUE; - - final Object key = element.getObjectKey(); - - if (key != null) { - MethodRef keyMethod = lastKeyMethod; - if (keyMethod == null || keyMethod.targetClass != key.getClass()) { - keyMethod = findMethod(key); - lastKeyMethod = keyMethod; - } - if (keyMethod.method != null) { - attribute = getValue(keyMethod.method, key); - } - } - - final Object value = element.getObjectValue(); - - if (value != null) { - MethodRef valueMethod = lastValueMethod; - if (valueMethod == null || valueMethod.targetClass != value.getClass()) { - valueMethod = findMethod(value); - lastValueMethod = valueMethod; - } - - if (valueMethod.method != null) { - if (attribute != NO_VALUE) { - throw new AttributeExtractorException("Bean property [" + beanProperty + "] present on both key and value"); - } - - return getValue(valueMethod.method, value); - } - } - - if (attribute != NO_VALUE) { - return attribute; - } - - throw new AttributeExtractorException("Bean property [" + beanProperty + "] not present on either key or value"); - } - - private MethodRef findMethod(Object obj) { - String upperFirstProp = "" + Character.toUpperCase(beanProperty.charAt(0)); - if (beanProperty.length() > 1) { - upperFirstProp += beanProperty.substring(1); - } - - final Class target = obj.getClass(); - - try { - return new MethodRef(target, target.getMethod("get" + upperFirstProp)); - } catch (SecurityException e) { - throw new AttributeExtractorException(e); - } catch (NoSuchMethodException e) { - // keep looking - } - - try { - Method m = target.getMethod("is" + upperFirstProp); - if (m.getReturnType().equals(Boolean.class) || m.getReturnType().equals(Boolean.TYPE)) { - return new MethodRef(target, m); - } - } catch (SecurityException e) { - throw new AttributeExtractorException(e); - } catch (NoSuchMethodException e) { - // - } - - // no applicable method available - return new MethodRef(target, null); - } - - private Object getValue(Method method, Object key) { - try { - return method.invoke(key); - } catch (Throwable t) { - if (t instanceof InvocationTargetException) { - t = t.getCause(); - } - - if (t instanceof Error) { - throw ((Error) t); - } - - throw new AttributeExtractorException("Error getting bean property [" + beanProperty + "] on instance of " - + key.getClass().getName(), t); - } - } - - /** - * A cached method lookup. Method is null to indicate the method is not present/accessible - */ - private static class MethodRef { - private final Class targetClass; - private final Method method; - - MethodRef(Class target, Method method) { - this.targetClass = target; - this.method = method; - } - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicContainerJTATest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicContainerJTATest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/BasicContainerJTATest.java (revision 0) @@ -1,63 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.container; - -import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.WebResponse; -import com.tc.test.AppServerInfo; -import com.tc.test.server.appserver.deployment.AbstractStandaloneTwoServerDeploymentTest; -import com.tc.test.server.appserver.deployment.DeploymentBuilder; -import com.tc.test.server.appserver.deployment.WebApplicationServer; - -import junit.framework.Test; - -public class BasicContainerJTATest extends AbstractStandaloneTwoServerDeploymentTest { - - private static final String CONTEXT = "BasicContainerJTATest"; - - public BasicContainerJTATest() { - if (appServerInfo().getId() == AppServerInfo.JETTY || appServerInfo().getId() == AppServerInfo.TOMCAT - || appServerInfo().getId() == AppServerInfo.WEBSPHERE) { - // Jetty and Tomcat have no TM and we know the Websphere one is not compatible - disableTest(); - } - } - - public static Test suite() { - return new BasicContainerJTATestSetup(); - } - - public void testBasics() throws Exception { - System.out.println("Running test"); - WebClient conversation = new WebClient(); - - // do insert on server0 - WebResponse response1 = request(server0, "cmd=insert", conversation); - assertEquals("OK", response1.getContentAsString().trim()); - - // do query on server1 - response1 = request(server1, "cmd=query", conversation); - assertEquals("OK", response1.getContentAsString().trim()); - System.out.println("Test finished"); - } - - private WebResponse request(WebApplicationServer server, String params, WebClient con) throws Exception { - return server.ping("/" + CONTEXT + "/BasicJTATestServlet?" + params, con); - } - - private static class BasicContainerJTATestSetup extends AbstractStandaloneContainerJTATestSetup { - - public BasicContainerJTATestSetup() { - super(BasicContainerJTATest.class, "basic-xa-appserver-test.xml", CONTEXT); - } - - @Override - protected void configureWar(DeploymentBuilder builder) { - super.configureWar(builder); - builder.addServlet("BasicTestJTAServlet", "/BasicJTATestServlet/*", BasicJTATestServlet.class, null, false); - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/OperationConverter.java (revision 0) @@ -1,34 +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; - -/** - * Interface that allows an converter to be implemented that can create an operation based - * on an arbitrary object. - * - * @param the operation type that should be converted to - * @author Geert Bevin - * @version $Id: OperationConverter.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public interface OperationConverter { - /** - * Convert an arbitrary object - * - * @param source the object to convert - * @return the converted operation instance - */ - public T convert(Object source); -} Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/ClusteredStoreTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/ClusteredStoreTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/store/ClusteredStoreTest.java (revision 0) @@ -1,173 +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 org.terracotta.modules.ehcache.store; - -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.CacheStoreHelper; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.NonEternalElementData; -import net.sf.ehcache.Status; -import net.sf.ehcache.cluster.CacheCluster; -import net.sf.ehcache.cluster.ClusterNode; -import net.sf.ehcache.cluster.ClusterTopologyListener; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.TerracottaClientConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.event.CacheEventListener; -import net.sf.ehcache.event.CacheEventListenerAdapter; -import net.sf.ehcache.event.RegisteredEventListeners; -import net.sf.ehcache.store.DefaultElementValueComparator; - -import org.junit.Before; -import org.junit.Test; -import org.terracotta.modules.ehcache.ToolkitInstanceFactory; -import org.terracotta.toolkit.cache.ToolkitCacheListener; -import org.terracotta.toolkit.collections.ToolkitMap; -import org.terracotta.toolkit.concurrent.locks.ToolkitLock; -import org.terracotta.toolkit.events.ToolkitNotifier; -import org.terracotta.toolkit.internal.ToolkitInternal; -import org.terracotta.toolkit.internal.ToolkitProperties; -import org.terracotta.toolkit.internal.cache.ToolkitCacheInternal; -import org.terracotta.toolkit.internal.cache.ToolkitValueComparator; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -/** - * Test that asserts quickSize is not called when {@link Ehcache} sizing methods are called. - * - * @author Ludovic Orban - */ -public class ClusteredStoreTest { - - private Ehcache cache = mock(Ehcache.class); - private CacheConfiguration cacheConfiguration = new CacheConfiguration().terracotta(new TerracottaConfiguration().clustered(true).consistency(TerracottaConfiguration.Consistency.EVENTUAL)); - private Configuration configuration = new Configuration().name("ClusteredStoreTest-cm").terracotta(new TerracottaClientConfiguration()); - private ToolkitCacheInternal toolkitCacheInternal = mock(ToolkitCacheInternal.class); - private ClusteredStore clusteredStore; - private ToolkitInstanceFactory toolkitInstanceFactory = mock(ToolkitInstanceFactory.class); - private CacheCluster cacheCluster = mockCacheCluster("abc"); - private CacheManager cacheManager = when(mock(CacheManager.class).getConfiguration()).thenReturn(configuration).getMock(); - private ToolkitMap configMap = mock(ToolkitMap.class); - private ToolkitInternal toolkitInternal = mock(ToolkitInternal.class); - private ToolkitProperties toolkitProperties = mock(ToolkitProperties.class); - private org.terracotta.toolkit.config.Configuration toolkitCacheConfiguration = mock(org.terracotta.toolkit.config.Configuration.class); - private ToolkitNotifier toolkitNotifier = mock(ToolkitNotifier.class); - private CacheStoreHelper cacheStoreHelper = mock(CacheStoreHelper.class); - private ToolkitLock toolkitLock = mock(ToolkitLock.class); - - @Before - public void setUpClusteredStore() { - when(cache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cache.getCacheManager()).thenReturn(cacheManager); - when(cache.getName()).thenReturn("ClusteredStoreTest-cache"); - when(cache.getStatus()).thenReturn(Status.STATUS_ALIVE); - when(cache.getCacheEventNotificationService()).thenReturn(new RegisteredEventListeners(cache, cacheStoreHelper)); - when(cacheManager.getName()).thenReturn("ClusteredStoreTest-cm"); - when(toolkitInstanceFactory.getOrCreateClusteredStoreConfigMap(eq("ClusteredStoreTest-cm"), eq("ClusteredStoreTest-cache"))).thenReturn(configMap); - when(toolkitInstanceFactory.getToolkit()).thenReturn(toolkitInternal); - when(toolkitInstanceFactory.getLockForCache(any(Ehcache.class), anyString())).thenReturn(toolkitLock); - when(toolkitInternal.getProperties()).thenReturn(toolkitProperties); - when(toolkitProperties.getBoolean(anyString())).thenReturn(false); - when(toolkitInstanceFactory.getOrCreateToolkitCache(cache)).thenReturn(toolkitCacheInternal); - when(toolkitCacheInternal.getConfiguration()).thenReturn(toolkitCacheConfiguration); - when(toolkitCacheConfiguration.getInt(anyString())).thenReturn(1); - when(toolkitInstanceFactory.getOrCreateConfigChangeNotifier(eq(cache))).thenReturn(toolkitNotifier); - clusteredStore = new ClusteredStore(toolkitInstanceFactory, cache, cacheCluster) { - @Override - void setUpWanConfig() { - // Do Nothing - } - }; - when(cacheStoreHelper.getStore()).thenReturn(clusteredStore); - } - - private static CacheCluster mockCacheCluster(String thisNode) { - CacheCluster cacheCluster = mock(CacheCluster.class); - ClusterNode node = when(mock(ClusterNode.class).getId()).thenReturn(thisNode).getMock(); - when(cacheCluster.getCurrentNode()).thenReturn(node); - return cacheCluster; - } - - @Test - public void clusteredStore_getSize_calls_size_not_quickSize() throws Exception { - clusteredStore.getSize(); - verify(toolkitCacheInternal, times(1)).size(); - verify(toolkitCacheInternal, times(0)).quickSize(); - } - - @Test - public void clusteredStore_getTerracottaClusteredSize_calls_size_not_quickSize() throws Exception { - clusteredStore.getTerracottaClusteredSize(); - verify(toolkitCacheInternal, times(1)).size(); - verify(toolkitCacheInternal, times(0)).quickSize(); - } - - @Test - public void clusteredStore_putIfAbsent_enabled_in_eventual_consistency() { - clusteredStore.putIfAbsent(new Element("key", "value")); - verify(toolkitCacheInternal).putIfAbsent(eq("key"), any(NonEternalElementData.class)); - } - - @Test - public void clusteredStore_replace_1_arg_enabled_in_eventual_consistency() { - clusteredStore.replace(new Element("key", "value")); - verify(toolkitCacheInternal).replace(any(), any()); - } - - @Test - public void clusteredStore_replace_2_args_enabled_in_eventual_consistency() { - clusteredStore.replace(new Element("key", "value"), new Element("key", "other"), new DefaultElementValueComparator(cacheConfiguration)); - verify(toolkitCacheInternal).replace(any(), any(), any(), any(ToolkitValueComparator.class)); - } - - @Test - public void clusteredStore_removeElement_enabled_in_eventual_consistency() { - clusteredStore.removeElement(new Element("key", "value"), new DefaultElementValueComparator(cacheConfiguration)); - verify(toolkitCacheInternal).remove(any(), any(), any(ToolkitValueComparator.class)); - } - - @Test - public void testDispose() throws Exception { - clusteredStore.dispose(); - verify(toolkitCacheInternal).disposeLocally(); - verify(cacheCluster).removeTopologyListener(any(ClusterTopologyListener.class)); - verify(toolkitCacheInternal).removeListener(any(ToolkitCacheListener.class)); - } - - @Test - public void testRegisterToolkitCacheEventListener() throws Exception { - verify(toolkitCacheInternal, never()).addListener(any(ToolkitCacheListener.class)); - cache.getCacheEventNotificationService().registerListener(new CacheEventListenerAdapter()); - cache.getCacheEventNotificationService().registerListener(new CacheEventListenerAdapter()); - verify(toolkitCacheInternal, times(1)).addListener(any(ToolkitCacheListener.class)); - } - - @Test - public void testUnregisterToolkitCacheEventListener() throws Exception { - String thisNodeId = cacheCluster.getCurrentNode().getId(); - when(configMap.get(ClusteredStore.LEADER_NODE_ID)).thenReturn(thisNodeId); // make this node the leader - verify(toolkitCacheInternal, never()).addListener(any(ToolkitCacheListener.class)); - CacheEventListener listener = new CacheEventListenerAdapter(); - cache.getCacheEventNotificationService().registerListener(listener); - cache.getCacheEventNotificationService().registerListener(listener); - cache.getCacheEventNotificationService().unregisterListener(listener); - cache.getCacheEventNotificationService().unregisterListener(listener); - verify(toolkitCacheInternal, times(1)).removeListener(any(ToolkitCacheListener.class)); - verify(configMap).remove(ClusteredStore.LEADER_NODE_ID); // make sure we drop leader status - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/filter/annotations/CustomAnnotation.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.pool.sizeof.filter.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE }) -public @interface CustomAnnotation { - boolean deprecated() default true; - short differentReturnType() default 10; - Class aClass() default Integer.class; - ExampleEnum anEnum() default ExampleEnum.TWO; - Deprecated anAnnotation() default @Deprecated; -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/CompoundOperationImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/CompoundOperationImpl.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/CompoundOperationImpl.java (revision 0) @@ -1,285 +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.Arrays; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Result; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Statistic; - -import org.terracotta.statistics.OperationStatistic; -import org.terracotta.statistics.ValueStatistic; - -/** - * The Class CompoundOperationImpl. - * - * @param the generic type - * @author cdennis - */ -class CompoundOperationImpl> implements Operation { - - private final OperationStatistic source; - - private final Class type; - private final Map> operations; - private final ConcurrentMap, OperationImpl> compounds = new ConcurrentHashMap, OperationImpl>(); - private final ConcurrentMap>, ExpiringStatistic> ratios = new ConcurrentHashMap>, ExpiringStatistic>(); - - private final ScheduledExecutorService executor; - - private volatile long averageNanos; - private volatile int historySize; - private volatile long historyNanos; - - private volatile boolean alwaysOn = false; - - /** - * Instantiates a new compound operation impl. - * - * @param source the source - * @param type the type - * @param averagePeriod the average period - * @param averageUnit the average unit - * @param executor the executor - * @param historySize the history size - * @param historyPeriod the history period - * @param historyUnit the history unit - */ - public CompoundOperationImpl(OperationStatistic source, Class type, long averagePeriod, TimeUnit averageUnit, - ScheduledExecutorService executor, int historySize, long historyPeriod, TimeUnit historyUnit) { - this.type = type; - this.source = source; - - this.averageNanos = averageUnit.toNanos(averagePeriod); - this.executor = executor; - this.historySize = historySize; - this.historyNanos = historyUnit.toNanos(historyPeriod); - - this.operations = new EnumMap(type); - for (T result : type.getEnumConstants()) { - operations.put(result, new OperationImpl(source, EnumSet.of(result), averageNanos, executor, historySize, historyNanos)); - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#type() - */ - @Override - public Class type() { - return type; - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#component(java.lang.Enum) - */ - @Override - public Result component(T result) { - return operations.get(result); - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#compound(java.util.Set) - */ - @Override - public Result compound(Set results) { - if (results.size() == 1) { - return component(results.iterator().next()); - } else { - Set key = EnumSet.copyOf(results); - OperationImpl existing = compounds.get(key); - if (existing == null) { - OperationImpl created = new OperationImpl(source, key, averageNanos, executor, historySize, historyNanos); - OperationImpl racer = compounds.putIfAbsent(key, created); - if (racer == null) { - return created; - } else { - return racer; - } - } else { - return existing; - } - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#ratioOf(java.util.Set, java.util.Set) - */ - @Override - public Statistic ratioOf(Set numerator, Set denominator) { - List> key = Arrays.> asList(EnumSet.copyOf(numerator), EnumSet.copyOf(denominator)); - ExpiringStatistic existing = ratios.get(key); - if (existing == null) { - final Statistic numeratorRate = compound(numerator).rate(); - final Statistic denominatorRate = compound(denominator).rate(); - ExpiringStatistic created = new ExpiringStatistic(new ValueStatistic() { - @Override - public Double value() { - return numeratorRate.value() / denominatorRate.value(); - } - }, executor, historySize, historyNanos); - ExpiringStatistic racer = ratios.putIfAbsent(key, created); - if (racer == null) { - return created; - } else { - return racer; - } - } else { - return existing; - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#setAlwaysOn(boolean) - */ - @Override - public void setAlwaysOn(boolean enable) { - alwaysOn = enable; - if (enable) { - for (OperationImpl op : operations.values()) { - op.start(); - } - for (OperationImpl op : compounds.values()) { - op.start(); - } - for (ExpiringStatistic ratio : ratios.values()) { - ratio.start(); - } - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#isAlwaysOn() - */ - @Override - public boolean isAlwaysOn() { - return alwaysOn; - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#setWindow(long, java.util.concurrent.TimeUnit) - */ - @Override - public void setWindow(long time, TimeUnit unit) { - averageNanos = unit.toNanos(time); - for (OperationImpl op : operations.values()) { - op.setWindow(averageNanos); - } - for (OperationImpl op : compounds.values()) { - op.setWindow(averageNanos); - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#setHistory(int, long, java.util.concurrent.TimeUnit) - */ - @Override - public void setHistory(int samples, long time, TimeUnit unit) { - historySize = samples; - historyNanos = unit.toNanos(time); - for (OperationImpl op : operations.values()) { - op.setHistory(historySize, historyNanos); - } - for (OperationImpl op : compounds.values()) { - op.setHistory(historySize, historyNanos); - } - for (ExpiringStatistic ratio : ratios.values()) { - ratio.setHistory(historySize, historyNanos); - } - } - - /* - * (non-Javadoc) - * - * @see net.sf.ehcache.statistics.extended.ExtendedStatistics.Operation#getWindowSize(java.util.concurrent.TimeUnit) - */ - @Override - public long getWindowSize(TimeUnit unit) { - return unit.convert(averageNanos, TimeUnit.NANOSECONDS); - } - - /** - * Get the history sample size. - */ - @Override - public int getHistorySampleSize() { - return historySize; - } - - /** - * Get the history sample time. - */ - @Override - public long getHistorySampleTime(TimeUnit unit) { - return unit.convert(historySize, TimeUnit.NANOSECONDS); - } - - /** - * Expire. - * - * @param expiryTime the expiry time - * @return true, if successful - */ - boolean expire(long expiryTime) { - if (alwaysOn) { - return false; - } else { - boolean expired = true; - for (OperationImpl o : operations.values()) { - expired &= o.expire(expiryTime); - } - for (Iterator> it = compounds.values().iterator(); it.hasNext();) { - if (it.next().expire(expiryTime)) { - it.remove(); - } - } - for (Iterator> it = ratios.values().iterator(); it.hasNext();) { - if (it.next().expire(expiryTime)) { - it.remove(); - } - } - return expired & compounds.isEmpty() & ratios.isEmpty(); - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/CounterImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/CounterImpl.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/CounterImpl.java (revision 0) @@ -1,97 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util.counter; - -import java.io.Serializable; -import java.util.concurrent.atomic.AtomicLong; - -/** - * A simple counter implementation - * - * @author Abhishek Sanoujam - * @since 1.7 - * - */ -public class CounterImpl implements Counter, Serializable { - private AtomicLong value; - - /** - * Default Constructor - */ - public CounterImpl() { - this(0L); - } - - /** - * Constructor with initial value - * - * @param initialValue - */ - public CounterImpl(long initialValue) { - this.value = new AtomicLong(initialValue); - } - - /** - * {@inheritDoc} - */ - public long increment() { - return value.incrementAndGet(); - } - - /** - * {@inheritDoc} - */ - public long decrement() { - return value.decrementAndGet(); - } - - /** - * {@inheritDoc} - */ - public long getAndSet(long newValue) { - return value.getAndSet(newValue); - } - - /** - * {@inheritDoc} - */ - public long getValue() { - return value.get(); - } - - /** - * {@inheritDoc} - */ - public long increment(long amount) { - return value.addAndGet(amount); - } - - /** - * {@inheritDoc} - */ - public long decrement(long amount) { - return value.addAndGet(amount * -1); - } - - /** - * {@inheritDoc} - */ - public void setValue(long newValue) { - value.set(newValue); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/MemorySizeParser.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/MemorySizeParser.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/MemorySizeParser.java (revision 0) @@ -1,114 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util; - -/** - * Memory size parser using the letter k or K to indicate kilobytes, the letter m or M to indicate megabytes, - * the letter g or G to indicate gigabytes and the letter t or T to indicate terabytes. - * - * @author Ludovic Orban - */ -public class MemorySizeParser { - private static final long BYTE = 1; - private static final long KILOBYTE = 1024; - private static final long MEGABYTE = 1024 * KILOBYTE; - private static final long GIGABYTE = 1024 * MEGABYTE; - private static final long TERABYTE = 1024 * GIGABYTE; - - /** - * Parse a String containing a human-readable memory size. - * - * @param configuredMemorySize the String containing a human-readable memory size. - * @return the memory size in bytes. - * @throws IllegalArgumentException thrown when the configured memory size cannot be parsed. - */ - public static long parse(String configuredMemorySize) throws IllegalArgumentException { - MemorySize size = parseIncludingUnit(configuredMemorySize); - return size.calculateMemorySizeInBytes(); - } - - private static MemorySize parseIncludingUnit(String configuredMemorySize) throws IllegalArgumentException { - if (configuredMemorySize == null || "".equals(configuredMemorySize)) { - return new MemorySize("0", BYTE); - } - - char unit = configuredMemorySize.charAt(configuredMemorySize.length() - 1); - MemorySize memorySize; - - switch (unit) { - case 'k': - case 'K': - memorySize = toMemorySize(configuredMemorySize, KILOBYTE); - break; - case 'm': - case 'M': - memorySize = toMemorySize(configuredMemorySize, MEGABYTE); - break; - case 'g': - case 'G': - memorySize = toMemorySize(configuredMemorySize, GIGABYTE); - break; - case 't': - case 'T': - memorySize = toMemorySize(configuredMemorySize, TERABYTE); - break; - default: - try { - Integer.parseInt("" + unit); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("invalid format for memory size [" + configuredMemorySize + "]"); - } - memorySize = new MemorySize(configuredMemorySize, BYTE); - } - - return memorySize; - } - - private static MemorySize toMemorySize(String configuredMemorySize, long unitMultiplier) { - if (configuredMemorySize.length() < 2) { - throw new IllegalArgumentException("invalid format for memory size [" + configuredMemorySize + "]"); - } - return new MemorySize(configuredMemorySize.substring(0, configuredMemorySize.length() - 1), unitMultiplier); - } - - /** - * Memory size calculator. - */ - private static final class MemorySize { - private String configuredMemorySizeWithoutUnit; - private long multiplicationFactor; - - private MemorySize(String configuredMemorySizeWithoutUnit, long multiplicationFactor) { - this.configuredMemorySizeWithoutUnit = configuredMemorySizeWithoutUnit; - this.multiplicationFactor = multiplicationFactor; - } - - public long calculateMemorySizeInBytes() throws IllegalArgumentException { - try { - long memorySizeLong = Long.parseLong(configuredMemorySizeWithoutUnit); - long result = memorySizeLong * multiplicationFactor; - if (result < 0) { - throw new IllegalArgumentException("memory size cannot be negative"); - } - return result; - } catch (NumberFormatException e) { - throw new IllegalArgumentException("invalid format for memory size"); - } - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/RMICacheReplicatorWithLargePayloadIT.java (revision 0) @@ -1,269 +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 static net.sf.ehcache.util.RetryAssert.assertBy; -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.hamcrest.core.IsNull.nullValue; -import static org.hamcrest.number.OrderingComparison.greaterThan; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; - -import net.sf.ehcache.AbstractCacheTest; -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.util.RetryAssert; - -import org.hamcrest.collection.IsEmptyCollection; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests replication of Cache events with large payloads exceeding MTU - *

- * Note these tests need a live network interface running in multicast mode to work - *

- * - * @author Abhishek Sanoujam - */ -public class RMICacheReplicatorWithLargePayloadIT extends AbstractRMITest { - - private static final Logger LOG = Logger.getLogger(RMICacheReplicatorWithLargePayloadIT.class.getName()); - - private static int MB = 1024 * 1024; - - /** - * {@inheritDoc} Sets up two caches: cache1 is local. cache2 is to be receive updates - * - * @throws Exception - */ - @Before - public void setUp() throws Exception { - failFastInsufficientMemory(); - assertThat(getActiveReplicationThreads(), IsEmptyCollection.empty()); - } - - private void failFastInsufficientMemory() { - // fail fast if running with insufficient heap - long totalMemory = Runtime.getRuntime().totalMemory(); - if (totalMemory < 200 * MB) { - String msg = "Insufficient heap (approx. " + (totalMemory / MB) + " MB detected), this test requires at least 256 MB to run.\n"; - msg += "Steps to take:\n"; - msg += " 1) If you are running with eclipse: specify \"-Xms256m -Xmx256m\" as VM arguments in the \"Run Confuguration\" for this test\n"; - msg += " 2) If you are running using mvn with \"mvn test -Dtest=" + this.getClass().getSimpleName() - + "\", add this in the command line: -DargLine=\"-Xms256m -Xmx256m\"\n"; - msg += " Run the test like: mvn test -Dtest=" + this.getClass().getSimpleName() + " -DargLine=\"-Xms256m -Xmx256m\""; - LOG.log(Level.WARNING, msg); - fail(msg); - } - } - - @After - public void noReplicationThreads() throws Exception { - RetryAssert.assertBy(30, TimeUnit.SECONDS, new Callable>() { - @Override - public Set call() throws Exception { - return getActiveReplicationThreads(); - } - }, IsEmptyCollection.empty()); - } - - private static List createCluster(int size, String ... caches){ - LOG.info("Creating Cluster"); - Collection required = Arrays.asList(caches); - List configurations = new ArrayList(size); - for (int i = 1; i <= size; i++) { - Configuration config = getConfiguration(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-" + i + ".xml").name("cm" + i); - if (!required.isEmpty()) { - for (Iterator> it = config.getCacheConfigurations().entrySet().iterator(); it.hasNext(); ) { - if (!required.contains(it.next().getKey())) { - it.remove(); - } - } - } - configurations.add(config); - } - LOG.info("Created Configurations"); - - List members = startupManagers(configurations); - try { - LOG.info("Created Managers"); - if (required.isEmpty()) { - waitForClusterMembership(10, TimeUnit.SECONDS, members); - LOG.info("Cluster Membership Complete"); - emptyCaches(10, TimeUnit.SECONDS, members); - LOG.info("Caches Emptied"); - } else { - waitForClusterMembership(10, TimeUnit.SECONDS, required, members); - emptyCaches(10, TimeUnit.SECONDS, required, members); - } - return members; - } catch (RuntimeException e) { - destroyCluster(members); - throw e; - } catch (Error e) { - destroyCluster(members); - throw e; - } - } - - private static void destroyCluster(List members) { - for (CacheManager manager : members) { - if (manager != null) { - manager.shutdown(); - } - } - } - - @Test - public void testAssertBigPayload() { - List cluster = createCluster(3); - try { - for (CacheManager manager : cluster) { - List localPeers = cluster.get(0).getCachePeerListener("RMI").getBoundCachePeers(); - List payloadList = PayloadUtil.createCompressedPayloadList(localPeers, 150); - assertThat(manager.getName(), payloadList, hasSize(greaterThan(1))); - } - - cluster.add(new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-4.xml")); - - List localPeers = cluster.get(3).getCachePeerListener("RMI").getBoundCachePeers(); - List payloadList = PayloadUtil.createCompressedPayloadList(localPeers, 150); - assertThat(payloadList, hasSize(greaterThan(1))); - } finally { - destroyCluster(cluster); - } - } - - /** - * Does a new cache manager in the cluster get detected? - */ - @Test - public void testRemoteCachePeersDetectsNewCacheManager() throws InterruptedException { - List cluster = createCluster(3); - try { - //Add new CacheManager to cluster - cluster.add(new CacheManager(AbstractCacheTest.TEST_CONFIG_DIR + "distribution/ehcache-distributed-big-payload-4.xml")); - - //Allow detection to occur - waitForClusterMembership(10020, TimeUnit.MILLISECONDS, cluster); - } finally { - destroyCluster(cluster); - } - } - - /** - * Does a down cache manager in the cluster get removed? - */ - @Test - public void testRemoteCachePeersDetectsDownCacheManager() throws InterruptedException { - List cluster = createCluster(3); - try { - MulticastKeepaliveHeartbeatSender.setHeartBeatStaleTime(3000); - //Drop a CacheManager from the cluster - cluster.remove(2).shutdown(); - assertThat(cluster, hasSize(2)); - - //Allow change detection to occur. Heartbeat 1 second and is not stale until 5000 - waitForClusterMembership(11020, TimeUnit.MILLISECONDS, cluster); - } finally { - destroyCluster(cluster); - } - } - - /** - * Does a down cache manager in the cluster get removed? - */ - @Test - public void testRemoteCachePeersDetectsDownCacheManagerSlow() throws InterruptedException { - List cluster = createCluster(3); - try { - CacheManager manager = cluster.get(0); - - Thread.sleep(2000); - - //Drop a CacheManager from the cluster - cluster.remove(2).shutdown(); - - //Insufficient time for it to timeout - CacheManagerPeerProvider provider = manager.getCacheManagerPeerProvider("RMI"); - for (String cacheName : manager.getCacheNames()) { - List remotePeersOfCache1 = provider.listRemoteCachePeers(manager.getCache(cacheName)); - assertThat((List) remotePeersOfCache1, hasSize(2)); - } - } finally { - destroyCluster(cluster); - } - } - - /** - * Tests put and remove initiated from cache1 in a cluster - *

- * This test goes into an infinite loop if the chain of notifications is not somehow broken. - */ - @Test - public void testPutProgagatesFromAndToEveryCacheManagerAndCache() throws CacheException, InterruptedException { - final List cluster = createCluster(3); - try { - final CacheManager manager0 = cluster.get(0); - //Put - final String[] cacheNames = manager0.getCacheNames(); - Arrays.sort(cacheNames); - for (int i = 0; i < cacheNames.length; i++) { - String name = cacheNames[i]; - manager0.getCache(name).put(new Element(Integer.toString(i), Integer.valueOf(i))); - //Add some non serializable elements that should not get propagated - manager0.getCache(name).put(new Element("nonSerializable" + i, new Object())); - } - - assertBy(10, TimeUnit.SECONDS, new Callable() { - - public Boolean call() throws Exception { - for (int i = 0; i < cacheNames.length; i++) { - String name = cacheNames[i]; - for (CacheManager manager : cluster.subList(1, cluster.size())) { - assertThat("Cache : " + name, manager.getCache(name).get(Integer.toString(i)), notNullValue()); - assertThat(manager.getCache(name).get("nonSerializable" + i), nullValue()); - } - } - return Boolean.TRUE; - } - }, is(Boolean.TRUE)); - } finally { - destroyCluster(cluster); - } - - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/AggregateCacheRegionStats.java (revision 0) @@ -1,62 +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; - -/** - * @author gkeim - * - */ -public class AggregateCacheRegionStats extends CacheRegionStats { - private int nodeCount; - - /** - * @param region - */ - public AggregateCacheRegionStats(String region) { - super(region); - } - - /** - * @param stats - */ - public void aggregate(CacheRegionStats stats) { - nodeCount++; - hitCount += stats.getHitCount(); - missCount += stats.getMissCount(); - putCount += stats.getPutCount(); - hitRatio = determineHitRatio(); - - // just add the in memory count together, an average will be returned when the getter is used - elementCountInMemory += stats.getElementCountInMemory(); - - // the largest element count on disk is the one that is the most correct - if (stats.getElementCountOnDisk() > elementCountOnDisk) { - elementCountOnDisk = stats.getElementCountOnDisk(); - } - // elementCountTotal is the same for each node, since it's the total count in the cluster - // no real aggregation is needed, just use the same total count - elementCountTotal = stats.getElementCountTotal(); - } - - /** - * @see net.sf.ehcache.hibernate.management.impl.CacheRegionStats#getElementCountInMemory() - */ - @Override - public long getElementCountInMemory() { - return elementCountInMemory / nodeCount; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/NullCacheEventListenerFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/NullCacheEventListenerFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/NullCacheEventListenerFactory.java (revision 0) @@ -1,40 +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.event; - -import java.util.Properties; - -/** - * A factory for NullCacheEventListener - * - * @author Greg Luck - * @version $Id: NullCacheEventListenerFactory.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class NullCacheEventListenerFactory extends CacheEventListenerFactory { - - /** - * Create a CacheEventListener - * - * @param properties implementation specific properties. These are configured as comma - * separated name value pairs in ehcache.xml - * @return a constructed CacheEventListener - */ - public CacheEventListener createCacheEventListener(Properties properties) { - return new NullCacheEventListener(); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/ElementIdAssigningStore.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/ElementIdAssigningStore.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/ElementIdAssigningStore.java (revision 0) @@ -1,477 +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.IOException; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Element; -import net.sf.ehcache.ElementIdHelper; -import net.sf.ehcache.Status; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; -import net.sf.ehcache.terracotta.TerracottaNotRunningException; -import net.sf.ehcache.util.LongSequence; -import net.sf.ehcache.writer.CacheWriterManager; -import org.terracotta.context.annotations.ContextChild; - -/** - * Store wrapper that assigns sequential IDs to elements as they are added to the underlying store - * - * @author teck - */ -public class ElementIdAssigningStore implements Store { - - @ContextChild - private final Store delegate; - private final LongSequence elementIdSequence; - - /** - * Constructor - * - * @param delegate underlying Store - * @param sequence id sequence - */ - public ElementIdAssigningStore(Store delegate, LongSequence sequence) { - this.delegate = delegate; - this.elementIdSequence = sequence; - } - - private void setId(Element element) { - long id = elementIdSequence.next(); - if (id <= 0) { - throw new CacheException("Element ID must be > 0"); - } - - ElementIdHelper.setId(element, id); - } - - /** - * {@inheritDoc} - */ - @Override - public void addStoreListener(StoreListener listener) { - delegate.addStoreListener(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeStoreListener(StoreListener listener) { - delegate.removeStoreListener(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean put(Element element) throws CacheException { - setId(element); - return delegate.put(element); - } - - /** - * {@inheritDoc} - */ - @Override - public void putAll(Collection elements) throws CacheException { - for (Element e : elements) { - setId(e); - } - delegate.putAll(elements); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException { - setId(element); - return delegate.putWithWriter(element, writerManager); - } - - /** - * {@inheritDoc} - */ - @Override - public Element get(Object key) { - return delegate.get(key); - } - - /** - * {@inheritDoc} - */ - @Override - public Element getQuiet(Object key) { - return delegate.getQuiet(key); - } - - /** - * {@inheritDoc} - */ - @Override - public List getKeys() { - return delegate.getKeys(); - } - - /** - * {@inheritDoc} - */ - @Override - public Element remove(Object key) { - return delegate.remove(key); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeAll(Collection keys) { - delegate.removeAll(keys); - } - - /** - * {@inheritDoc} - */ - @Override - public Element removeWithWriter(Object key, CacheWriterManager writerManager) throws CacheException { - return delegate.removeWithWriter(key, writerManager); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeAll() throws CacheException { - delegate.removeAll(); - } - - /** - * {@inheritDoc} - */ - @Override - public Element putIfAbsent(Element element) throws NullPointerException { - setId(element); - return delegate.putIfAbsent(element); - } - - /** - * {@inheritDoc} - */ - @Override - public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { - return delegate.removeElement(element, comparator); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, - IllegalArgumentException { - setId(element); - return delegate.replace(old, element, comparator); - } - - /** - * {@inheritDoc} - */ - @Override - public Element replace(Element element) throws NullPointerException { - setId(element); - return delegate.replace(element); - } - - /** - * {@inheritDoc} - */ - @Override - public void dispose() { - delegate.dispose(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getSize() { - return delegate.getSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getInMemorySize() { - return delegate.getInMemorySize(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getOffHeapSize() { - return delegate.getOffHeapSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getOnDiskSize() { - return delegate.getOnDiskSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getTerracottaClusteredSize() { - return delegate.getTerracottaClusteredSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getInMemorySizeInBytes() { - return delegate.getInMemorySizeInBytes(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getOffHeapSizeInBytes() { - return delegate.getOffHeapSizeInBytes(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getOnDiskSizeInBytes() { - return delegate.getOnDiskSizeInBytes(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasAbortedSizeOf() { - return delegate.hasAbortedSizeOf(); - } - - /** - * {@inheritDoc} - */ - @Override - public Status getStatus() { - return delegate.getStatus(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean containsKey(Object key) { - return delegate.containsKey(key); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean containsKeyOnDisk(Object key) { - return delegate.containsKeyOnDisk(key); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean containsKeyOffHeap(Object key) { - return delegate.containsKeyOffHeap(key); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean containsKeyInMemory(Object key) { - return delegate.containsKeyInMemory(key); - } - - /** - * {@inheritDoc} - */ - @Override - public void expireElements() { - delegate.expireElements(); - } - - /** - * {@inheritDoc} - */ - @Override - public void flush() throws IOException { - delegate.flush(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean bufferFull() { - return delegate.bufferFull(); - } - - /** - * {@inheritDoc} - */ - @Override - public Policy getInMemoryEvictionPolicy() { - return delegate.getInMemoryEvictionPolicy(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setInMemoryEvictionPolicy(Policy policy) { - delegate.setInMemoryEvictionPolicy(policy); - } - - /** - * {@inheritDoc} - */ - @Override - public Object getInternalContext() { - return delegate.getInternalContext(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isCacheCoherent() { - return delegate.isCacheCoherent(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isClusterCoherent() throws TerracottaNotRunningException { - return delegate.isClusterCoherent(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isNodeCoherent() throws TerracottaNotRunningException { - return delegate.isNodeCoherent(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setNodeCoherent(boolean coherent) throws UnsupportedOperationException, TerracottaNotRunningException { - delegate.setNodeCoherent(coherent); - } - - /** - * {@inheritDoc} - */ - @Override - public void waitUntilClusterCoherent() throws UnsupportedOperationException, TerracottaNotRunningException, InterruptedException { - delegate.waitUntilClusterCoherent(); - } - - /** - * {@inheritDoc} - */ - @Override - public Object getMBean() { - return delegate.getMBean(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setAttributeExtractors(Map extractors) { - delegate.setAttributeExtractors(extractors); - } - - /** - * {@inheritDoc} - */ - @Override - public Results executeQuery(StoreQuery query) throws SearchException { - return delegate.executeQuery(query); - } - - /** - * {@inheritDoc} - */ - @Override - public Attribute getSearchAttribute(String attributeName) { - return delegate.getSearchAttribute(attributeName); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getSearchAttributes() { - return delegate.getSearchAttributes(); - } - - /** - * {@inheritDoc} - */ - @Override - public Map getAllQuiet(Collection keys) { - return delegate.getAllQuiet(keys); - } - - /** - * {@inheritDoc} - */ - @Override - public Map getAll(Collection keys) { - return delegate.getAll(keys); - } - - /** - * {@inheritDoc} - */ - @Override - public void recalculateSize(Object key) { - delegate.recalculateSize(key); - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMCacheManagerRecreateTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMCacheManagerRecreateTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMCacheManagerRecreateTest.java (revision 0) @@ -1,55 +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.Element; - -import org.junit.Assert; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; - -import com.tc.test.config.model.TestConfig; - -public class L1BMCacheManagerRecreateTest extends AbstractCacheTestBase { - - public L1BMCacheManagerRecreateTest(TestConfig testConfig) { - super(testConfig, App.class); - } - - public static class App extends ClientBase { - private Cache cache; - - public App(String[] args) { - super(args); - } - - @Override - protected void runTest(Cache testcache, Toolkit clusteringToolkit) throws Throwable { - cache = testcache; - for (int i = 0; i < 100; i++) { - cache.put(new Element("key" + i, "value" + i)); - } - cleanup(); - - setup(); - for (int i = 0; i < 100; i++) { - Element e = cache.get("key" + i); - Assert.assertNotNull(e); - Assert.assertEquals("value" + i, e.getObjectValue()); - } - cleanup(); - } - - private void setup() { - setupCacheManager(); - cache = getCache(); - } - - private void cleanup() { - getCacheManager().shutdown(); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactoryWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactoryWrapper.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/ClusteredInstanceFactoryWrapper.java (revision 0) @@ -1,165 +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.Ehcache; -import net.sf.ehcache.cluster.CacheCluster; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.event.CacheEventListener; -import net.sf.ehcache.management.event.ManagementEventSink; -import net.sf.ehcache.store.Store; -import net.sf.ehcache.store.TerracottaStore; -import net.sf.ehcache.transaction.SoftLockManager; -import net.sf.ehcache.transaction.TransactionIDFactory; -import net.sf.ehcache.writer.writebehind.WriteBehind; - -import java.util.concurrent.Callable; - -/** - * A {@link ClusteredInstanceFactory} implementation that delegates all operations to an underlying delegate except for the following - * operations: - *

    - *
  • {@link #getTopology()} : Delegates to the {@link TerracottaClient#getCacheCluster()}
  • - *
- * - * @author Abhishek Sanoujam - * - */ -public class ClusteredInstanceFactoryWrapper implements ClusteredInstanceFactory { - - private final TerracottaClient client; - private final ClusteredInstanceFactory delegate; - - /** - * Constructor accepting the TerracottaClient and the actual factory - * - * @param client - * @param delegate - */ - public ClusteredInstanceFactoryWrapper(TerracottaClient client, ClusteredInstanceFactory delegate) { - this.client = client; - this.delegate = delegate; - - } - - /** - * Returns the actual underlying factory - * - * @return the actual underlying factory - */ - protected ClusteredInstanceFactory getActualFactory() { - return delegate; - } - - /** - * {@inheritDoc} - */ - public CacheCluster getTopology() { - return client.getCacheCluster(); - } - - // all methods below delegate to the real factory - - /** - * {@inheritDoc} - */ - public String getUUID() { - return delegate.getUUID(); - } - - /** - * {@inheritDoc} - */ - @Override - public void enableNonStopForCurrentThread(boolean enable) { - delegate.enableNonStopForCurrentThread(enable); - } - - /** - * {@inheritDoc} - */ - public CacheEventListener createEventReplicator(Ehcache cache) { - return delegate.createEventReplicator(cache); - } - - /** - * {@inheritDoc} - */ - public Store createStore(Ehcache cache) { - return delegate.createStore(cache); - } - - /** - * {@inheritDoc} - */ - public TransactionIDFactory createTransactionIDFactory(String uuid, String cacheManagerName) { - return delegate.createTransactionIDFactory(uuid, cacheManagerName); - } - - /** - * {@inheritDoc} - */ - public WriteBehind createWriteBehind(Ehcache cache) { - return delegate.createWriteBehind(cache); - } - - /** - * {@inheritDoc} - */ - public SoftLockManager getOrCreateSoftLockManager(Ehcache cache) { - return delegate.getOrCreateSoftLockManager(cache); - } - - /** - * {@inheritDoc} - */ - public void shutdown() { - delegate.shutdown(); - } - - @Override - public TerracottaStore createNonStopStore(Callable store, Ehcache cache) { - return delegate.createNonStopStore(store, cache); - } - - @Override - public boolean destroyCache(final String cacheManagerName, final String cacheName) { - return delegate.destroyCache(cacheManagerName, cacheName); - } - - @Override - public void linkClusteredCacheManager(String cacheManagerName, Configuration configuration) { - delegate.linkClusteredCacheManager(cacheManagerName, configuration); - } - - @Override - public void unlinkCache(String cacheName) { - delegate.unlinkCache(cacheName); - } - - @Override - public ManagementEventSink createEventSink() { - return delegate.createEventSink(); - } - - /** - * {@inheritDoc} - */ - public void waitForOrchestrator(String cacheManagerName) { - delegate.waitForOrchestrator(cacheManagerName); - } -} Index: rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheManagerEntityBuilder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheManagerEntityBuilder.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheManagerEntityBuilder.java (revision 0) @@ -1,85 +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.CacheManagerEntity; -import net.sf.ehcache.management.sampled.CacheManagerSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -/** - * @author brandony - */ -final class CacheManagerEntityBuilder extends ConstrainableEntityBuilderSupport { - private static final Logger LOG = LoggerFactory.getLogger(CacheManagerEntityBuilder.class); - - private static final String CM_NAME_ACCESSOR = AccessorPrefix.get + "Name"; - - private final List cmSamplers = new ArrayList(); - - static CacheManagerEntityBuilder createWith(CacheManagerSampler sampler) { - return new CacheManagerEntityBuilder(sampler); - } - - CacheManagerEntityBuilder(CacheManagerSampler sampler) { - addSampler(sampler); - } - - CacheManagerEntityBuilder add(CacheManagerSampler sampler) { - addSampler(sampler); - return this; - } - - CacheManagerEntityBuilder add(Set constraintAttributes) { - addConstraints(constraintAttributes); - return this; - } - - Collection build() { - Collection cmes = new ArrayList(cmSamplers.size()); - - for (CacheManagerSampler cms : cmSamplers) { - CacheManagerEntity cme = new CacheManagerEntity(); - cme.setName(cms.getName()); - cme.setAgentId(AgentEntity.EMBEDDED_AGENT_ID); - cme.setVersion(this.getClass().getPackage().getImplementationVersion()); - - if (getAttributeConstraints() != null && !getAttributeConstraints().isEmpty() && getAttributeConstraints() - .size() < CacheManagerSampler.class.getMethods().length) { - buildAttributeMapByAttribute(CacheManagerSampler.class, cms, cme.getAttributes(), getAttributeConstraints(), - CM_NAME_ACCESSOR); - } else { - buildAttributeMapByApi(CacheManagerSampler.class, cms, cme.getAttributes(), getAttributeConstraints(), - CM_NAME_ACCESSOR); - } - - cmes.add(cme); - } - - return cmes; - } - - Logger getLog() { - return LOG; - } - - @Override - protected Set getExcludedAttributeNames(CacheManagerSampler cacheManagerSampler) { - return Collections.emptySet(); - } - - private void addSampler(CacheManagerSampler sampler) { - if (sampler == null) throw new IllegalArgumentException("sampler == null"); - cmSamplers.add(sampler); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/provider/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/provider/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/provider/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to MBeanRegistrationProvider and its implementation. -

- - Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/TerracottaStoreInitializationService.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/TerracottaStoreInitializationService.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/TerracottaStoreInitializationService.java (revision 0) @@ -1,101 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.store; - -import net.sf.ehcache.config.NonstopConfiguration; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.toolkit.cluster.ClusterInfo; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.atomic.AtomicInteger; - -public class TerracottaStoreInitializationService { - private static final Logger LOGGER = LoggerFactory.getLogger(TerracottaStoreInitializationService.class); - private final ExecutorService threadPool; - private final ClusterInfo clusterInfo; - - - public TerracottaStoreInitializationService(ClusterInfo clusterInfo) { - this.clusterInfo = clusterInfo; - this.threadPool = getThreadPool(); - } - - /** - * This method should be called when the associated CacheManager is shutdown. Once shutdowm, the initialization - * service cannot be started again. - */ - public void shutdown() { - threadPool.shutdownNow(); - } - - public void initialize(Runnable runnable, NonstopConfiguration nonStopConfiguration) { - - // Submit the Thread for execution - Future future = threadPool.submit(runnable); - - // wait for initialization to complete (until operations are enabled) - waitForInitialization(future, nonStopConfiguration.getTimeoutMillis()); - } - - /** - * This method holds the calling thread until the given Future returns the result or the Cluster operations get/are - * disabled. In case the Cluster operations get disabled while waiting, the method call returns honoring the nonstop - * timeout. - * - */ - private void waitForInitialization(Future future, long nonStopTimeOutInMillis) { - boolean interrupted = false; - boolean initializationCompleted = false; - try { - do { - try { - future.get(nonStopTimeOutInMillis, TimeUnit.MILLISECONDS); - initializationCompleted = true; - } catch (InterruptedException e) { - interrupted = true; - } catch (ExecutionException e) { - throw new RuntimeException(e.getCause()); - } catch (TimeoutException e) { - // Retry if operations are enabled - } - } while (!initializationCompleted && areOperationsEnabled()); - - } finally { - if (interrupted) Thread.currentThread().interrupt(); - } - - if (!initializationCompleted) { - LOGGER.debug("Returning without completing TerracottaStore initialization. Operations Enabled = {}", - areOperationsEnabled()); - } - } - - private boolean areOperationsEnabled() { - return clusterInfo.areOperationsEnabled(); - } - - private ExecutorService getThreadPool() { - ThreadFactory daemonThreadFactory = new ThreadFactory() { - private final AtomicInteger threadID = new AtomicInteger(); - - @Override - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable, "TerracottaStoreInitializationThread_" + threadID.incrementAndGet()); - thread.setDaemon(true); - return thread; - } - }; - - return Executors.newCachedThreadPool(daemonThreadFactory); - } - -} Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/ElementEntity.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/ElementEntity.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/ElementEntity.java (revision 0) @@ -1,35 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ - -package net.sf.ehcache.management.resource; - -import org.terracotta.management.resource.VersionedEntity; - -/** - * @author brandony - */ -public class ElementEntity extends VersionedEntity { - private String agentId; - - private String cacheName; - - @Override - public String getAgentId() { - return agentId; - } - - @Override - public void setAgentId(String agentId) { - this.agentId = agentId; - } - - public String getCacheName() { - return cacheName; - } - - public void setCacheName(String cacheName) { - this.cacheName = cacheName; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/query/QueryManagerBuilder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/query/QueryManagerBuilder.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/query/QueryManagerBuilder.java (revision 0) @@ -1,121 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.query; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Collection; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Collection; - -/** - * A {@link net.sf.ehcache.search.query.QueryManager Query Manager} builder providing methods to add caches which - * can be queried. - * The Query Manager instance returned by this builder can be used to execute - * search queries expressed as Big Memory Structured Query Language (BMSQL) statements. - * - * @author dkumar - */ -public final class QueryManagerBuilder { - - private final Collection caches = new ArrayList(); - private final Class defaultClass; - - - private QueryManagerBuilder() { - this(getImplementationClass()); - } - - /** - * Package-local constructor for testing purposes. - * - * @param implementationClass a concrete implementation of the {@link net.sf.ehcache.search.query.QueryManager Query Manager} interface - */ - QueryManagerBuilder(Class implementationClass) { - this.defaultClass = implementationClass; - } - - private static Class getImplementationClass() { - try { - return (Class)Class.forName("net.sf.ehcache.search.parser.QueryManagerImpl"); - } catch (ClassNotFoundException e) { - throw new CacheException(e); - } - } - - /** - * Creates a new {@link net.sf.ehcache.search.query.QueryManager Query Manager} builder. - * - * @return this for the builder pattern - */ - public static QueryManagerBuilder newQueryManagerBuilder() { - return new QueryManagerBuilder(); - } - - /** - * Adds a {@link net.sf.ehcache.Ehcache Cache} to the internal state and allows it to be used as a target in a - * BMSQL statement's FROM clause. - * - * @param cache a {@link net.sf.ehcache.Ehcache cache} instance to be added - * @return this for the builder pattern - */ - public QueryManagerBuilder addCache(Ehcache cache) { - this.caches.add(cache); - return this; - } - - /** - * Adds all {@link net.sf.ehcache.Ehcache Caches} present in a {@link net.sf.ehcache.CacheManager Cache Manager} to - * the internal state of the query manager. - * The added caches can be used in a BMSQL statement's FROM clause. - * - * @param cacheManager a {@link net.sf.ehcache.CacheManager Cache Manager} whose - * {@link net.sf.ehcache.Ehcache caches} need to be added - * @return this for the builder pattern - */ - public QueryManagerBuilder addAllCachesCurrentlyIn(CacheManager cacheManager) { - for (String s : cacheManager.getCacheNames()) { - final Ehcache cache = cacheManager.getEhcache(s); - if (cache != null) { - this.caches.add(cache); - } - } - return this; - } - - /** - * Returns a new {@link net.sf.ehcache.search.query.QueryManager Query Manager} using the options supplied during the building - * process. - * - * @return the fully constructed {@link net.sf.ehcache.search.query.QueryManager Query Manager} - */ - public QueryManager build() { - try { - final Constructor constructor = defaultClass.getConstructor(Collection.class); - return constructor.newInstance(this.caches); - } catch (Exception e) { - throw new CacheException(e); - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-disk.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-disk.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-disk.xml (revision 0) @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9081/conf.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9081/conf.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9081/conf.xml (revision 0) @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /webapps - false - true - false - - - - - - - - ./logs/console.yyyy_mm_dd.log - false - 90 - GMT - - - - - - Redirecting stderr/stdout to - - - - Index: rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9082/conf.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9082/conf.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/jetty6.1/9082/conf.xml (revision 0) @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /webapps - false - true - false - - - - - - - - ./logs/console.yyyy_mm_dd.log - false - 90 - GMT - - - - - - Redirecting stderr/stdout to - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/nonstop/MockCacheWriterFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/nonstop/MockCacheWriterFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/nonstop/MockCacheWriterFactory.java (revision 0) @@ -1,76 +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.nonstop; - -import java.util.Collection; -import java.util.Properties; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.writer.CacheWriter; -import net.sf.ehcache.writer.CacheWriterFactory; -import net.sf.ehcache.writer.writebehind.operations.SingleOperationType; - -public class MockCacheWriterFactory extends CacheWriterFactory { - - @Override - public CacheWriter createCacheWriter(Ehcache cache, Properties properties) { - return new CacheWriter() { - - public void writeAll(Collection elements) throws CacheException { - // no-op - } - - public void write(Element element) throws CacheException { - // no-op - - } - - public void init() { - // no-op - - } - - public void dispose() throws CacheException { - // no-op - - } - - public void deleteAll(Collection entries) throws CacheException { - // no-op - - } - - public void throwAway(final Element element, final SingleOperationType operationType, final RuntimeException e) { - // no-op - } - - public void delete(CacheEntry entry) throws CacheException { - // no-op - - } - - public CacheWriter clone(Ehcache cache) throws CloneNotSupportedException { - // no-op - return null; - } - }; - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/store/StorageStrategyNotSupportedTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/store/StorageStrategyNotSupportedTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/store/StorageStrategyNotSupportedTest.java (revision 0) @@ -1,69 +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.CacheException; -import net.sf.ehcache.CacheManager; -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 com.tc.test.config.model.TestConfig; - -import junit.framework.Assert; - -public class StorageStrategyNotSupportedTest extends AbstractCacheTestBase { - - public StorageStrategyNotSupportedTest(TestConfig testConfig) { - super("ehcache-not-supported.xml", testConfig, App.class); - } - - public static class App extends ClientBase { - - public App(String[] args) { - super(args); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - - CacheManager cm = getCacheManager(); - - try { - Assert.assertEquals(1, cm.getCacheNames().length); - Assert.assertTrue(cm.getCacheNames()[0].equals("test")); - } catch (CacheException e) { - fail("Using storageStrategy=dcv2 should work even without ee"); - } - - // test programmatic way - cm.shutdown(); - setupCacheManager(); - cm = getCacheManager(); - CacheConfiguration cacheConfiguration = new CacheConfiguration("testCache", 100); - TerracottaConfiguration tc = new TerracottaConfiguration().clustered(true); - cacheConfiguration.addTerracotta(tc); - cache = new Cache(cacheConfiguration); - - cm.removeCache("test"); - - try { - cm.addCache(cache); - Assert.assertEquals(1, cm.getCacheNames().length); - Assert.assertTrue(cm.getCacheNames()[0].equals("testCache")); - } catch (CacheException e) { - e.printStackTrace(); - fail("Using storageStrategy=dcv2 should work even without ee"); - } - } - } -} Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/service/CacheManagerServiceV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/service/CacheManagerServiceV2.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/service/CacheManagerServiceV2.java (revision 0) @@ -1,37 +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; - -import net.sf.ehcache.management.resource.CacheManagerEntityV2; - -import org.terracotta.management.ServiceExecutionException; -import org.terracotta.management.resource.ResponseEntityV2; - -/** - * An interface for service implementations providing operations on CacheManager objects. - * - * @author brandony - */ -public interface CacheManagerServiceV2 { - - /** - * Update a cache manager represented by the submitted entity. - * - * @param cacheManagerName the name of the CacheManager to be updated - * @param resource the representation of the resource informing this update - * @throws ServiceExecutionException if the update fails - */ - void updateCacheManager(String cacheManagerName, - CacheManagerEntityV2 resource) throws ServiceExecutionException; - /** - * Execute query against cache manager and returns results array - * - * @param queryString - * @return {@code ResponseEntityV2} containing {@code QueryResultsEntityV2} entities - * @throws ServiceExecutionException - */ - ResponseEntityV2 executeQuery(String cacheManagerName, String queryString) throws ServiceExecutionException; -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsSerializationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsSerializationTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsSerializationTest.java (revision 0) @@ -1,142 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.event; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListener; - -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.Set; - -import junit.framework.Assert; - -public class ClusteredEventsSerializationTest extends AbstractCacheTestBase { - - private static final int NODE_COUNT = 5; - - public ClusteredEventsSerializationTest(TestConfig testConfig) { - super("clustered-events-test.xml", testConfig, App.class, App.class, App.class, App.class, App.class); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.clusteredStore.checkContainsKeyOnPut=true"); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super("testSerialization", args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - final int index = barrier.await(); - - Assert.assertEquals(0, cache.getSize()); - - barrier.await(); - - NonPortable key = new NonPortable("key" + index); - NonPortable valuePut = new NonPortable("value" + index); - NonPortable valueUpdate = new NonPortable("valueUpdated" + index); - cache.put(new Element(key, valuePut)); - cache.put(new Element(key, valueUpdate)); - cache.remove(key); - - barrier.await(); - - cache.removeAll(); - - barrier.await(); - - Thread.sleep(10000); - - EhcacheTerracottaEventListener listener = null; - Set listeners = cache.getCacheEventNotificationService().getCacheEventListeners(); - for (CacheEventListener l : listeners) { - if (l instanceof EhcacheTerracottaEventListener) { - listener = (EhcacheTerracottaEventListener) l; - break; - } - } - - Assert.assertNotNull(listener); - - Assert.assertEquals(NODE_COUNT, listener.getPut().size()); - Assert.assertEquals(NODE_COUNT, listener.getUpdate().size()); - Assert.assertEquals(NODE_COUNT, listener.getRemove().size()); - Assert.assertEquals(NODE_COUNT, listener.getRemoveAll()); - - boolean foundPutKey = false; - for (Element element : listener.getPut()) { - if (element.getObjectKey().equals(key)) { - foundPutKey = true; - Assert.assertEquals(valuePut, element.getObjectValue()); - } else { - Assert.assertEquals("value" + element.getObjectKey().toString().substring("key".length()), element - .getObjectValue().toString()); - } - } - Assert.assertTrue(foundPutKey); - - boolean foundUpdateKey = false; - for (Element element : listener.getUpdate()) { - if (element.getObjectKey().equals(key)) { - foundUpdateKey = true; - Assert.assertEquals(valueUpdate, element.getObjectValue()); - } else { - Assert.assertEquals("valueUpdated" + element.getObjectKey().toString().substring("key".length()), element - .getObjectValue().toString()); - } - } - Assert.assertTrue(foundUpdateKey); - - boolean foundRemoveKey = false; - for (Element element : listener.getRemove()) { - if (element.getObjectKey().equals(key)) { - foundRemoveKey = true; - } - } - Assert.assertTrue(foundRemoveKey); - } - - } - - public static class NonPortable implements Serializable { - private final String value; - - public NonPortable(String value) { - this.value = value; - } - - @Override - public String toString() { - return value; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - NonPortable that = (NonPortable) o; - - if (value != null ? !value.equals(that.value) : that.value != null) return false; - - return true; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCache.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCache.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.constructs.readthrough; - -import java.io.Serializable; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.constructs.EhcacheDecoratorAdapter; - -/** - * This class implements the simplest of all possible read through cache - * behaviors, where a call the get() will delegate to a call to getWithLoader(). - * This means that a get() call can take a long time; beware. It also does no more - * locking than {@link Cache} implements; each separate cache may try to load - * a key at the same time. - * - * @author cschanck - * - */ -public class ReadThroughCache extends EhcacheDecoratorAdapter { - - private final ReadThroughCacheConfiguration readThroughCacheConfig; - private final boolean isModeGet; - - /** - * - * @param underlyingCache - * @param config - */ - public ReadThroughCache(Ehcache underlyingCache, ReadThroughCacheConfiguration config) { - super(underlyingCache); - this.readThroughCacheConfig = config; - this.isModeGet = readThroughCacheConfig.isModeGet(); - } - - @Override - public Element get(Object key) throws IllegalStateException, CacheException { - if (isModeGet) { - return super.getWithLoader(key, null, null); - } - return super.get(key); - } - - @Override - public Element get(Serializable key) throws IllegalStateException, CacheException { - if (isModeGet) { - return super.getWithLoader(key, null, null); - } - return super.get(key); - } - - @Override - public String getName() { - if (readThroughCacheConfig.getName() != null) { - return readThroughCacheConfig.getName(); - } - return super.getName(); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareCollectionRegionAccessStrategy.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareCollectionRegionAccessStrategy.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/nonstop/NonstopAwareCollectionRegionAccessStrategy.java (revision 0) @@ -1,209 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.hibernate.nonstop; - -import net.sf.ehcache.constructs.nonstop.NonStopCacheException; - -import org.hibernate.cache.CacheException; -import org.hibernate.cache.CollectionRegion; -import org.hibernate.cache.access.CollectionRegionAccessStrategy; -import org.hibernate.cache.access.SoftLock; - -/** - * Implementation of {@link CollectionRegionAccessStrategy} that handles {@link NonStopCacheException} using - * {@link HibernateNonstopCacheExceptionHandler} - * - * @author Abhishek Sanoujam - * - */ -public class NonstopAwareCollectionRegionAccessStrategy implements CollectionRegionAccessStrategy { - - private final CollectionRegionAccessStrategy actualStrategy; - private final HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler; - - /** - * Constructor accepting the actual {@link CollectionRegionAccessStrategy} and the {@link HibernateNonstopCacheExceptionHandler} - * - * @param actualStrategy - * @param hibernateNonstopExceptionHandler - */ - public NonstopAwareCollectionRegionAccessStrategy(CollectionRegionAccessStrategy actualStrategy, - HibernateNonstopCacheExceptionHandler hibernateNonstopExceptionHandler) { - this.actualStrategy = actualStrategy; - this.hibernateNonstopExceptionHandler = hibernateNonstopExceptionHandler; - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#getRegion() - */ - public CollectionRegion getRegion() { - return actualStrategy.getRegion(); - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#evict(java.lang.Object) - */ - public void evict(Object key) throws CacheException { - try { - actualStrategy.evict(key); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#evictAll() - */ - public void evictAll() throws CacheException { - try { - actualStrategy.evictAll(); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#get(java.lang.Object, long) - */ - public Object get(Object key, long txTimestamp) throws CacheException { - try { - return actualStrategy.get(key, txTimestamp); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - return null; - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#lockItem(java.lang.Object, java.lang.Object) - */ - public SoftLock lockItem(Object key, Object version) throws CacheException { - try { - return actualStrategy.lockItem(key, version); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - return null; - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#lockRegion() - */ - public SoftLock lockRegion() throws CacheException { - try { - return actualStrategy.lockRegion(); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - return null; - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object, - * boolean) - */ - public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) - throws CacheException { - try { - return actualStrategy.putFromLoad(key, value, txTimestamp, version, minimalPutOverride); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - return false; - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#putFromLoad(java.lang.Object, java.lang.Object, long, java.lang.Object) - */ - public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version) throws CacheException { - try { - return actualStrategy.putFromLoad(key, value, txTimestamp, version); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - return false; - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#remove(java.lang.Object) - */ - public void remove(Object key) throws CacheException { - try { - actualStrategy.remove(key); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#removeAll() - */ - public void removeAll() throws CacheException { - try { - actualStrategy.removeAll(); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#unlockItem(java.lang.Object, org.hibernate.cache.access.SoftLock) - */ - public void unlockItem(Object key, SoftLock lock) throws CacheException { - try { - actualStrategy.unlockItem(key, lock); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - - /** - * {@inheritDoc} - * - * @see org.hibernate.cache.access.EntityRegionAccessStrategy#unlockRegion(org.hibernate.cache.access.SoftLock) - */ - public void unlockRegion(SoftLock lock) throws CacheException { - try { - actualStrategy.unlockRegion(lock); - } catch (NonStopCacheException nonStopCacheException) { - hibernateNonstopExceptionHandler.handleNonstopCacheException(nonStopCacheException); - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xsd =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xsd (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xsd (revision 0) @@ -1,422 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/bin/stop-sample.sh =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/bin/stop-sample.sh (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/colorcache/src/assemble/bin/stop-sample.sh (revision 0) @@ -1,18 +0,0 @@ -#!/bin/bash - -cygwin=false -if [ `uname | grep CYGWIN` ]; then - cygwin=true -fi - -if [ "$JAVA_HOME" = "" ]; then - echo "JAVA_HOME is not defined" - exit 1 -fi - -unset CDPATH -root=`dirname $0`/.. -root=`cd $root && pwd` - -$root/bin/stop-jetty.sh 9081 -$root/bin/stop-jetty.sh 9082 Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/KeyObjectAttributeExtractor.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/KeyObjectAttributeExtractor.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/attribute/KeyObjectAttributeExtractor.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.search.attribute; - -import net.sf.ehcache.Element; - -/** - * Attempt to use the element key object itself as a search attribute. If the key is not a legal type it is omitted - * - * @author teck - */ -public class KeyObjectAttributeExtractor implements AttributeExtractor { - - /** - * {@inheritDoc} - */ - public Object attributeFor(Element element, String attributeName) throws AttributeExtractorException { - Object key = element.getObjectKey(); - - if (AttributeType.isSupportedType(key)) { - return key; - } - - // not a supported type return null to not define anything in the index - return null; - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/strong-cache-invalidation-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/strong-cache-invalidation-test.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/strong-cache-invalidation-test.xml (revision 0) @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/WriteAllAsyncOperation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/WriteAllAsyncOperation.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/WriteAllAsyncOperation.java (revision 0) @@ -1,28 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind.operations; - - -import net.sf.ehcache.Element; -import net.sf.ehcache.writer.CacheWriter; - -import java.util.Collection; - -/** - * Implements the write all operation for write behind - * - * @author Abhishek Maheshwari - */ - -public class WriteAllAsyncOperation implements BatchAsyncOperation { - private final Collection elements; - - public WriteAllAsyncOperation(Collection elements) { - this.elements = elements; - } - - public void performBatchOperation(CacheWriter cacheWriter) { - cacheWriter.writeAll(elements); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/MemoryLimitedCacheLoaderTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/MemoryLimitedCacheLoaderTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/MemoryLimitedCacheLoaderTest.java (revision 0) @@ -1,113 +0,0 @@ -package net.sf.ehcache.store; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.statistics.StatisticsGateway; - -import org.junit.Before; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * MemoryLimitedCacheLoaderTest - */ -public class MemoryLimitedCacheLoaderTest { - - private Ehcache cache; - private CacheConfiguration configuration; - private TestCacheLoader loader; - private StatisticsGateway statisticsGateway; - - @Before - public void setUp() { - cache = mock(Ehcache.class); - configuration = new CacheConfiguration(); - when(cache.getCacheConfiguration()).thenReturn(configuration); - statisticsGateway = mock(StatisticsGateway.class); - when(cache.getStatistics()).thenReturn(statisticsGateway); - loader = new TestCacheLoader(); - - } - - @Test - public void testCountBasedLimitSetToNoLimit() { - configuration.setOverflowToOffHeap(false); - configuration.setMaxEntriesLocalHeap(0); - - assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); - } - - @Test - public void testCountBasedLimitSetToSomeLimit() { - configuration.setOverflowToOffHeap(false); - int maxEntriesLocalHeap = 10; - configuration.setMaxEntriesLocalHeap(maxEntriesLocalHeap); - - assertThat(loader.isInMemoryLimitReached(cache, maxEntriesLocalHeap - 2), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, maxEntriesLocalHeap), is(true)); - assertThat(loader.isInMemoryLimitReached(cache, maxEntriesLocalHeap + 2), is(true)); - } - - @Test - public void testLocalHeapSizeBased() { - configuration.setOverflowToOffHeap(false); - configuration.setMaxBytesLocalHeap(1024L); - - when(statisticsGateway.getLocalHeapSize()).thenReturn(0L, 1L, 4L); - when(statisticsGateway.getLocalHeapSizeInBytes()).thenReturn(250L, 1000L); - - assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, 1), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, 4), is(true)); - } - - @Test - public void testOffHeapSizeBased() { - configuration.setOverflowToOffHeap(true); - configuration.setMaxBytesLocalHeap(1024L); - configuration.setMaxBytesLocalOffHeap(2048L); - - when(statisticsGateway.getLocalOffHeapSize()).thenReturn(0L, 1L, 4L); - when(statisticsGateway.getLocalOffHeapSizeInBytes()).thenReturn(500L, 2000L); - - assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, 1), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, 4), is(true)); - } - - @Test - public void testPooledOffHeapSizeBased() { - // Sizing info is in CacheManager, never consulted by MemoryLimitedCacheLoader - configuration.setOverflowToOffHeap(true); - - assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); - } - - @Test - public void testPooledHeapSizeBased() { - // Sizing info is in CacheManager, never consulted by MemoryLimitedCacheLoader - - assertThat(loader.isInMemoryLimitReached(cache, 0), is(false)); - assertThat(loader.isInMemoryLimitReached(cache, Integer.MAX_VALUE), is(true)); - } - - private static class TestCacheLoader extends MemoryLimitedCacheLoader { - - @Override - public void load(Ehcache cache) throws CacheException { - // no-op - } - - @Override - public boolean isAsynchronous() { - return true; // not used - } - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/.settings/org.eclipse.m2e.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/.settings/org.eclipse.m2e.core.prefs (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/.settings/org.eclipse.m2e.core.prefs (revision 0) @@ -1,5 +0,0 @@ -#Fri Jul 29 14:23:07 PDT 2011 -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/nonstop/RejoinWithoutNonStopStore.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/nonstop/RejoinWithoutNonStopStore.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/nonstop/RejoinWithoutNonStopStore.java (revision 0) @@ -1,614 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.terracotta.modules.ehcache.store.nonstop; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import net.sf.ehcache.Element; -import net.sf.ehcache.Status; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.constructs.nonstop.RejoinCacheException; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.attribute.AttributeExtractor; -import net.sf.ehcache.store.ElementValueComparator; -import net.sf.ehcache.store.Policy; -import net.sf.ehcache.store.StoreListener; -import net.sf.ehcache.store.StoreQuery; -import net.sf.ehcache.store.TerracottaStore; -import net.sf.ehcache.writer.CacheWriterManager; -import net.sf.ehcache.writer.writebehind.WriteBehind; - -/** - * - * @author cdennis - */ -public final class RejoinWithoutNonStopStore implements TerracottaStore { - - /** - * the singleton instance - */ - private static final RejoinWithoutNonStopStore INSTANCE = new RejoinWithoutNonStopStore(); - - /** - * private constructor - */ - private RejoinWithoutNonStopStore() { - // - } - - /** - * returns the singleton instance - */ - public static RejoinWithoutNonStopStore getInstance() { - return INSTANCE; - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element get(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during get(Object key)"); - } - - /** - * {@inheritDoc} - */ - @Override - public Element getQuiet(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getQuiet(Object key)"); - } - - /** - * {@inheritDoc} - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Map getAllQuiet(Collection keys) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getAllQuiet(Collection keys)"); - } - - /** - * {@inheritDoc} - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Map getAll(Collection keys) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getAll(Collection keys)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public List getKeys() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getKeys()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean put(Element element) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during put(Element element)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void putAll(Collection elements) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during putAll(Collection elements)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element remove(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during remove(Object key)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void removeAll(Collection keys) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during removeAll(Collection keys)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void removeAll() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during removeAll()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void flush() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during flush()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Object getInternalContext() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getInternalContext()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public int getSize() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getSize()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element putIfAbsent(Element element) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during putIfAbsent(Element element)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element replace(Element element) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during replace(Element element)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void addStoreListener(StoreListener listener) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during addStoreListener(StoreListener listener)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean bufferFull() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during bufferFull()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean containsKey(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during containsKey(Object key)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean containsKeyInMemory(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during containsKeyInMemory(Object key)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean containsKeyOffHeap(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during containsKeyOffHeap(Object key)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean containsKeyOnDisk(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during containsKeyOnDisk(Object key)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void dispose() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during dispose()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Results executeQuery(StoreQuery query) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during executeQuery(StoreQuery query)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void expireElements() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during expireElements()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Policy getInMemoryEvictionPolicy() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getInMemoryEvictionPolicy()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public int getInMemorySize() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getInMemorySize()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public long getInMemorySizeInBytes() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getInMemorySizeInBytes()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Object getMBean() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getMBean()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public int getOffHeapSize() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getOffHeapSize()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public long getOffHeapSizeInBytes() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getOffHeapSizeInBytes()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public int getOnDiskSize() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getOnDiskSize()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public long getOnDiskSizeInBytes() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getOnDiskSizeInBytes()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean hasAbortedSizeOf() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during hasAbortedSizeOf()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Status getStatus() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getStatus()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public int getTerracottaClusteredSize() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getTerracottaClusteredSize()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean isCacheCoherent() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during isCacheCoherent()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean isClusterCoherent() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during isClusterCoherent()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean isNodeCoherent() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during isNodeCoherent()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during putWithWriter(Element element, CacheWriterManager writerManager)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element removeElement(Element element, ElementValueComparator comparator) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during removeElement(Element element, ElementValueComparator comparator)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void removeStoreListener(StoreListener listener) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during removeStoreListener(StoreListener listener)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Element removeWithWriter(Object key, CacheWriterManager writerManager) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during removeWithWriter(Object key, CacheWriterManager writerManager)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException, - IllegalArgumentException { - throw new RejoinCacheException("Client started rejoin during replace(Element old, Element element, ElementValueComparator comparator)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void setAttributeExtractors(Map extractors) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during setAttributeExtractors(Map extractors)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void setInMemoryEvictionPolicy(Policy policy) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during setInMemoryEvictionPolicy(Policy policy)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void setNodeCoherent(boolean coherent) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during setNodeCoherent(boolean coherent)"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public void waitUntilClusterCoherent() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during waitUntilClusterCoherent()"); - } - - @Override - public Set getSearchAttributes() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getSearchAttributes()"); - } - - /** - * {@inheritDoc}. - *

- * Throws {@link RejoinCacheException} - */ - @Override - public Attribute getSearchAttribute(String attributeName) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getSearchAttribute(String attributeName)"); - } - - /** - * {@inheritDoc} - */ - @Override - public Set getLocalKeys() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getLocalKeys()"); - } - - /** - * {@inheritDoc} - */ - @Override - public CacheConfiguration.TransactionalMode getTransactionalMode() throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during getTransactionalMode()"); - } - - /** - * {@inheritDoc} - */ - public Element unlockedGet(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during unlockedGet(Object key)"); - } - - /** - * {@inheritDoc} - */ - public Element unlockedGetQuiet(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during unlockedGetQuiet(Object key)"); - } - - /** - * {@inheritDoc} - */ - @Override - public Element unsafeGet(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during unsafeGet(Object key)"); - } - - /** - * {@inheritDoc} - */ - @Override - public void quickClear() { - throw new RejoinCacheException("Client started rejoin during quickClear()"); - } - - /** - * {@inheritDoc} - */ - @Override - public int quickSize() { - throw new RejoinCacheException("Client started rejoin during quickSize()"); - } - - /** - * {@inheritDoc} - */ - public Element unsafeGetQuiet(Object key) throws RejoinCacheException { - throw new RejoinCacheException("Client started rejoin during unsafeGetQuiet(Object key)"); - } - - /** - * {@inheritDoc} - */ - @Override - public void recalculateSize(Object key) { - throw new UnsupportedOperationException(); - } - - @Override - public WriteBehind createWriteBehind() { - throw new UnsupportedOperationException(); - } - - @Override - public void notifyCacheEventListenersChanged() { - throw new RejoinCacheException("Client started rejoin during notifyCacheEventListenersChanged()"); - } -} Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/event/NonStopEventReplicator.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/event/NonStopEventReplicator.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/event/NonStopEventReplicator.java (revision 0) @@ -1,141 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.event; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.NonstopConfiguration; -import net.sf.ehcache.constructs.nonstop.NonStopCacheException; -import net.sf.ehcache.event.CacheEventListener; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.modules.ehcache.ToolkitInstanceFactory; -import org.terracotta.modules.ehcache.store.ToolkitNonStopExceptionOnTimeoutConfiguration; -import org.terracotta.toolkit.ToolkitFeatureType; -import org.terracotta.toolkit.feature.NonStopFeature; -import org.terracotta.toolkit.nonstop.NonStopException; - -public class NonStopEventReplicator implements CacheEventListener { - - private static final Logger LOGGER = LoggerFactory - .getLogger(NonStopEventReplicator.class); - private final CacheEventListener delegate; - private final NonStopFeature nonStop; - private final ToolkitNonStopExceptionOnTimeoutConfiguration toolkitNonStopConfiguration; - private final NonstopConfiguration ehcacheNonStopConfiguration; - - public NonStopEventReplicator(CacheEventListener delegate, ToolkitInstanceFactory toolkitInstanceFactory, - NonstopConfiguration nonStopConfiguration) { - this.delegate = delegate; - this.ehcacheNonStopConfiguration = nonStopConfiguration; - this.toolkitNonStopConfiguration = new ToolkitNonStopExceptionOnTimeoutConfiguration( - this.ehcacheNonStopConfiguration); - this.nonStop = toolkitInstanceFactory.getToolkit().getFeature(ToolkitFeatureType.NONSTOP); - } - - private void handleNonStopException(NonStopException e, String eventType, Ehcache cache, Element element) { - final String cacheName = cache == null ? null : cache.getName(); - final String msg = "Terracotta clustered event notification timed out: operation: " + eventType + ", cache: " - + cacheName + ", element: " + element; - switch (ehcacheNonStopConfiguration.getTimeoutBehavior().getTimeoutBehaviorType()) { - case EXCEPTION: - throw new NonStopCacheException(msg); - default: - LOGGER.info(msg); - } - } - - @Override - public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyElementRemoved(cache, element); - } catch (NonStopException e) { - handleNonStopException(e, "REMOVED", cache, element); - } finally { - nonStop.finish(); - } - } - - @Override - public void notifyElementPut(Ehcache cache, Element element) throws CacheException { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyElementPut(cache, element); - } catch (NonStopException e) { - handleNonStopException(e, "PUT", cache, element); - } finally { - nonStop.finish(); - } - - } - - @Override - public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyElementUpdated(cache, element); - } catch (NonStopException e) { - handleNonStopException(e, "UPDATED", cache, element); - } finally { - nonStop.finish(); - } - } - - @Override - public void notifyElementExpired(Ehcache cache, Element element) { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyElementExpired(cache, element); - } catch (NonStopException e) { - handleNonStopException(e, "EXPIRED", cache, element); - } finally { - nonStop.finish(); - } - } - - @Override - public void notifyElementEvicted(Ehcache cache, Element element) { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyElementEvicted(cache, element); - } catch (NonStopException e) { - handleNonStopException(e, "EVICTED", cache, element); - } finally { - nonStop.finish(); - } - } - - @Override - public void notifyRemoveAll(Ehcache cache) { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.notifyRemoveAll(cache); - } catch (NonStopException e) { - handleNonStopException(e, "REMOVEALL", cache, null); - } finally { - nonStop.finish(); - } - } - - @Override - public void dispose() { - nonStop.start(toolkitNonStopConfiguration); - try { - this.delegate.dispose(); - } catch (NonStopException e) { - handleNonStopException(e, "DISPOSE", null, null); - } finally { - nonStop.finish(); - } - } - - @Override - public NonStopEventReplicator clone() throws CloneNotSupportedException { - return (NonStopEventReplicator) super.clone(); - } - -} Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/services/CacheStatisticSamplesResourceServiceImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/services/CacheStatisticSamplesResourceServiceImpl.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/services/CacheStatisticSamplesResourceServiceImpl.java (revision 0) @@ -1,75 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.resource.services; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntity; -import net.sf.ehcache.management.service.EntityResourceFactory; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.ServiceExecutionException; -import org.terracotta.management.ServiceLocator; -import org.terracotta.management.resource.exceptions.ResourceRuntimeException; -import org.terracotta.management.resource.services.validator.RequestValidator; - -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -/** - * @author brandony - */ -@Path("/agents/cacheManagers/caches/statistics/samples") -public final class CacheStatisticSamplesResourceServiceImpl { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSamplesResourceServiceImpl.class); - private final EntityResourceFactory entityResourceFactory; - - private final RequestValidator validator; - - public CacheStatisticSamplesResourceServiceImpl() { - this.entityResourceFactory = ServiceLocator.locate(EntityResourceFactory.class); - this.validator = ServiceLocator.locate(RequestValidator.class); - } - - /** - * - * @param info - * @return - */ - @GET - @Produces(MediaType.APPLICATION_JSON) - public Collection getCacheStatisticSamples(@Context UriInfo info) { - LOG.debug(String.format("Invoking CacheStatisticSamplesResourceServiceImpl.getCacheStatisticSamples: %s", - info.getRequestUri())); - - validator.validateSafe(info); - - String cacheManagerNames = info.getPathSegments().get(1).getMatrixParameters().getFirst("names"); - Set cmNames = cacheManagerNames == null ? null : new HashSet( - Arrays.asList(cacheManagerNames.split(","))); - - String cacheNames = info.getPathSegments().get(2).getMatrixParameters().getFirst("names"); - Set cNames = cacheNames == null ? null : new HashSet(Arrays.asList(cacheNames.split(","))); - - String sampleNames = info.getPathSegments().get(4).getMatrixParameters().getFirst("names"); - Set sNames = sampleNames == null ? null : new HashSet(Arrays.asList(sampleNames.split(","))); - - try { - return entityResourceFactory.createCacheStatisticSampleEntity(cmNames, cNames, sNames); - } catch (ServiceExecutionException e) { - throw new ResourceRuntimeException("Failed to get cache statistics sample", e, - Response.Status.BAD_REQUEST.getStatusCode()); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/WriteBehindQueueManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/WriteBehindQueueManager.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/WriteBehindQueueManager.java (revision 0) @@ -1,166 +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; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.CacheWriterConfiguration; -import net.sf.ehcache.writer.CacheWriter; - -/** - * @author Alex Snaps - */ -public class WriteBehindQueueManager implements WriteBehind { - - private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock(); - private final ReentrantReadWriteLock.ReadLock readLock = rwLock.readLock(); - private final ReentrantReadWriteLock.WriteLock writeLock = rwLock.writeLock(); - - private final List queues = new ArrayList(); - - /** - * Create the write behind queue manager with queues created via the passed in {@link WriteBehindQueueFactory} - * - * @param config configuration for the cache this write behind queue manager is working with - * @param queueFactory factory used to create the write behind queues. - */ - protected WriteBehindQueueManager(CacheConfiguration config, WriteBehindQueueFactory queueFactory) { - CacheWriterConfiguration cacheWriterConfiguration = config.getCacheWriterConfiguration(); - int writeBehindConcurrency = cacheWriterConfiguration.getWriteBehindConcurrency(); - for (int i = 0; i < writeBehindConcurrency; i++) { - this.queues.add(queueFactory.createQueue(i, config)); - } - } - - /** - * Create a new write behind queue manager. Which in turn will create as many queues as - * required by the {@link net.sf.ehcache.config.CacheWriterConfiguration#getWriteBehindConcurrency} - * - * @param config the configuration for the queue - */ - public WriteBehindQueueManager(CacheConfiguration config) { - this(config, new WriteBehindQueueFactory()); - } - - /** - * {@inheritDoc} - */ - public void start(final CacheWriter writer) throws CacheException { - writeLock.lock(); - try { - for (WriteBehind queue : queues) { - queue.start(writer); - } - } finally { - writeLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public void write(final Element element) { - readLock.lock(); - try { - getQueue(element.getKey()).write(element); - } finally { - readLock.unlock(); - } - } - - private WriteBehind getQueue(final Object key) { - return queues.get(Math.abs(key.hashCode() % queues.size())); - } - - /** - * {@inheritDoc} - */ - public void delete(final CacheEntry entry) { - readLock.lock(); - try { - getQueue(entry.getKey()).delete(entry); - } finally { - readLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public void setOperationsFilter(final OperationsFilter filter) { - readLock.lock(); - try { - for (WriteBehind queue : queues) { - queue.setOperationsFilter(filter); - } - } finally { - readLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public void stop() throws CacheException { - writeLock.lock(); - try { - for (WriteBehind queue : queues) { - queue.stop(); - } - } finally { - writeLock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - public long getQueueSize() { - int size = 0; - readLock.lock(); - try { - for (WriteBehind queue : queues) { - size += queue.getQueueSize(); - } - } finally { - readLock.unlock(); - } - return size; - } - - /** - * Factory used to create write behind queues. - */ - protected static class WriteBehindQueueFactory { - /** - * Create a write behind queue stripe. - * - * @param index index of the stripe - * @param config cache configuration for the cache this queue will be associated with. - * @return a write behind queue - */ - protected WriteBehind createQueue(int index, CacheConfiguration config) { - return new WriteBehindQueue(config); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolAccessor.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.pool; - -/** - * PoolAccessors are used by stores to tell the pools about their resource consumption - * - * @param Type representing this "other" side of this accessor (i.e. a store), so the evictor can interact with it - * - * @author Ludovic Orban - * @author Alex Snaps - * - */ -public interface PoolAccessor { - - /** - * Add an element to the pool. - * - * @param key the key of the element - * @param value the value of the element - * @param container the element-container object - * @param force true if the pool should accept adding the element, even if it's out of resources - * @return how many bytes have been added to the pool or -1 if add failed. - */ - long add(Object key, Object value, Object container, boolean force); - - /** - * Check if there is enough room in the pool to add an element without provoking any eviction - * @param key the key of the element - * @param value the value of the element - * @param container the element-container object - * @return true if there is enough room left - */ - boolean canAddWithoutEvicting(Object key, Object value, Object container); - - /** - * Delete a fixed number of bytes from the pool. - * - * @param size number of bytes - * @return how many bytes have been freed from the pool. - * @throws IllegalArgumentException when sizeOf is negative - */ - long delete(long size) throws IllegalArgumentException; - - /** - * Delete a fixed number of bytes from the pool with the given objects. - * - * @param currentSize the size of the object(s) being replaced - * @param key the key of the element - * @param value the value of the element - * @param container the element-container object - * @param force true if the pool should accept replacing the element, even if it's out of resources - * @return the change in size of the pool, or {@link Long#MIN_VALUE} if replace failed. - */ - long replace(long currentSize, Object key, Object value, Object container, boolean force); - - /** - * Return how many bytes this accessor consumes from the pool. - * - * @return how many bytes this accessor consumes from the pool. - */ - long getSize(); - - /** - * unlink this PoolAccessor from its pool. - */ - void unlink(); - - /** - * Free resources used by this accessor. - */ - void clear(); - - /** - * Return the store that uses this accessor - * - * @return store using this accessor - */ - T getParticipant(); - - /** - * Sets the max size for this pool - * - * @param newValue the value in bytes - */ - void setMaxSize(long newValue); - - /** - * Returns the occupied size for this pool. - * - * @return occupied pool size - */ - long getPoolOccupancy(); - - /** - * Returns the size of this pool. - * - * @return pool size - */ - long getPoolSize(); - - /** - * Check if the store may contain elements which the SizeOf engine could not fully size. - * - * @return true if the store may contain partially sized objects - */ - boolean hasAbortedSizeOf(); - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SearchableConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SearchableConfigurationElement.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SearchableConfigurationElement.java (revision 0) @@ -1,62 +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.SearchAttribute; -import net.sf.ehcache.config.Searchable; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * {@link NodeElement} representing a {@link Searchable} config element - * - * @author teck - */ -public class SearchableConfigurationElement extends SimpleNodeElement { - - private final Searchable searchable; - - /** - * Constructor accepting the parent and the {@link Searchable} - * - * @param parent - * @param searchable - */ - public SearchableConfigurationElement(NodeElement parent, Searchable searchable) { - super(parent, "searchable"); - - if (searchable == null) { - throw new NullPointerException(); - } - - this.searchable = searchable; - init(); - } - - private void init() { - for (SearchAttribute sa : searchable.getUserDefinedSearchAttributes().values()) { - addChildElement(sa.asConfigElement(this)); - } - - addAttribute(new SimpleNodeAttribute("keys", searchable.keys()).optional(true).defaultValue(Searchable.KEYS_DEFAULT)); - addAttribute(new SimpleNodeAttribute("values", searchable.values()).optional(true).defaultValue(Searchable.VALUES_DEFAULT)); - addAttribute(new SimpleNodeAttribute("allowDynamicIndexing", searchable.isDynamicIndexingAllowed()).optional(true) - .defaultValue(Searchable.DYNAMIC_INDEXING_DEFAULT)); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/nonstop/basic-cache-test.xml (revision 0) @@ -1,17 +0,0 @@ - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CacheLoaderTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CacheLoaderTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CacheLoaderTest.java (revision 0) @@ -1,193 +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.AbstractCacheTest; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.Status; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.extension.TestCacheExtension; -import org.junit.After; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import org.junit.Before; -import org.junit.Test; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * @author Greg Luck - * @version $Id: CacheLoaderTest.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class CacheLoaderTest { - - /** - * manager - */ - protected CacheManager manager; - - - /** - * {@inheritDoc} - * - * @throws Exception - */ - @Before - public void setUp() throws Exception { - manager = CacheManager.create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache-loaderinteractions.xml"); - } - - - /** - * {@inheritDoc} - * - * @throws Exception - */ - @After - public void tearDown() throws Exception { - if (!manager.getStatus().equals(Status.STATUS_SHUTDOWN)) { - manager.shutdown(); - } - } - - @Test - public void testWorksWithTransactionalCaches() { - Cache cache = new Cache(new CacheConfiguration("txLoaderCache", 100) - .transactionalMode(CacheConfiguration.TransactionalMode.LOCAL)); - manager.addCache(cache); - manager.getTransactionController().begin(); - final Element element = cache.getWithLoader(10, new CountingCacheLoader(), null); - assertThat((Integer) element.getValue(), equalTo(0)); - manager.getTransactionController().commit(); - } - - @Test - public void testGetAllWithLoaderExpiredKey() throws Exception { - Cache cache = manager.getCache("CCache"); - cache.put(new Element(1, "one")); - Thread.sleep(1100); // make Element 1 expire, see EHC-809 - cache.put(new Element(2, "two")); - cache.put(new Element(3, null)); - - Map cachedObjects = cache.getAllWithLoader(Arrays.asList(1, 2, 3), null); - - assertTrue(cachedObjects.get(1).toString().equals("C(1)")); - assertTrue(cachedObjects.get(2).toString().equals("two")); - assertNull(cachedObjects.get(3)); - assertTrue(cachedObjects.containsKey(3)); - } - - @Test - public void testLoaderChainNullFirst() { - Cache cache = manager.getCache("NullLoaderFirstCache"); - assertNotNull(cache.getWithLoader("key", null, null)); - NullCountingCacheLoader nullCountingCacheLoader = getNullCountingCacheLoader(cache); - assertEquals(1, nullCountingCacheLoader.getLoadCounter()); - CountingCacheLoader countingCacheLoader = getCountingCacheLoader(cache); - assertEquals(1, countingCacheLoader.getLoadCounter()); - } - - @Test - public void testLoaderChainNullLast() { - Cache cache = manager.getCache("NullLoaderLastCache"); - assertNotNull(cache.getWithLoader("key", null, null)); - CountingCacheLoader countingCacheLoader = getCountingCacheLoader(cache); - assertEquals(1, countingCacheLoader.getLoadCounter()); - NullCountingCacheLoader nullCountingCacheLoader = getNullCountingCacheLoader(cache); - assertEquals(0, nullCountingCacheLoader.getLoadCounter()); - } - - @Test - public void testLoaderChainNullBoth() { - Cache cache = manager.getCache("NullLoaderTwiceCache"); - Element element = cache.getWithLoader("key", null, null); - assertNull(element); - NullCountingCacheLoader nullCountingCacheLoader = getNullCountingCacheLoader(cache); - List list = cache.getRegisteredCacheLoaders(); - assertEquals(2, list.size()); - for (CacheLoader cacheLoader : list) { - if (cacheLoader instanceof NullCountingCacheLoader) { - nullCountingCacheLoader = (NullCountingCacheLoader) cacheLoader; - assertEquals(1, nullCountingCacheLoader.getLoadCounter()); - } - } - - } - - private CountingCacheLoader getCountingCacheLoader(Cache cache) { - List list = cache.getRegisteredCacheLoaders(); - for (CacheLoader cacheLoader : list) { - if (cacheLoader instanceof CountingCacheLoader) { - return (CountingCacheLoader) cacheLoader; - } - } - return null; - } - - private NullCountingCacheLoader getNullCountingCacheLoader(Cache cache) { - List list = cache.getRegisteredCacheLoaders(); - for (CacheLoader cacheLoader : list) { - if (cacheLoader instanceof NullCountingCacheLoader) { - return (NullCountingCacheLoader) cacheLoader; - } - } - return null; - } - - - /** - * Tests the put listener. - */ - @Test - public void testExtensionDirectly() { - - manager.addCache("test"); - TestCacheExtension testCacheExtension = new TestCacheExtension(manager.getCache("test"), "valueA"); - assertEquals(Status.STATUS_UNINITIALISED, testCacheExtension.getStatus()); - assertEquals("valueA", testCacheExtension.getPropertyA()); - - testCacheExtension.init(); - assertEquals(Status.STATUS_ALIVE, testCacheExtension.getStatus()); - - testCacheExtension.dispose(); - assertEquals(Status.STATUS_SHUTDOWN, testCacheExtension.getStatus()); - - } - - - /** - * We need to make sure that cloning a default cache results in a new cache with its own - * set of cache extensions. - */ - @Test - public void testClone() { - - //just test it does not blow up - manager.addCache("clonedCache"); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/SampledCounterConfig.java (revision 0) @@ -1,95 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util.counter.sampled; - -import net.sf.ehcache.util.counter.Counter; -import net.sf.ehcache.util.counter.CounterConfig; - -/** - * Config for a {@link SampledCounter} - * - * @author Abhishek Sanoujam - * @since 1.7 - * - */ -public class SampledCounterConfig extends CounterConfig { - private final int intervalSecs; - private final int historySize; - private final boolean isReset; - - /** - * Make a new timed counter config (duh) - * - * @param intervalSecs - * the interval (in seconds) between sampling - * @param historySize - * number of counter samples that will be retained in memory - * @param isResetOnSample - * true if the counter should be reset to 0 upon each sample - * @param initialValue - * the initial value given to this counter - */ - public SampledCounterConfig(int intervalSecs, int historySize, boolean isResetOnSample, long initialValue) { - super(initialValue); - if (intervalSecs < 1) { - throw new IllegalArgumentException("Interval (" + intervalSecs + ") must be greater than or equal to 1"); - } - if (historySize < 1) { - throw new IllegalArgumentException("History size (" + historySize + ") must be greater than or equal to 1"); - } - - this.intervalSecs = intervalSecs; - this.historySize = historySize; - this.isReset = isResetOnSample; - } - - /** - * Returns the history size - * - * @return The history size - */ - public int getHistorySize() { - return historySize; - } - - /** - * Returns the interval time (seconds) - * - * @return Interval of the sampling thread in seconds - */ - public int getIntervalSecs() { - return intervalSecs; - } - - /** - * Returns true if counters created from this config will reset on each - * sample - * - * @return true if values are reset to the initial value after each sample - */ - public boolean isResetOnSample() { - return this.isReset; - } - - /** - * {@inheritDoc} - */ - @Override - public Counter createCounter() { - return new SampledCounterImpl(this); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheHibernateMbeanNames.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.hibernate.management.impl; - -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; - -/** - * Utility class used for getting {@link ObjectName}'s for ehcache hibernate MBeans - * - *

- * - * @author Abhishek Sanoujam - * @since 1.7 - * - */ -public abstract class EhcacheHibernateMbeanNames { - - /** - * Group id for all sampled mbeans registered - */ - public static final String GROUP_ID = "net.sf.ehcache.hibernate"; - - /** - * Type for the ehcache backed hibernate second level cache statistics mbean - */ - public static final String EHCACHE_HIBERNATE_TYPE = "EhcacheHibernateStats"; - - /** - * Filter out invalid ObjectName characters from s. - * - * @param s - * @return A valid JMX ObjectName attribute value. - */ - public static String mbeanSafe(String s) { - return s == null ? "" : s.replaceAll(",|:|=|\n", "."); - } - - /** - * Returns an ObjectName for the passed name - * - * @param name - * @return An {@link ObjectName} using the input name of cache manager - * @throws MalformedObjectNameException - */ - public static ObjectName getCacheManagerObjectName(String cacheManagerClusterUUID, String name) throws MalformedObjectNameException { - ObjectName objectName = new ObjectName(GROUP_ID + ":type=" + EHCACHE_HIBERNATE_TYPE + ",name=" + mbeanSafe(name) - + getBeanNameSuffix(cacheManagerClusterUUID)); - return objectName; - } - - private static String getBeanNameSuffix(String cacheManagerClusterUUID) { - String suffix = ""; - if (!isBlank(cacheManagerClusterUUID)) { - suffix = ",node=" + cacheManagerClusterUUID; - } - return suffix; - } - - private static boolean isBlank(String param) { - return param == null || "".equals(param.trim()); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/management/sampled/CacheManagerSamplerImplTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/management/sampled/CacheManagerSamplerImplTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/management/sampled/CacheManagerSamplerImplTest.java (revision 0) @@ -1,44 +0,0 @@ -package net.sf.ehcache.management.sampled; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.query.QueryManagerBuilder; -import net.sf.ehcache.search.query.TestQueryManagerBuilder; -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * @author Anthony Dahanne - */ -public class CacheManagerSamplerImplTest { - @Test(expected = SearchException.class) - public void testExecuteQuery__no_caches() throws Exception { - - CacheManager cacheManager = mock(CacheManager.class); - String[] emptyCacheNamesArray = new String[0]; - when(cacheManager.getCacheNames()).thenReturn(emptyCacheNamesArray); - CacheManagerSamplerImpl cacheManagerSampler = new CacheManagerSamplerImpl(cacheManager); - QueryManagerBuilder qmb = TestQueryManagerBuilder.getQueryManagerBuilder(); - cacheManagerSampler.executeQuery("bogus query", qmb); - } - - @Test(expected = SearchException.class) - public void testExecuteQuery__no_searchable_caches() throws Exception { - - CacheManager cacheManager = mock(CacheManager.class); - String[] emptyCacheNamesArray = new String[]{"pif"}; - when(cacheManager.getCacheNames()).thenReturn(emptyCacheNamesArray); - CacheConfiguration cacheConfiguration = new CacheConfiguration().name("pif"); - Ehcache cache = new Cache(cacheConfiguration); - when(cacheManager.getEhcache("pif")).thenReturn(cache); - - CacheManagerSamplerImpl cacheManagerSampler = new CacheManagerSamplerImpl(cacheManager); - QueryManagerBuilder qmb = TestQueryManagerBuilder.getQueryManagerBuilder(); - cacheManagerSampler.executeQuery("bogus query", qmb); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/distribution/ManualRMIPeerProviderIT.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.distribution; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.FactoryConfiguration; - -import org.junit.Before; - -import static net.sf.ehcache.distribution.AbstractRMITest.createAsynchronousCache; - -/** - * @author Greg Luck - * @version $Id: ManualRMIPeerProviderIT.java 8870 2014-04-03 20:27:43Z cdennis $ - */ -public class ManualRMIPeerProviderIT extends MulticastRMIPeerProviderIT { - - /** - * {@inheritDoc} - */ - @Override - @Before - public void setUp() throws Exception { - List configurations = new ArrayList(); - configurations.add(new Configuration() - .cacheManagerPeerListenerFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory") - .properties("hostName=localhost, port=5011, socketTimeoutMillis=2000")) - .cacheManagerPeerProviderFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory") - .properties("peerDiscovery=manual,rmiUrls=//localhost:5012/asynchronousCache|//localhost:5013/asynchronousCache")) - .cache(createAsynchronousCache().name("asynchronousCache")) - .name("ManualRMIPeerProviderTest-1")); - - configurations.add(new Configuration() - .cacheManagerPeerListenerFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory") - .properties("hostName=localhost, port=5012, socketTimeoutMillis=2000")) - .cacheManagerPeerProviderFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory") - .properties("peerDiscovery=manual,rmiUrls=//localhost:5011/asynchronousCache|//localhost:5013/asynchronousCache")) - .cache(createAsynchronousCache().name("asynchronousCache")) - .name("ManualRMIPeerProviderTest-2")); - - configurations.add(new Configuration() - .cacheManagerPeerListenerFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory") - .properties("hostName=localhost, port=5013, socketTimeoutMillis=2000")) - .cacheManagerPeerProviderFactory(new FactoryConfiguration() - .className("net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory") - .properties("peerDiscovery=manual")) - .cache(createAsynchronousCache().name("asynchronousCache")) - .name("ManualRMIPeerProviderTest-3")); - - List managers = startupManagers(configurations); - manager1 = managers.get(0); - manager2 = managers.get(1); - manager3 = managers.get(2); - - /* manager3 has an empty manual configuration, which is topped up by adding manual entries. - * The sampleCache1 from manager3 is added to the rmiUrls list for manager1 and manager2 - */ - CacheManagerPeerProvider peerProvider = manager3.getCacheManagerPeerProvider("RMI"); - peerProvider.registerPeer("//localhost:5011/asynchronousCache"); - peerProvider.registerPeer("//localhost:5012/asynchronousCache"); - - //Allow cluster setup - waitForClusterMembership(10, TimeUnit.SECONDS, manager1, manager2, manager3); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/package.html (revision 0) @@ -1,5 +0,0 @@ - - - This package contains utility classes encapsulating ideas of Elements and Attributes from the ehcache.xsd - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/HibernateAPIUsageTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/HibernateAPIUsageTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/HibernateAPIUsageTest.java (revision 0) @@ -1,654 +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; - -import net.sf.ehcache.AbstractCacheTest; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.store.disk.DiskStoreHelper; - -import org.hamcrest.CoreMatchers; -import org.hibernate.cfg.Environment; -import org.junit.After; - -import static org.hamcrest.number.OrderingComparison.greaterThan; -import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; - -import java.io.IOException; -import java.io.Serializable; -import java.lang.reflect.Field; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ExecutionException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.test.categories.CheckShorts; - - -/** - * Tests for a Cache - * - * @author Greg Luck, Claus Ibsen - * @version $Id: HibernateAPIUsageTest.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -@Category(CheckShorts.class) -public class HibernateAPIUsageTest extends AbstractCacheTest { - private static final Logger LOG = LoggerFactory.getLogger(HibernateAPIUsageTest.class.getName()); - - /** - * teardown - */ - @Override - @After - public void tearDown() throws Exception { - super.tearDown(); - for (CacheManager cacheManager : CacheManager.ALL_CACHE_MANAGERS) { - cacheManager.shutdown(); - } - } - - @Override - @Before - public void setUp() { - // Do not setup a cachemanager here! - } - - - /** - * Make sure ehcache works with one of the main projects using it: Hibernate-2.1.8 - */ - @Test - public void testAPIAsUsedByHibernate2() throws Exception { - super.setUp(); - net.sf.hibernate.cache.EhCacheProvider provider = new net.sf.hibernate.cache.EhCacheProvider(); - provider.start(null); - net.sf.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - assertNotNull(manager.getCache("sampleCache1")); - - Serializable key = "key"; - Serializable value = "value"; - cache.put(key, value); - assertEquals(value, cache.get(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - } - - - /** - * Make sure ehcache works with one of the main projects using it: Hibernate-3.1.3 and Hibernate 3.2 - * Note this test was updated to Hibernate3.2cr2 9 May 2006 - *

- * Note that getElementCountInMemory() is broken. It reports the total cache size rather than the memory size. Fixed in Hibernate 3.2 - * getTimeout appears to be broken. It returns 4096 minutes! - */ - @Test - public void testAPIAsUsedByHibernate3() throws InterruptedException, ExecutionException { - - org.hibernate.cache.EhCacheProvider provider = new org.hibernate.cache.EhCacheProvider(); - provider.start(null); - final org.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - final Serializable key = "key"; - final Serializable value = "value"; - assertThat(cache.getSizeInMemory(), CoreMatchers.is(0L)); - cache.put(key, value); - final long EMPTY_ELEMENT_SIZE = cache.getSizeInMemory(); - cache.clear(); - - //Check created and name - assertNotNull(cache.getRegionName()); - assertEquals("sampleCache1", cache.getRegionName()); - - cache.put(key, value); - assertEquals(value, cache.get(key)); - assertEquals(value, cache.read(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - - //Behaves like a put - cache.update(key, value); - assertEquals(value, cache.get(key)); - cache.remove(key); - - //Check counts and stats - for (int i = 0; i < 10010; i++) { - cache.put("" + i, value); - } - DiskStoreHelper.flushAllEntriesToDisk(getBackingCache((org.hibernate.cache.EhCache)cache)).get(); - //this is now fixed - assertThat(cache.getElementCountInMemory(), lessThanOrEqualTo(10000L)); - // TODO Lower tier will _never_ be smaller than higher ones now -// RetryAssert.assertBy(1, SECONDS, new Callable() { -// public Long call() throws Exception { -// return cache.getElementCountOnDisk(); -// } -// }, lessThan(1002L)); - assertThat(cache.getElementCountOnDisk(), greaterThan(999L)); - - //clear - cache.clear(); - assertEquals(0, cache.getElementCountInMemory()); - cache.put(key, value); - assertEquals(EMPTY_ELEMENT_SIZE, cache.getSizeInMemory()); - - //locks - //timeout. This seems strange - assertEquals(245760000, cache.getTimeout()); - cache.lock(key); - cache.unlock(key); - - //toMap - Map map = cache.toMap(); - assertEquals(1, map.size()); - assertEquals(value, map.get(key)); - - long time1 = cache.nextTimestamp(); - long time2 = cache.nextTimestamp(); - assertTrue(time2 > time1); - - cache.clear(); - - cache.destroy(); - try { - cache.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - provider.stop(); - - } - - private Cache getBackingCache(final org.hibernate.cache.EhCache cache) { - try { - final Field cacheField = cache.getClass().getDeclaredField("cache"); - cacheField.setAccessible(true); - return (Cache)cacheField.get(cache); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - - /** - * Test new features: - *

    - *
  1. Support for Object signatures - *
  2. support for multiple SessionFactory objects in Hibernate, which presumably mean multiple providers. - * We can have two caches of the same name in different providers and interact with both - *
- */ - @Test - public void testNewHibernate32CacheAndProviderNewFeatures() { - - org.hibernate.cache.EhCacheProvider provider = new org.hibernate.cache.EhCacheProvider(); - provider.start(null); - org.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - - //start up second provider pointing to ehcache-failsage.xml because it is there - org.hibernate.cache.EhCacheProvider provider2 = new org.hibernate.cache.EhCacheProvider(); - - //Fire up a second provider, CacheManager and cache concurrently - Properties properties = new Properties(); - - properties.setProperty(Environment.CACHE_PROVIDER_CONFIG, "ehcache-2.xml"); - provider2.start(properties); - org.hibernate.cache.Cache cache2 = provider.buildCache("sampleCache1", null); - - //Check created and name - assertNotNull(cache.getRegionName()); - assertEquals("sampleCache1", cache.getRegionName()); - - //Test with Object rather than Serializable - Object key = new Object(); - Object value = new Object(); - - cache.put(key, value); - assertEquals(value, cache.get(key)); - assertEquals(value, cache.read(key)); - cache2.put(key, value); - assertEquals(value, cache2.get(key)); - assertEquals(value, cache2.read(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - cache2.remove(key); - assertEquals(null, cache2.get(key)); - - //Behaves like a put - cache.update(key, value); - assertEquals(value, cache.get(key)); - cache.remove(key); - cache2.update(key, value); - assertEquals(value, cache2.get(key)); - cache2.remove(key); - - //Check counts and stats - for (int i = 0; i < 10010; i++) { - cache.put("" + i, value); - } - assertEquals(10000, cache.getElementCountInMemory()); - //objects don't overflow, only Serializable - assertEquals(0, cache.getElementCountOnDisk()); - - //clear - cache.clear(); - assertEquals(0, cache.getElementCountInMemory()); - cache.put(key, value); - - //locks - //timeout. This seems strange - assertEquals(245760000, cache.getTimeout()); - cache.lock(key); - cache.unlock(key); - - //toMap - broken in Hibernate 3.2 -// Map map = cache.toMap(); -// assertEquals(1, map.size()); -// assertEquals(value, map.get(key)); - - long time1 = cache.nextTimestamp(); - long time2 = cache.nextTimestamp(); - assertTrue(time2 > time1); - - cache.destroy(); - try { - cache.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - cache2.destroy(); - try { - cache2.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - provider.stop(); - provider2.stop(); - } - - - /** - * Test ehcache packaged provider and EhCache with Hibernate-3.1.3 - * Leave broken timeout until get clarification from Emmanuel - */ - @Test - public void testNewHibernateEhcacheAndProviderBackwardCompatible() { - - net.sf.ehcache.hibernate.EhCacheProvider provider = new net.sf.ehcache.hibernate.EhCacheProvider(); - - //Fire up a second provider, CacheManager and cache concurrently - Properties properties = new Properties(); - - properties.setProperty("net.sf.ehcache.configurationResourceName", "ehcache-2.xml"); - provider.start(properties); - final org.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - final Serializable key = "key"; - final Serializable value = "value"; - assertThat(cache.getSizeInMemory(), CoreMatchers.is(0L)); - cache.put(key, value); - final long EMPTY_ELEMENT_SIZE = cache.getSizeInMemory(); - cache.clear(); - - //Check created and name - assertNotNull(cache.getRegionName()); - assertEquals("sampleCache1", cache.getRegionName()); - - cache.put(key, value); - assertEquals(value, cache.get(key)); - assertEquals(value, cache.read(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - - //Behaves like a put - cache.update(key, value); - assertEquals(value, cache.get(key)); - cache.remove(key); - - //Check counts and stats - for (int i = 0; i < 10010; i++) { - cache.put("" + i, value); - } - assertEquals(10010, cache.getElementCountInMemory()); - - //clear - cache.clear(); - assertEquals(0, cache.getElementCountInMemory()); - cache.put(key, value); - assertEquals(EMPTY_ELEMENT_SIZE, cache.getSizeInMemory()); - - //locks - //timeout. This seems strange - assertEquals(245760000, cache.getTimeout()); - cache.lock(key); - cache.unlock(key); - - //toMap - Map map = cache.toMap(); - assertEquals(1, map.size()); - assertEquals(value, map.get(key)); - - long time1 = cache.nextTimestamp(); - long time2 = cache.nextTimestamp(); - assertTrue(time2 > time1); - - cache.destroy(); - try { - cache.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - provider.stop(); - } - - - /** - * An integration test, at the CacheManager level, to make sure persistence works - */ - @Test - public void testPersistentStoreFromCacheManager() throws IOException, InterruptedException, CacheException, ExecutionException { - - //initialise - CacheManager manager = CacheManager.create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache.xml"); - Ehcache cache = manager.getCache("persistentLongExpiryIntervalCache"); - - cache.removeAll(); - DiskStoreHelper.flushAllEntriesToDisk((Cache)cache).get(); - for (int i = 0; i < 100; i++) { - byte[] data = new byte[1024]; - cache.put(new Element("key" + (i + 100), data)); - } - assertEquals(100, cache.getSize()); - - manager.shutdown(); - - net.sf.ehcache.hibernate.EhCacheProvider provider = new net.sf.ehcache.hibernate.EhCacheProvider(); - provider.start(null); - org.hibernate.cache.Cache hibernateCache = provider.buildCache("persistentLongExpiryIntervalCache", null); - - for (int i = 0; i < 100; i++) { - assertNotNull(hibernateCache.get("key" + (i + 100))); - } - - assertEquals(100, hibernateCache.getElementCountInMemory()); - - provider.stop(); - - - } - - - /** - * An integration test, at the CacheManager level, to make sure persistence works - */ - @Test - public void testPersistentStoreFromCacheManagerUsingHibernate321Provider() throws Exception { - - //initialise - CacheManager manager = CacheManager.create(AbstractCacheTest.TEST_CONFIG_DIR + "ehcache.xml"); - Ehcache cache = manager.getCache("persistentLongExpiryIntervalCache"); - cache.removeAll(); - - for (int i = 0; i < 100; i++) { - byte[] data = new byte[1024]; - cache.put(new Element("key" + (i + 100), data)); - } - assertEquals(100, cache.getSize()); - - manager.shutdown(); - - //Create hibernate using ehcache - org.hibernate.cache.EhCacheProvider provider = new org.hibernate.cache.EhCacheProvider(); - provider.start(null); - org.hibernate.cache.Cache hibernateCache = provider.buildCache("persistentLongExpiryIntervalCache", null); - - assertEquals(100, hibernateCache.getElementCountInMemory() + hibernateCache.getElementCountOnDisk()); - - provider.stop(); - - } - - /** - * Test ehcache packaged provider and EhCache with Hibernate-3.1.3 - * Leave broken timeout until get clarification from Emmanuel - *

- * Test new features: - *

    - *
  1. Support for Object signatures - *
  2. support for multiple SessionFactory objects in Hibernate, which presumably mean multiple providers. - * We can have two caches of the same name in different providers and interact with both - *
- */ - @Test - public void testNewHibernateEhcacheAndProviderNewFeatures() { - - net.sf.ehcache.hibernate.EhCacheProvider provider = new net.sf.ehcache.hibernate.EhCacheProvider(); - provider.start(null); - org.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - - //start up second provider pointing to ehcache-failsafe.xml because it is there - net.sf.ehcache.hibernate.EhCacheProvider provider2 = new net.sf.ehcache.hibernate.EhCacheProvider(); - - //Fire up a second provider, CacheManager and cache concurrently - Properties properties = new Properties(); - properties.setProperty(EhCacheProvider.NET_SF_EHCACHE_CONFIGURATION_RESOURCE_NAME, "ehcache-2.xml"); - provider2.start(properties); - org.hibernate.cache.Cache cache2 = provider.buildCache("sampleCache1", null); - - //Check created and name - assertNotNull(cache.getRegionName()); - assertEquals("sampleCache1", cache.getRegionName()); - - //Test with Object rather than Serializable - Object key = new Object(); - Object value = new Object(); - - cache.put(key, value); - assertEquals(value, cache.get(key)); - assertEquals(value, cache.read(key)); - cache2.put(key, value); - assertEquals(value, cache2.get(key)); - assertEquals(value, cache2.read(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - cache2.remove(key); - assertEquals(null, cache2.get(key)); - - //Behaves like a put - cache.update(key, value); - assertEquals(value, cache.get(key)); - cache.remove(key); - cache2.update(key, value); - assertEquals(value, cache2.get(key)); - cache2.remove(key); - - //Check counts and stats - for (int i = 0; i < 10010; i++) { - cache.put("" + i, value); - } - assertEquals(10010, cache.getElementCountInMemory()); - - //clear - cache.clear(); - assertEquals(0, cache.getElementCountInMemory()); - cache.put(key, value); - // elements don't need to be serializable anymore to be measured - assertTrue(cache.getSizeInMemory() > 0); - - //locks - //timeout. This seems strange - assertEquals(245760000, cache.getTimeout()); - cache.lock(key); - cache.unlock(key); - - //toMap - Map map = cache.toMap(); - assertEquals(1, map.size()); - assertEquals(value, map.get(key)); - - long time1 = cache.nextTimestamp(); - long time2 = cache.nextTimestamp(); - assertTrue(time2 > time1); - - cache.destroy(); - try { - cache.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - cache2.destroy(); - try { - cache2.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - provider.stop(); - provider2.stop(); - } - - /** - * Test ehcache packaged provider and EhCache with Hibernate-3.1.3 - * Leave broken timeout until get clarification from Emmanuel - *

- * Test new features: - *

    - *
  1. Support for Object signatures - *
- */ - @Test - public void testNewHibernateSingletonEhcacheAndProviderNewFeatures() { - - net.sf.ehcache.hibernate.SingletonEhCacheProvider provider = new net.sf.ehcache.hibernate.SingletonEhCacheProvider(); - provider.start(null); - org.hibernate.cache.Cache cache = provider.buildCache("sampleCache1", null); - - net.sf.ehcache.hibernate.SingletonEhCacheProvider provider2 = new net.sf.ehcache.hibernate.SingletonEhCacheProvider(); - provider2.start(null); - org.hibernate.cache.Cache cache2 = provider.buildCache("sampleCache1", null); - - //Check created and name - assertNotNull(cache.getRegionName()); - assertEquals("sampleCache1", cache.getRegionName()); - - //Test with Object rather than Serializable - Object key = new Object(); - Object value = new Object(); - - cache.put(key, value); - assertEquals(value, cache2.get(key)); - assertEquals(value, cache.read(key)); - cache2.put(key, value); - assertEquals(value, cache.get(key)); - assertEquals(value, cache2.read(key)); - - cache.remove(key); - assertEquals(null, cache.get(key)); - cache2.remove(key); - assertEquals(null, cache2.get(key)); - - //Behaves like a put - cache.update(key, value); - assertEquals(value, cache.get(key)); - cache.remove(key); - cache2.update(key, value); - assertEquals(value, cache2.get(key)); - cache2.remove(key); - - //Check counts and stats - for (int i = 0; i < 10010; i++) { - cache.put("" + i, value); - } - assertEquals(10010, cache.getElementCountInMemory()); - - //clear - cache.clear(); - assertEquals(0, cache.getElementCountInMemory()); - cache.put(key, value); - // elements don't need to be serializable anymore to be measured - assertTrue(cache.getSizeInMemory() > 0); - - //locks - //timeout. This seems strange - assertEquals(245760000, cache.getTimeout()); - cache.lock(key); - cache.unlock(key); - - //toMap - Map map = cache.toMap(); - assertEquals(1, map.size()); - assertEquals(value, map.get(key)); - - long time1 = cache.nextTimestamp(); - long time2 = cache.nextTimestamp(); - assertTrue(time2 > time1); - - cache.destroy(); - try { - cache.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - cache2.destroy(); - //second destroy ok - cache2.destroy(); - - try { - cache2.get(key); - fail(); - } catch (IllegalStateException e) { - //expected - } - - - ((net.sf.ehcache.hibernate.EhCache) cache).getBackingCache().getCacheManager().shutdown(); - ((net.sf.ehcache.hibernate.EhCache) cache).getBackingCache().getCacheManager().shutdown(); - ((net.sf.ehcache.hibernate.EhCache) cache2).getBackingCache().getCacheManager().shutdown(); - - //Spring and Hibernate together can call destroy after the CacheManager has been shutdown - //See bug 1901094. We need to deal with this as "normal". - cache2.destroy(); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCacheConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCacheConfiguration.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/readthrough/ReadThroughCacheConfiguration.java (revision 0) @@ -1,176 +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.readthrough; - -import java.util.Properties; - -/** - * This classed is used to programmatically configure a {@link ReadThroughCache}. - * - * @author cschanck - * - */ -public class ReadThroughCacheConfiguration implements Cloneable { - - /** - * Properties key for the name attribute - */ - public static final String NAME_KEY = "name"; - - /** - * Properties key for the get() proxy attribute - */ - public static final String GET_KEY = "get"; - - private boolean modeGet = true; - private String name = null; - private volatile boolean valid = false; - - /** - * Create default, valid configuration. - */ - public ReadThroughCacheConfiguration() { - validate(); - } - - /** - * Create a configuration object from a properties object. Validate before returning. - * - * @param properties - * @return - */ - public ReadThroughCacheConfiguration fromProperties(Properties properties) { - valid = false; - if (properties != null) { - for (String property : properties.stringPropertyNames()) { - String stringValue = properties.getProperty(property).trim(); - if (GET_KEY.equals(property)) { - setModeGet(Boolean.parseBoolean(stringValue)); - } else if (NAME_KEY.equals(property)) { - setName(stringValue); - } else { - throw new IllegalArgumentException("Unrecognized ReadThrough cache config key: " + property); - } - } - } - return build(); - } - - /** - * Return a properties version of this configuration object. - * - * @return - */ - public Properties toProperties() { - Properties p = new Properties(); - p.setProperty(NAME_KEY, getName()); - p.setProperty(GET_KEY, Boolean.toString(isModeGet())); - return p; - } - - /** - * Validate this configuration, mark it valid if it passes. - * - * @return - */ - public ReadThroughCacheConfiguration build() { - validate(); - return this; - } - - private void validate() { - // not much here. - // removing the decorator. - valid = true; - } - - private void checkValid() { - if (!valid) { - throw new IllegalStateException("RefreshAheadCacheConfig not built yet"); - } - } - - /** - * Set whether get() methods will be transparently proxied. - * - * @param modeGet true to proxy get methods - * @return - */ - public ReadThroughCacheConfiguration modeGet(boolean modeGet) { - setModeGet(modeGet); - return this; - } - - /** - * Return whether the get() method is proxied. - * - * @return true if proxied - */ - public boolean isModeGet() { - checkValid(); - return modeGet; - } - - /** - * Set whether get() methods will be transparently proxied. - * - * @param modeGet true t pxoy the get() methods - */ - public void setModeGet(boolean modeGet) { - valid = false; - this.modeGet = modeGet; - } - - /** - * Get the name to set for this cache decorator. May be null. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Set the name to set for this cache decorator. May be null. - * - * @param name name to use, may be null - * @return this config - */ - public ReadThroughCacheConfiguration setName(String name) { - valid = false; - this.name = name; - return this; - } - - /** - * Set the name to set for this cache decorator. May be null. - * - * @param name name to use, may be null - * @return this config - */ - public ReadThroughCacheConfiguration name(String name) { - setName(name); - return this; - } - - @Override - public String toString() { - return toProperties().toString(); - } - - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/ConcurrencyProblemCachePerfTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/ConcurrencyProblemCachePerfTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/ConcurrencyProblemCachePerfTest.java (revision 0) @@ -1,88 +0,0 @@ -package net.sf.ehcache; - -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import net.sf.ehcache.AbstractCacheTest.Executable; -import net.sf.ehcache.config.Configuration; -import static org.junit.Assert.assertTrue; - -/** - * @author Alex Snaps - */ -public class ConcurrencyProblemCachePerfTest { - - private static final Logger LOG = LoggerFactory.getLogger(ConcurrencyProblemCachePerfTest.class.getName()); - - @Test - public void testContinuousThrashProgrammatic() throws Exception { - CacheManager manager = new CacheManager(new Configuration().name("testContinuousThrashConfiguration")); - try { - Cache cache = new Cache("thrashcache", 5, false, false, 2, 5); - manager.addCache(cache); - for (int i = 0; i < 5; i++) { - thrashCache(cache, 1500L); - LOG.info("Finished run."); - - } - } finally { - manager.shutdown(); - } - } - - /** - * This method tries to get the cache to slow up. - * It creates 10 threads, does gets and puts. - */ - private long thrashCache(final Cache cache, final long retrievalTime) - throws Exception { - StopWatch stopWatch = new StopWatch(); - - // Create threads that do gets - final List executables = new ArrayList(); - for (int i = 0; i < 10; i++) { - final Executable executable = new Executable() { - public void execute() throws Exception { - for (int i = 0; i < 10; i++) { - final String key = "key" + i; - Object value = cache.get(key); - if (value == null) { - cache.put(new Element(key, "value" + i)); - } - //The key will be in. Now check we can get it quickly - checkRetrievalOnKnownKey(cache, retrievalTime, key); - } - } - }; - executables.add(executable); - } - - AbstractCacheTest.runThreads(executables); - cache.removeAll(); - return stopWatch.getElapsedTime(); - } - - - /** - * Checks that the liveness method returns in less than a given amount of time. - * liveness() is a method that simply returns a String. It should be very fast. It can be - * delayed because it is a synchronized method, and must acquire - * an object lock before continuing. The old blocking cache was taking up to several minutes in production - * - * @param cache a BlockingCache - */ - private void checkRetrievalOnKnownKey(Cache cache, long requiredRetrievalTime, Serializable key) { - StopWatch stopWatch = new StopWatch(); - cache.get(key); - long measuredRetrievalTime = stopWatch.getElapsedTime(); - assertTrue("Retrieval time on known key is " + measuredRetrievalTime - + " but should be less than " + requiredRetrievalTime + "ms", - measuredRetrievalTime < requiredRetrievalTime); - } -} - Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoader.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoader.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package net.sf.ehcache.osgi; - -public class EvenCacheLoader extends IncrementingCacheLoader { - - public EvenCacheLoader() { - super(true, 20000); - } - -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/RecalculateSizeTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/RecalculateSizeTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/RecalculateSizeTest.java (revision 0) @@ -1,346 +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.List; -import java.util.Random; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; - -import junit.framework.Assert; -import junit.framework.TestCase; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.MemoryUnit; -import net.sf.ehcache.pool.SizeOfEngine; -import net.sf.ehcache.pool.impl.DefaultSizeOfEngine; - -public class RecalculateSizeTest extends TestCase { - private static final Random random; - - static { - final long seed = System.currentTimeMillis(); - System.out.println("*** RANDOM SEEDED WITH " + seed + " ***"); - random = new Random(seed); - } - - private final SizeOfEngine engine = new DefaultSizeOfEngine(1000, true); - - public void testCustomValue() { - DynamicSizedValue value = new DynamicSizedValue('A'); - - value.shrinkSize(); - long shrinkedSize = engine.sizeOf(value, null, null).getCalculated(); - - value.expandSize(); - long expandedSize = engine.sizeOf(value, null, null).getCalculated(); - - System.out.println("Shrinked size: " + shrinkedSize + ", expanded size: " + expandedSize); - - Assert.assertTrue(expandedSize > shrinkedSize); - // consumes 6mb, assert diff is at least 5mb - Assert.assertTrue(expandedSize - shrinkedSize > MemoryUnit.MEGABYTES.toBytes(5)); - - value.shrinkSize(); - long shrinkedSize2 = engine.sizeOf(value, null, null).getCalculated(); - - value.expandSize(); - long expandedSize2 = engine.sizeOf(value, null, null).getCalculated(); - System.out.println("Shrinked size2: " + shrinkedSize2 + ", expanded size2: " + expandedSize2); - - Assert.assertEquals(shrinkedSize, shrinkedSize2); - Assert.assertEquals(expandedSize, expandedSize2); - - value.shrinkSize(); - value = null; - } - - public void testRecalculateSizeGrowing() { - CacheManager cm = createCacheManager(); - cm.addCache(createCache("test-cache-growing")); - - Cache cache = cm.getCache("test-cache-growing"); - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSizeInBytes()); - - DynamicSizedValue value = new DynamicSizedValue('A'); - value.shrinkSize(); - long valueShrinkedSize = engine.sizeOf(value, null, null).getCalculated(); - value.expandSize(); - long valueExpandedSize = engine.sizeOf(value, null, null).getCalculated(); - long valueSizeDiff = valueExpandedSize - valueShrinkedSize; - - value.shrinkSize(); - cache.put(new Element("key", value)); - long shrinkedSize = cache.getStatistics().getLocalHeapSizeInBytes(); - - value.expandSize(); - long expandedSizeBeforeRecalculate = cache.getStatistics().getLocalHeapSizeInBytes(); - - cache.recalculateSize("key"); - long expandedSize = cache.getStatistics().getLocalHeapSizeInBytes(); - - long expectedExpandedSize = shrinkedSize + valueSizeDiff; - - System.out.println("Shrinked size: " + shrinkedSize + ", expandedSizeBeforeRecalculate: " + expandedSizeBeforeRecalculate - + ", expandedSize: " + expandedSize + ", expectedExpandedSize: " + expectedExpandedSize + ", valueShrinkedSize: " - + valueShrinkedSize + ", valueExpandedSize: " + valueExpandedSize); - Assert.assertEquals(shrinkedSize, expandedSizeBeforeRecalculate); - Assert.assertTrue(expandedSize > shrinkedSize); - Assert.assertEquals(valueSizeDiff, expandedSize - expandedSizeBeforeRecalculate); - Assert.assertEquals(expectedExpandedSize, expandedSize); - - cache.remove("key"); - cm.shutdown(); - } - - public void testRecalculateSizeShrinking() { - CacheManager cm = createCacheManager(); - cm.addCache(createCache("test-cache-shrinking")); - - Cache cache = cm.getCache("test-cache-shrinking"); - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSizeInBytes()); - - DynamicSizedValue value = new DynamicSizedValue('A'); - value.shrinkSize(); - long valueShrinkedSize = engine.sizeOf(value, null, null).getCalculated(); - value.expandSize(); - long valueExpandedSize = engine.sizeOf(value, null, null).getCalculated(); - long valueSizeDiff = valueExpandedSize - valueShrinkedSize; - - value.expandSize(); - cache.put(new Element("key", value)); - long expandedSize = cache.getStatistics().getLocalHeapSizeInBytes(); - - value.shrinkSize(); - long shrinkedSizeBeforeRecalculate = cache.getStatistics().getLocalHeapSizeInBytes(); - - cache.recalculateSize("key"); - long shrinkedSize = cache.getStatistics().getLocalHeapSizeInBytes(); - - long expectedShrinkedSize = expandedSize - valueSizeDiff; - - System.out.println("Shrinked size: " + shrinkedSize + ", shrinkedSizeBeforeRecalculate: " + shrinkedSizeBeforeRecalculate - + ", expandedSize: " + expandedSize + ", expectedShrinkedSize: " + expectedShrinkedSize + ", valueShrinkedSize: " - + valueShrinkedSize + ", valueExpandedSize: " + valueExpandedSize); - Assert.assertEquals(expandedSize, shrinkedSizeBeforeRecalculate); - Assert.assertTrue(expandedSize > shrinkedSize); - Assert.assertEquals(valueSizeDiff, expandedSize - shrinkedSize); - Assert.assertEquals(expectedShrinkedSize, shrinkedSize); - - cache.remove("key"); - cm.shutdown(); - } - - private Cache createCache(String name) { - return new Cache(new CacheConfiguration().name(name)); - } - - private CacheManager createCacheManager() { - return CacheManager.create(new Configuration().name("test-cm").maxBytesLocalHeap(40, MemoryUnit.MEGABYTES)); - } - - public void testMultipleRecalculates() throws Exception { - System.out.println("Testing multiple recalculates..."); - final CacheManager cacheManager = createCacheManager(); - cacheManager.addCache(createCache("test-cache")); - final Cache cache = cacheManager.getCache("test-cache"); - final AtomicBoolean stop = new AtomicBoolean(false); - final AtomicReference error = new AtomicReference(); - final AtomicLong numRecalculates = new AtomicLong(); - - final String key = "the-key"; - DynamicSizedValue value = new DynamicSizedValue('A'); - value.setSize(random.nextInt(100000) + 100000); - cache.put(new Element(key, value)); - long initialInMemorySizeBytes = cache.getStatistics().getLocalHeapSizeInBytes(); - System.out.println("Initial: inMemorySizeBytes: " + initialInMemorySizeBytes); - - final int numThreads = 50; - final Thread[] threads = new Thread[numThreads]; - for (int i = 0; i < numThreads; i++) { - threads[i] = new Thread(new Runnable() { - - public void run() { - try { - while (!stop.get()) { - cache.recalculateSize(key); - numRecalculates.incrementAndGet(); - } - } catch (Throwable e) { - error.set(e); - stop.set(true); - } - } - - }, "Test thread - " + i); - - threads[i].setDaemon(true); - threads[i].start(); - } - - for (int i = 0; i < 10; i++) { - cache.recalculateSize(key); - long inMemorySizeBytes = cache.getStatistics().getLocalHeapSizeInBytes(); - System.out.println("initialInMemorySizeBytes: " + initialInMemorySizeBytes + ", calculatedInMemorySizeBytes: " - + inMemorySizeBytes + ", numRecalculates: " + numRecalculates.get()); - Assert.assertEquals(initialInMemorySizeBytes, cache.getStatistics().getLocalHeapSizeInBytes()); - Thread.sleep(1000); - } - - stop.set(true); - for (Thread t : threads) { - t.join(); - } - - Assert.assertEquals(initialInMemorySizeBytes, cache.getStatistics().getLocalHeapSizeInBytes()); - - cacheManager.shutdown(); - } - - public void testMultipleRecalculatesAndMutates() throws Exception { - System.out.println("Testing multiple recalculates with mutation..."); - final CacheManager cacheManager = createCacheManager(); - cacheManager.addCache(createCache("test-cache")); - final Cache cache = cacheManager.getCache("test-cache"); - final AtomicBoolean stop = new AtomicBoolean(false); - final AtomicReference error = new AtomicReference(); - final AtomicLong numRecalculates = new AtomicLong(); - - final String key = "the-key"; - DynamicSizedValue value = new DynamicSizedValue('A'); - value.setSize(random.nextInt(100000)); - cache.put(new Element(key, value)); - - final int numThreads = 50; - final Thread[] threads = new Thread[numThreads]; - for (int i = 0; i < numThreads; i++) { - threads[i] = new Thread(new Runnable() { - - public void run() { - try { - while (!stop.get()) { - cache.recalculateSize(key); - numRecalculates.incrementAndGet(); - } - } catch (Throwable e) { - error.set(e); - stop.set(true); - } - } - - }, "Test thread - " + i); - - threads[i].setDaemon(true); - threads[i].start(); - } - int numChanges = 1; - final int maxNumChanges = 100; - int lastValueSize = 0; - List valueSizeToCalculatedSizeList = new ArrayList(); - while (numChanges <= maxNumChanges && !stop.get()) { - lastValueSize = random.nextInt((int) MemoryUnit.KILOBYTES.toBytes(30)); - value = new DynamicSizedValue('A'); - value.setSize(lastValueSize); - cache.put(new Element(key, value)); - long calculatedInMemorySizeBytes = cache.getStatistics().getLocalHeapSizeInBytes(); - if (numChanges % 10 == 0) { - System.out.println("numChanges: " + numChanges + ", numRecalculates: " + numRecalculates.get() + ", InMemorySizeBytes: " - + calculatedInMemorySizeBytes + ", lastValueSize: " + lastValueSize); - } - valueSizeToCalculatedSizeList.add(new ValueSizeToCalculatedSizeTuple(lastValueSize, calculatedInMemorySizeBytes)); - numChanges++; - } - - for (int i = 0; i < 3; i++) { - cache.recalculateSize(key); - long calculatedMemorySizeBytes = cache.getStatistics().getLocalHeapSizeInBytes(); - System.out.println("calculatedMemorySizeBytes: " + calculatedMemorySizeBytes + ", lastValueSize: " + lastValueSize - + ", numRecalculates: " + numRecalculates.get()); - valueSizeToCalculatedSizeList.add(new ValueSizeToCalculatedSizeTuple(lastValueSize, calculatedMemorySizeBytes)); - Thread.sleep(1000); - } - - System.out.println("Done with changing size randomly. Waiting for all test threads to finish"); - - stop.set(true); - for (Thread t : threads) { - t.join(); - } - - cache.remove(key); - long sizeAfterRemove = cache.getStatistics().getLocalHeapSizeInBytes(); - Assert.assertEquals(0, sizeAfterRemove); - - for (ValueSizeToCalculatedSizeTuple tuple : valueSizeToCalculatedSizeList) { - int valueSize = tuple.valueSize; - long calculatedMemorySizeBytes = tuple.calculatedInMemorySizeBytes; - - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSizeInBytes()); - DynamicSizedValue v = new DynamicSizedValue('A'); - v.setSize(valueSize); - cache.put(new Element(key, v)); - long actualCaculatedInMemorySize = cache.getStatistics().getLocalHeapSizeInBytes(); - System.out.println("valueSize: " + valueSize + ", expectedCalculatedMemorySizeBytes: " + calculatedMemorySizeBytes - + ", actual: " + actualCaculatedInMemorySize); - Assert.assertEquals(calculatedMemorySizeBytes, actualCaculatedInMemorySize); - - cache.remove(key); - } - - cacheManager.shutdown(); - } - - private static class ValueSizeToCalculatedSizeTuple { - final int valueSize; - final long calculatedInMemorySizeBytes; - - public ValueSizeToCalculatedSizeTuple(int valueSize, long calculatedInMemorySizeBytes) { - this.valueSize = valueSize; - this.calculatedInMemorySizeBytes = calculatedInMemorySizeBytes; - } - - } - - public static class DynamicSizedValue { - private volatile char[] chars; - private final char singleChar; - - public DynamicSizedValue(char singleChar) { - this.singleChar = singleChar; - } - - public void shrinkSize() { - this.chars = null; - } - - public void expandSize() { - setSize((int) MemoryUnit.MEGABYTES.toBytes(3)); - } - - private void setSize(int bytes) { - this.chars = null; - this.chars = new char[bytes]; - for (int i = 0; i < chars.length; i++) { - chars[i] = singleChar; - } - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/LessThanOrEqual.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/LessThanOrEqual.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/LessThanOrEqual.java (revision 0) @@ -1,64 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -/** - * Less than or equal criteria - * - * @author teck - */ -public class LessThanOrEqual extends ComparableValue { - - private final Comparable comparableValue; - - /** - * Constructor - * - * @param attributeName attribute name - * @param value - */ - public LessThanOrEqual(String attributeName, Object value) { - super(attributeName, value); - this.comparableValue = (Comparable) value; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean executeComparable(Comparable attributeValue) { - return attributeValue.compareTo(comparableValue) <= 0; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean executeComparableString(Comparable attributeValue) { - return luceneStringCompare(attributeValue.toString(), comparableValue.toString()) <= 0; - } - - /** - * Comparable value. - * - * @return value - */ - public Comparable getComparableValue() { - return comparableValue; - } - -} Index: rctags/ehcache-2.10.9.1.15/distribution/events/src/assemble/bin/package.bat =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/events/src/assemble/bin/package.bat (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/events/src/assemble/bin/package.bat (revision 0) @@ -1,66 +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 bin_dir="%~d0%~p0" -set root=%~d0%~p0.. -set root="%root:"=%" -set jetty1=%root%\jetty6.1\9081\webapps -set jetty2=%root%\jetty6.1\9082\webapps - -cd %bin_dir% -for /f "tokens=*" %%a in ('call relative-paths.bat ehcache_jars_dir') do set ehcache_jars_dir=%%a -pushd -cd %ehcache_jars_dir% -set ehcache_jars_dir=%CD% -set ehcache_jars_dir="%ehcache_jars_dir:"=%" -popd - -cd %bin_dir% -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 - -set appname=events - -cd %root% -set webapp_lib=webapps\%appname%\WEB-INF\lib - -rem package ehcache-core and ehcache-terracotta -xcopy /y /q %ehcache_jars_dir%\lib\ehcache*.jar %webapp_lib% 1> NUL - -if exist %tc_install_dir%\common\terracotta-toolkit*-runtime*.jar ( - set toolkit_runtime=%tc_install_dir%\common\terracotta-toolkit*-runtime*.jar -) - -if exist %ehcache_jars_dir%\lib\terracotta-toolkit*-runtime*.jar ( - set toolkit_runtime=%ehcache_jars_dir%\lib\terracotta-toolkit*-runtime*.jar -) - -if not exist %toolkit_runtime% ( - echo Couldn't locate toolkit runtime jar - exit /b 1 -) - -xcopy /y /q %toolkit_runtime% %webapp_lib% 1> NUL - -if %errorlevel% == 0 ( - echo Deploying demo... - xcopy /y /q /e webapps %jetty1% 1> NUL - xcopy /y /q /e webapps %jetty2% 1> NUL - echo Done. -) else ( - echo Error packaging sample - exit /b 1 -) - -endlocal Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheSamplerImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheSamplerImpl.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheSamplerImpl.java (revision 0) @@ -1,2134 +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 net.sf.ehcache.Cache; -import net.sf.ehcache.CacheOperationOutcomes; -import net.sf.ehcache.CacheOperationOutcomes.ClusterEventOutcomes; -import net.sf.ehcache.CacheOperationOutcomes.NonStopOperationOutcomes; -import net.sf.ehcache.CacheStoreHelper; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.CacheConfigurationListener; -import net.sf.ehcache.config.PersistenceConfiguration; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.config.SearchAttribute; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.store.Store; -import net.sf.ehcache.store.TerracottaStore; -import net.sf.ehcache.util.CacheTransactionHelper; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.SampledRateCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; -import net.sf.ehcache.writer.writebehind.WriteBehindManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.statistics.archive.Timestamped; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -/** - * An implementation of {@link CacheSampler} - * - * @author Abhishek Sanoujam - * @author byoukste - * - * There is stupid here -- *Sample() is the same as *Rate() - */ -public class CacheSamplerImpl implements CacheSampler, CacheConfigurationListener { - private static final double ONE_HUNDRED = 100.0d; - - private static final int PERCENTAGE_DIVISOR = 100; - - private static final Logger LOG = LoggerFactory.getLogger(CacheSamplerImpl.class); - - private final Ehcache cache; - - /** - * Constructor accepting the backing {@link Ehcache} - * - * @param cache the cache object to use in initializing this sampled representation - */ - public CacheSamplerImpl(Ehcache cache) { - this.cache = cache; - cache.getCacheConfiguration().addConfigurationListener(this); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isEnabled() { - return !cache.isDisabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setEnabled(boolean enabled) { - try { - cache.setDisabled(!enabled); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isClusterBulkLoadEnabled() { - try { - return cache.isClusterBulkLoadEnabled(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isNodeBulkLoadEnabled() { - return cache.getCacheConfiguration().isTerracottaClustered() && cache.isNodeBulkLoadEnabled(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setNodeBulkLoadEnabled(boolean bulkLoadEnabled) { - if (bulkLoadEnabled && getTransactional()) { - LOG.warn("a transactional cache cannot be put into bulk-load mode"); - return; - } - cache.setNodeBulkLoadEnabled(bulkLoadEnabled); - } - - /** - * {@inheritDoc} - */ - @Override - public void flush() { - try { - cache.flush(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public String getCacheName() { - return cache.getName(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getStatus() { - return cache.getStatus().toString(); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeAll() { - if (cache instanceof Cache) { - Store store = new CacheStoreHelper((Cache)cache).getStore(); - if (store instanceof TerracottaStore) { - ((TerracottaStore)store).quickClear(); - cache.getCacheEventNotificationService().notifyRemoveAll(false); - PinningConfiguration pinningConfiguration = cache.getCacheConfiguration().getPinningConfiguration(); - if (pinningConfiguration != null && PinningConfiguration.Store.INCACHE.equals(pinningConfiguration.getStore())) { - LOG.warn("Data availability impacted:\n" + - "****************************************************************************************\n" + - "************************** removeAll called on a pinned cache **************************\n" + - "****************************************************************************************"); - } - return; - } - } - - CacheTransactionHelper.beginTransactionIfNeeded(cache); - try { - cache.removeAll(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } finally { - try { - CacheTransactionHelper.commitTransactionIfNeeded(cache); - } catch (RuntimeException e2) { - throw Utils.newPlainException(e2); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getAverageGetTimeNanosMostRecentSample() { - return getAverageGetTimeNanos(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheEvictionRate() { - return cache.getStatistics().cacheEvictionOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheElementEvictedMostRecentSample() { - return getCacheEvictionRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheExpirationRate() { - return cache.getStatistics().cacheExpiredOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheElementExpiredMostRecentSample() { - return getCacheExpirationRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCachePutRate() { - return cache.getStatistics().cachePutOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheElementPutMostRecentSample() { - return getCachePutRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheRemoveRate() { - return cache.getStatistics().cacheRemoveOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheElementRemovedMostRecentSample() { - return getCacheRemoveRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheUpdateRate() { - return cache.getStatistics().cachePutReplacedOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheElementUpdatedMostRecentSample() { - return getCacheUpdateRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheInMemoryHitRate() { - return cache.getStatistics().localHeapHitOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitInMemoryMostRecentSample() { - return getCacheInMemoryHitRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheOffHeapHitRate() { - return cache.getStatistics().localOffHeapHitOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitOffHeapMostRecentSample() { - return getCacheOffHeapHitRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitRate() { - return cache.getStatistics().cacheHitOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitMostRecentSample() { - return getCacheHitRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheOnDiskHitRate() { - return cache.getStatistics().localDiskHitOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitOnDiskMostRecentSample() { - return getCacheOnDiskHitRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissExpiredMostRecentSample() { - return cache.getStatistics().cacheMissExpiredOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissRate() { - return cache.getStatistics().cacheMissOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissMostRecentSample() { - return getCacheMissRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheInMemoryMissRate() { - return cache.getStatistics().localHeapMissOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissInMemoryMostRecentSample() { - return getCacheInMemoryMissRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheOffHeapMissRate() { - return cache.getStatistics().localOffHeapMissOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissOffHeapMostRecentSample() { - return getCacheOffHeapMissRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheOnDiskMissRate() { - return cache.getStatistics().localDiskMissOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissOnDiskMostRecentSample() { - return getCacheOnDiskMissRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissNotFoundMostRecentSample() { - return cache.getStatistics().cacheMissNotFoundOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public void dispose() { - cache.getCacheConfiguration().removeConfigurationListener(this); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isTerracottaClustered() { - return this.cache.getCacheConfiguration().isTerracottaClustered(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getTerracottaConsistency() { - Consistency consistency = this.cache.getCacheConfiguration().getTerracottaConsistency(); - return consistency != null ? consistency.name() : "na"; - } - - /** - * {@inheritDoc} - */ - @Override - public long getAverageGetTime() { - try { - return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Long getMaxGetTimeNanos() { - try { - return (Long)cache.getStatistics().cacheGetOperation().latency().maximum().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Long getMinGetTimeNanos() { - try { - return (Long)cache.getStatistics().cacheGetOperation().latency().minimum().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getXaCommitCount() { - try { - return cache.getStatistics().xaCommitCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getXaRollbackCount() { - try { - return cache.getStatistics().xaRollbackCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getXaRecoveredCount() { - try { - return cache.getStatistics().xaRecoveryCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean getHasWriteBehindWriter() { - return cache.getWriterManager() instanceof WriteBehindManager && cache.getRegisteredCacheWriter() != null; - } - - /** - * {@inheritDoc} - */ - @Override - public long getWriterQueueLength() { - try { - return cache.getStatistics().getWriterQueueLength(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public int getWriterMaxQueueSize() { - return cache.getCacheConfiguration().getCacheWriterConfiguration().getWriteBehindMaxQueueSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getWriterConcurrency() { - return cache.getCacheConfiguration().getCacheWriterConfiguration().getWriteBehindConcurrency(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheHitCount() { - try { - return cache.getStatistics().cacheHitCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissCount() { - try { - return cache.getStatistics().cacheMissCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getInMemoryMissCount() { - try { - return cache.getStatistics().localHeapMissCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getOffHeapMissCount() { - try { - return cache.getStatistics().localOffHeapMissCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getOnDiskMissCount() { - try { - return cache.getStatistics().localDiskMissCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheMissCountExpired() { - try { - return cache.getStatistics().cacheMissExpiredCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getDiskExpiryThreadIntervalSeconds() { - return cache.getCacheConfiguration().getDiskExpiryThreadIntervalSeconds(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setDiskExpiryThreadIntervalSeconds(long seconds) { - if (getDiskExpiryThreadIntervalSeconds() != seconds) { - try { - cache.getCacheConfiguration().setDiskExpiryThreadIntervalSeconds(seconds); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxEntriesLocalHeap() { - return cache.getCacheConfiguration().getMaxEntriesLocalHeap(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxEntriesLocalHeap(long maxEntries) { - if (getMaxEntriesLocalHeap() != maxEntries) { - try { - cache.getCacheConfiguration().setMaxEntriesLocalHeap(maxEntries); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxBytesLocalHeap() { - return cache.getCacheConfiguration().getMaxBytesLocalHeap(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxBytesLocalHeap(long maxBytes) { - try { - if (cache.getCacheManager().getConfiguration().isMaxBytesLocalHeapSet()) { - long heapPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalHeap(); - if (maxBytes > heapPoolSize) { - throw new IllegalArgumentException("Requested maxBytesLocalHeap (" + maxBytes - + ") greater than available CacheManager heap pool size (" + heapPoolSize + ")"); - } - } - cache.getCacheConfiguration().setMaxBytesLocalHeap(maxBytes); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxBytesLocalHeapAsString(String maxBytes) { - try { - cache.getCacheConfiguration().setMaxBytesLocalHeap(maxBytes); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - - if (cache.getCacheConfiguration().isMaxBytesLocalHeapPercentageSet()) { - long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalHeap() - * cache.getCacheConfiguration().getMaxBytesLocalHeapPercentage() / PERCENTAGE_DIVISOR; - setMaxBytesLocalHeap(cacheAssignedMem); - } - - } - - /** - * {@inheritDoc} - */ - @Override - public String getMaxBytesLocalHeapAsString() { - return cache.getCacheConfiguration().getMaxBytesLocalHeapAsString(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxEntriesLocalDisk() { - return cache.getCacheConfiguration().getMaxEntriesLocalDisk(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxEntriesLocalDisk(long maxEntries) { - if (getMaxEntriesLocalDisk() != maxEntries) { - try { - cache.getCacheConfiguration().setMaxEntriesLocalDisk(maxEntries); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxBytesLocalDisk(long maxBytes) { - try { - if (cache.getCacheManager().getConfiguration().isMaxBytesLocalDiskSet()) { - long diskPoolSize = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk(); - if (maxBytes > diskPoolSize) { - throw new IllegalArgumentException("Requested maxBytesLocalDisk (" + maxBytes - + ") greater than available CacheManager disk pool size (" + diskPoolSize + ")"); - } - } - cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxBytesLocalDiskAsString(String maxBytes) { - try { - cache.getCacheConfiguration().setMaxBytesLocalDisk(maxBytes); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - - if (cache.getCacheConfiguration().isMaxBytesLocalDiskPercentageSet()) { - long cacheAssignedMem = cache.getCacheManager().getConfiguration().getMaxBytesLocalDisk() - * cache.getCacheConfiguration().getMaxBytesLocalDiskPercentage() / PERCENTAGE_DIVISOR; - setMaxBytesLocalDisk(cacheAssignedMem); - } - } - - /** - * {@inheritDoc} - */ - @Override - public String getMaxBytesLocalDiskAsString() { - return cache.getCacheConfiguration().getMaxBytesLocalDiskAsString(); - } - - /** - * {@inheritDoc} - */ - @Override - public int getMaxElementsOnDisk() { - return cache.getCacheConfiguration().getMaxElementsOnDisk(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxEntriesInCache() { - return cache.getCacheConfiguration().getMaxEntriesInCache(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxElementsOnDisk(int maxElements) { - if (getMaxElementsOnDisk() != maxElements) { - try { - cache.getCacheConfiguration().setMaxElementsOnDisk(maxElements); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void setMaxEntriesInCache(long maxEntries) { - if (getMaxEntriesInCache() != maxEntries) { - try { - cache.getCacheConfiguration().setMaxEntriesInCache(maxEntries); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxBytesLocalDisk() { - return cache.getCacheConfiguration().getMaxBytesLocalDisk(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getMaxBytesLocalOffHeap() { - return cache.getCacheConfiguration().getMaxBytesLocalOffHeap(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getMaxBytesLocalOffHeapAsString() { - return cache.getCacheConfiguration().getMaxBytesLocalOffHeapAsString(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getMemoryStoreEvictionPolicy() { - return cache.getCacheConfiguration().getMemoryStoreEvictionPolicy().toString(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setMemoryStoreEvictionPolicy(String evictionPolicy) { - if (!getMemoryStoreEvictionPolicy().equals(evictionPolicy)) { - try { - cache.getCacheConfiguration().setMemoryStoreEvictionPolicy(evictionPolicy); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getTimeToIdleSeconds() { - return cache.getCacheConfiguration().getTimeToIdleSeconds(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setTimeToIdleSeconds(long tti) { - if (getTimeToIdleSeconds() != tti) { - try { - cache.getCacheConfiguration().setTimeToIdleSeconds(tti); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getTimeToLiveSeconds() { - return cache.getCacheConfiguration().getTimeToLiveSeconds(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setTimeToLiveSeconds(long ttl) { - if (getTimeToLiveSeconds() != ttl) { - try { - cache.getCacheConfiguration().setTimeToLiveSeconds(ttl); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDiskPersistent() { - return cache.getCacheConfiguration().isDiskPersistent(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getPersistenceStrategy() { - PersistenceConfiguration pc = cache.getCacheConfiguration().getPersistenceConfiguration(); - return pc != null ? pc.getStrategy().name() : ""; - } - - /** - * {@inheritDoc} - */ - @Override - public void setDiskPersistent(boolean diskPersistent) { - if (isDiskPersistent() != diskPersistent) { - try { - cache.getCacheConfiguration().setDiskPersistent(diskPersistent); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isOverflowToOffHeap() { - return cache.getCacheConfiguration().isOverflowToOffHeap(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isEternal() { - return cache.getCacheConfiguration().isEternal(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setEternal(boolean eternal) { - if (isEternal() != eternal) { - try { - cache.getCacheConfiguration().setEternal(eternal); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isOverflowToDisk() { - return cache.getCacheConfiguration().isOverflowToDisk(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setOverflowToDisk(boolean overflowToDisk) { - if (isOverflowToDisk() != overflowToDisk) { - try { - cache.getCacheConfiguration().setOverflowToDisk(overflowToDisk); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isLoggingEnabled() { - return cache.getCacheConfiguration().getLogging(); - } - - /** - * {@inheritDoc} - */ - @Override - public void setLoggingEnabled(boolean enabled) { - if (isLoggingEnabled() != enabled) { - try { - cache.getCacheConfiguration().setLogging(enabled); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isPinned() { - return cache.getCacheConfiguration().getPinningConfiguration() != null; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPinnedToStore() { - PinningConfiguration pinningConfig = cache.getCacheConfiguration().getPinningConfiguration(); - return pinningConfig != null ? pinningConfig.getStore().name() : "na"; - } - - /** - * {@inheritDoc} - */ - @Override - public long getEvictedCount() { - try { - return cache.getStatistics().cacheEvictedCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getExpiredCount() { - try { - return cache.getStatistics().cacheExpiredCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getInMemoryHitCount() { - try { - return cache.getStatistics().localHeapHitCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getOffHeapHitCount() { - try { - return cache.getStatistics().localOffHeapHitCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - * - * @deprecated use {@link #getLocalOffHeapSize()} - */ - @Deprecated - @Override - public long getOffHeapSize() { - return getLocalOffHeapSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getOnDiskHitCount() { - try { - return cache.getStatistics().localDiskHitCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - * - * @deprecated use {@link #getLocalDiskSize()} - */ - @Deprecated - @Override - public long getOnDiskSize() { - return getLocalDiskSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalDiskSize() { - try { - return cache.getStatistics().getLocalDiskSize(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalHeapSize() { - try { - return cache.getStatistics().getLocalHeapSize(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalOffHeapSize() { - try { - return cache.getStatistics().getLocalOffHeapSize(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalDiskSizeInBytes() { - try { - return cache.getStatistics().getLocalDiskSizeInBytes(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalHeapSizeInBytes() { - try { - return cache.getStatistics().getLocalHeapSizeInBytes(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getLocalOffHeapSizeInBytes() { - try { - return cache.getStatistics().getLocalOffHeapSizeInBytes(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getPutCount() { - try { - return cache.getStatistics().cachePutCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getRemovedCount() { - try { - return cache.getStatistics().cacheRemoveCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getSize() { - if (cache.getCacheConfiguration().isTerracottaClustered()) { - return getRemoteSizeSample().getMostRecentSample().getCounterValue(); - } - CacheTransactionHelper.beginTransactionIfNeeded(cache); - try { - return cache.getStatistics().getSize(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } finally { - try { - CacheTransactionHelper.commitTransactionIfNeeded(cache); - } catch (RuntimeException re) { - throw Utils.newPlainException(re); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getInMemorySize() { - return getLocalHeapSize(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getUpdateCount() { - try { - return cache.getStatistics().cachePutUpdatedCount(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceOneArgSuccessCount() { - try { - return cache.getStatistics().getExtended().replaceOneArg().component(CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceOneArgSuccessRate() { - try { - return cache.getStatistics().getExtended().replaceOneArg().component(CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceOneArgMissCount() { - try { - return cache.getStatistics().getExtended().replaceOneArg().component(CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceOneArgMissRate() { - try { - return cache.getStatistics().getExtended().replaceOneArg().component(CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceTwoArgSuccessCount() { - try { - return cache.getStatistics().getExtended().replaceTwoArg().component(CacheOperationOutcomes.ReplaceTwoArgOutcome.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceTwoArgSuccessRate() { - try { - return cache.getStatistics().getExtended().replaceTwoArg().component(CacheOperationOutcomes.ReplaceTwoArgOutcome.SUCCESS).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceTwoArgMissCount() { - try { - return cache.getStatistics().getExtended().replaceTwoArg().component(CacheOperationOutcomes.ReplaceTwoArgOutcome.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getReplaceTwoArgMissRate() { - try { - return cache.getStatistics().getExtended().replaceTwoArg().component(CacheOperationOutcomes.ReplaceTwoArgOutcome.FAILURE).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getPutIfAbsentSuccessCount() { - try { - return cache.getStatistics().getExtended().putIfAbsent().component(CacheOperationOutcomes.PutIfAbsentOutcome.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getPutIfAbsentSuccessRate() { - try { - return cache.getStatistics().getExtended().putIfAbsent().component(CacheOperationOutcomes.PutIfAbsentOutcome.SUCCESS).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getPutIfAbsentMissCount() { - try { - return cache.getStatistics().getExtended().putIfAbsent().component( - CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getPutIfAbsentMissRate() { - try { - return cache.getStatistics().getExtended().putIfAbsent().component(CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getRemoveElementSuccessCount() { - try { - return cache.getStatistics().getExtended().removeElement().component( - CacheOperationOutcomes.RemoveElementOutcome.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getRemoveElementSuccessRate() { - try { - return cache.getStatistics().getExtended().removeElement().component(CacheOperationOutcomes.RemoveElementOutcome.SUCCESS).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getRemoveElementMissCount() { - try { - return cache.getStatistics().getExtended().removeElement().component( - CacheOperationOutcomes.RemoveElementOutcome.FAILURE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getRemoveElementMissRate() { - try { - return cache.getStatistics().getExtended().removeElement().component(CacheOperationOutcomes.RemoveElementOutcome.FAILURE).rate().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void deregistered(CacheConfiguration config) { - /**/ - } - - /** - * {@inheritDoc} - */ - @Override - public void maxBytesLocalHeapChanged(final long oldValue, final long newValue) { - if (oldValue != newValue) { - setMaxBytesLocalHeap(newValue); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void maxBytesLocalDiskChanged(final long oldValue, final long newValue) { - if (oldValue != newValue) { - setMaxBytesLocalDisk(newValue); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void diskCapacityChanged(int oldCapacity, int newCapacity) { - if (oldCapacity != newCapacity) { - setMaxElementsOnDisk(newCapacity); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void maxEntriesInCacheChanged(long oldCapacity, long newCapacity) { - if (oldCapacity != newCapacity) { - setMaxEntriesInCache(newCapacity); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void loggingChanged(boolean oldValue, boolean newValue) { - if (oldValue != newValue) { - setLoggingEnabled(newValue); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void memoryCapacityChanged(int oldCapacity, int newCapacity) { - if (oldCapacity != newCapacity) { - setMaxEntriesLocalHeap(newCapacity); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void registered(CacheConfiguration config) { - /**/ - } - - /** - * {@inheritDoc} - */ - @Override - public void timeToIdleChanged(long oldTimeToIdle, long newTimeToIdle) { - if (oldTimeToIdle != newTimeToIdle) { - setTimeToIdleSeconds(newTimeToIdle); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void timeToLiveChanged(long oldTimeToLive, long newTimeToLive) { - if (oldTimeToLive != newTimeToLive) { - setTimeToLiveSeconds(newTimeToLive); - } - } - - /** - * {@inheritDoc} - */ - @Override - public long getAverageSearchTime() { - return cache.getStatistics().cacheSearchOperation().latency().average().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getSearchesPerSecond() { - return getCacheSearchRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean getTransactional() { - return cache.getCacheConfiguration().getTransactionalMode().isTransactional(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean getSearchable() { - return cache.getCacheConfiguration().getSearchable() != null; - } - - @Override - public Map getSearchAttributes() { - Map result = new HashMap(); - - if (cache != null && cache.getCacheConfiguration().getSearchable() != null) { - Map attrMap = new HashMap(); - - for (Attribute attr : cache.getSearchAttributes()) { - attrMap.put(attr.getAttributeName(), attr); - } - - for (SearchAttribute sa : cache.getCacheConfiguration().getSearchAttributes().values()) { - String saName = sa.getName(); - String typeName = sa.getTypeName(); - - if (attrMap.containsKey(saName) && typeName != null) { - result.put(saName, typeName); - } - } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheSearchRate() { - return cache.getStatistics().cacheSearchOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getTransactionCommitRate() { - return cache.getStatistics().xaRecoveryOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheXaCommitsMostRecentSample() { - return getTransactionCommitRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getTransactionRollbackRate() { - return cache.getStatistics().xaRollbackOperation().rate().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public long getCacheXaRollbacksMostRecentSample() { - return getTransactionRollbackRate(); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isLocalHeapCountBased() { - return cache.getCacheConfiguration() - .getMaxBytesLocalHeap() <= 0 && !(cache.getCacheManager() != null && cache.getCacheManager() - .getConfiguration() - .isMaxBytesLocalHeapSet()); - } - - /** - * A package friendly method to allow dependants access to the underlying {@link Ehcache} object. This is available - * in order to allow {@link SampledCache} objects to continue to provide deprecated methods on the {@link SampledCacheMBean} interface, - * rather than burdening {@link CacheSampler} with these now irrelevant methods. This helper method - * should be removed if we are ever able to discontinue support for the deprecated methods on dependant interfaces. - * - * @return the underlying {@code Ehcache} object - */ - Ehcache getCache() { - return cache; - } - - /** - * {@inheritDoc} - */ - @Override - public int getCacheHitRatio() { - return (int) (cache.getStatistics().getExtended().cacheHitRatio().value().doubleValue() * ONE_HUNDRED); - } - - /** - * {@inheritDoc} - */ - @Override - public int getCacheHitRatioMostRecentSample() { - return getCacheHitRatio(); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheHitRatioSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().cacheHitRatio()) { - - @Override - public TimeStampedCounterValue getMostRecentSample() { - return new TimeStampedCounterValue(System.currentTimeMillis(), getValue()); - } - - @Override - public TimeStampedCounterValue[] getAllSampleValues() { - ArrayList arr = new ArrayList(); - for (Timestamped ts : rate.history()) { - arr.add(new TimeStampedCounterValue(ts.getTimestamp(), (int) (ts.getSample().doubleValue() * ONE_HUNDRED))); - } - return sortAndPresent(arr); - } - - @Override - public long getValue() { - return (long) (rate.value().doubleValue() * ONE_HUNDRED); - } - - }; - } - - @Override - public long getAverageGetTimeNanos() { - return cache.getStatistics().cacheGetOperation().latency().average().value().longValue(); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheHitSample() { - return new SampledCounterProxy(cache.getStatistics().cacheHitOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheHitInMemorySample() { - return new SampledCounterProxy(cache.getStatistics().localHeapHitOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheHitOffHeapSample() { - return new SampledCounterProxy(cache.getStatistics().localOffHeapHitOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheHitOnDiskSample() { - return new SampledCounterProxy(cache.getStatistics().localDiskHitOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissSample() { - return new SampledCounterProxy(cache.getStatistics().cacheMissOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissInMemorySample() { - return new SampledCounterProxy(cache.getStatistics().localHeapMissOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissOffHeapSample() { - return new SampledCounterProxy(cache.getStatistics().localOffHeapMissOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissOnDiskSample() { - return new SampledCounterProxy(cache.getStatistics().localDiskMissOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissExpiredSample() { - return new SampledCounterProxy(cache.getStatistics().cacheMissExpiredOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheMissNotFoundSample() { - return new SampledCounterProxy(cache.getStatistics().cacheMissNotFoundOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheElementEvictedSample() { - return new SampledCounterProxy(cache.getStatistics().cacheEvictionOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheElementRemovedSample() { - return new SampledCounterProxy(cache.getStatistics().cacheRemoveOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheElementExpiredSample() { - return new SampledCounterProxy(cache.getStatistics().cacheExpiredOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheElementPutSample() { - return new SampledCounterProxy(cache.getStatistics().cachePutOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheElementUpdatedSample() { - return new SampledCounterProxy(cache.getStatistics().cachePutReplacedOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledRateCounter getAverageGetTimeSample() { - return new SampledRateCounterProxy(cache.getStatistics().cacheGetOperation().latency().average()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledRateCounter getAverageSearchTimeSample() { - return new SampledRateCounterProxy(cache.getStatistics().cacheSearchOperation().latency().average()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getSearchesPerSecondSample() { - return new SampledRateCounterProxy(cache.getStatistics().cacheSearchOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheXaCommitsSample() { - return new SampledRateCounterProxy(cache.getStatistics().xaCommitSuccessOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getCacheXaRollbacksSample() { - return new SampledRateCounterProxy(cache.getStatistics().xaRollbackOperation().rate()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getSizeSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().size()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalHeapSizeSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localHeapSize()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalHeapSizeInBytesSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localHeapSizeInBytes()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalOffHeapSizeSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localOffHeapSize()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalOffHeapSizeInBytesSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localOffHeapSizeInBytes()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalDiskSizeSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localDiskSize()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getLocalDiskSizeInBytesSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().localDiskSizeInBytes()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getRemoteSizeSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().remoteSize()); - } - - /** - * {@inheritDoc} - */ - @Override - public SampledCounter getWriterQueueLengthSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().writerQueueLength()); - } - - @Override - public long getAverageSearchTimeNanos() { - return getAverageSearchTime(); - } - - @Override - public long getCacheClusterOfflineCount() { - try { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.OFFLINE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getCacheClusterRejoinCount() { - try { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.REJOINED).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getCacheClusterOnlineCount() { - try { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.ONLINE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getCacheClusterOfflineMostRecentSample() { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.OFFLINE).rate().value().longValue(); - } - - @Override - public long getCacheClusterRejoinMostRecentSample() { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.REJOINED).rate().value().longValue(); - } - - @Override - public long getCacheClusterOnlineMostRecentSample() { - return cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.ONLINE).rate().value().longValue(); - } - - @Override - public SampledCounter getCacheClusterOfflineSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.OFFLINE).rate()); - } - - @Override - public SampledCounter getCacheClusterOnlineSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.ONLINE).rate()); - } - - @Override - public SampledCounter getCacheClusterRejoinSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().clusterEvent().component(ClusterEventOutcomes.REJOINED).rate()); - } - - @Override - public long getMostRecentRejoinTimeStampMillis() { - try { - return cache.getStatistics().getExtended().mostRecentRejoinTimeStampMillis().value().longValue(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public SampledCounter getMostRecentRejoinTimestampMillisSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().mostRecentRejoinTimeStampMillis()); - } - - @Override - public long getNonStopSuccessCount() { - try { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.SUCCESS).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getNonStopFailureCount() { - try { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.FAILURE).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getNonStopRejoinTimeoutCount() { - try { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.REJOIN_TIMEOUT).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getNonStopTimeoutCount() { - try { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.TIMEOUT).count().value(); - } catch (RuntimeException e) { - throw Utils.newPlainException(e); - } - } - - @Override - public long getNonStopSuccessMostRecentSample() { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.SUCCESS).rate().value().longValue(); - } - - @Override - public long getNonStopFailureMostRecentSample() { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.FAILURE).rate().value().longValue(); - } - - @Override - public long getNonStopRejoinTimeoutMostRecentSample() { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.REJOIN_TIMEOUT).rate().value().longValue(); - } - - @Override - public long getNonStopTimeoutMostRecentSample() { - return cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.TIMEOUT).rate().value().longValue(); - } - - @Override - public SampledCounter getNonStopSuccessSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.SUCCESS).rate()); - } - - @Override - public SampledCounter getNonStopFailureSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.FAILURE).rate()); - } - - @Override - public SampledCounter getNonStopRejoinTimeoutSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.REJOIN_TIMEOUT).rate()); - } - - @Override - public SampledCounter getNonStopTimeoutSample() { - return new SampledRateCounterProxy(cache.getStatistics().getExtended().nonstop().component(NonStopOperationOutcomes.TIMEOUT).rate()); - } - - @Override - public long getNonStopSuccessRate() { - return getNonStopSuccessMostRecentSample(); - } - - @Override - public long getNonStopFailureRate() { - return getNonStopFailureMostRecentSample(); - } - - @Override - public long getNonStopRejoinTimeoutRate() { - return getNonStopRejoinTimeoutMostRecentSample(); - } - - @Override - public long getNonStopTimeoutRate() { - return getNonStopTimeoutMostRecentSample(); - } - - @Override - public SampledCounter getReplaceOneArgSuccessSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().replaceOneArg().component( - CacheOperationOutcomes.ReplaceOneArgOutcome.SUCCESS).rate()); - } - - @Override - public SampledCounter getReplaceOneArgMissSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().replaceOneArg().component( - CacheOperationOutcomes.ReplaceOneArgOutcome.FAILURE).rate()); - } - - @Override - public SampledCounter getReplaceTwoArgSuccessSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().replaceTwoArg().component( - CacheOperationOutcomes.ReplaceTwoArgOutcome.SUCCESS).rate()); - } - - @Override - public SampledCounter getReplaceTwoArgMissSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().replaceTwoArg().component( - CacheOperationOutcomes.ReplaceTwoArgOutcome.FAILURE).rate()); - } - - @Override - public SampledCounter getPutIfAbsentSuccessSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().putIfAbsent().component( - CacheOperationOutcomes.PutIfAbsentOutcome.SUCCESS).rate()); - } - - @Override - public SampledCounter getPutIfAbsentMissSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().putIfAbsent().component( - CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE).rate()); - } - - @Override - public SampledCounter getRemoveElementSuccessSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().removeElement().component( - CacheOperationOutcomes.RemoveElementOutcome.SUCCESS).rate()); - } - - @Override - public SampledCounter getRemoveElementMissSample() { - return new SampledCounterProxy(cache.getStatistics().getExtended().removeElement().component( - CacheOperationOutcomes.RemoveElementOutcome.FAILURE).rate()); - } - - @Override - public int getNonstopTimeoutRatio() { - return (int) (cache.getStatistics().getExtended().nonstopTimeoutRatio().value().doubleValue() * ONE_HUNDRED); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to MBeans with Sampled Statistics. -

- - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/SearchAttribute.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/SearchAttribute.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/SearchAttribute.java (revision 0) @@ -1,333 +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; - -import java.util.Properties; -import java.util.Set; - -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; -import net.sf.ehcache.search.attribute.AttributeExtractor; -import net.sf.ehcache.search.attribute.AttributeType; -import net.sf.ehcache.search.attribute.JavaBeanAttributeExtractor; -import net.sf.ehcache.search.attribute.ReflectionAttributeExtractor; -import net.sf.ehcache.util.ClassLoaderUtil; -import net.sf.ehcache.util.PropertyUtil; - -/** - * A cache search attribute. Search attributes must have a name and optionally an expression or class set (if neither is set then this - * implies java bean style) - * - * @author teck - */ -public class SearchAttribute { - - private static final Class UNRESOLVED = UnresolvedType.class; - - private String name; - private String className; - private String expression; - private String properties; - private String propertySeparator; - private String typeName; - private Class type; - - /** - * Set the attribute name - * - * @param name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Set the extractor class for this attribute. This class must be available at runtime and must implement {@link AttributeExtractor} - * - * @param className - */ - public void setClass(String className) { - if (expression != null) { - throw new InvalidConfigurationException("Cannot set both class and expression for a search attribute"); - } - this.className = className; - } - - /** - * Set the attribute expression. See {@link ReflectionAttributeExtractor} for more information - * - * @param expression - */ - public void setExpression(String expression) { - if (className != null) { - throw new InvalidConfigurationException("Cannot set both class and expression for a search attribute"); - } - this.expression = expression; - } - - /** - * Set optional attribute type - * @param type - */ - public void setType(String type) { - this.type = UNRESOLVED; - this.typeName = type; - } - - /** - * Set optional attribute type - * @param type - */ - public void setType(Class type) { - this.typeName = validateType(type); - this.type = type; - } - - /** - * Get the extractor class name - */ - public String getClassName() { - return className; - } - - /** - * Get the attribute expression - */ - public String getExpression() { - return expression; - } - - /** - * Get the attribute name - */ - public String getName() { - return name; - } - - /** - * @return String representation of attribute type - */ - public String getTypeName() { - return typeName; - } - - - /** - * Get actual attribute type - * @return - */ - Class getType(ClassLoader loader) { - if (type == UNRESOLVED) { - type = validateType(this.typeName, loader); - } - - - return type; - } - - /** - * Construct the extractor for this attribute configuration - */ - public AttributeExtractor constructExtractor(ClassLoader loader) { - if (name == null) { - throw new InvalidConfigurationException("search attribute has no name"); - } - - if (expression != null) { - return new ReflectionAttributeExtractor(expression); - } else if (className != null) { - if (properties != null) { - return (AttributeExtractor) ClassLoaderUtil.createNewInstance(loader, className, new Class[] {Properties.class}, - new Object[] {PropertyUtil.parseProperties(properties, propertySeparator)}); - } else { - return (AttributeExtractor) ClassLoaderUtil.createNewInstance(loader, className); - } - } else { - return new JavaBeanAttributeExtractor(name); - } - } - - /** - * Set the attribute name - * - * @param name - * @return this - */ - public SearchAttribute name(String name) { - setName(name); - return this; - } - - /** - * Set the attribute extractor class name - * - * @param className - * attribute extractor class - * @return this - */ - public SearchAttribute className(String className) { - setClass(className); - return this; - } - - /** - * Set the attribute expression - * - * @param expression - * attribute expression - * @return this - */ - public SearchAttribute expression(String expression) { - setExpression(expression); - return this; - } - - /** - * Set optional attribute type - * @param type - * @return this - */ - public SearchAttribute type(String type) { - setType(type); - return this; - } - - /** - * Set optional attribute type - * @param type - * @return this - */ - public SearchAttribute type(Class type) { - setType(type); - return this; - } - - /** - * Set the extractor properties - * - * @param props - */ - public void setProperties(String props) { - this.properties = props; - } - - /** - * Set the extractor properties separator - * - * @param sep - */ - public void setPropertySeparator(String sep) { - this.propertySeparator = sep; - } - - /** - * Set the extractor properties separator - * - * @param sep - * @return this - */ - public SearchAttribute propertySeparator(String sep) { - setPropertySeparator(sep); - return this; - } - - /** - * Set the extractor properties - * - * @param props - * @return this - */ - public SearchAttribute properties(String props) { - setProperties(props); - return this; - } - - /** - * Create a generated config element node for this search attribute definition - * - * @param parent the enclosing parent config element - * @return generated config element for this search attribute - */ - public NodeElement asConfigElement(NodeElement parent) { - SimpleNodeElement rv = new SimpleNodeElement(parent, "searchAttribute"); - - rv.addAttribute(new SimpleNodeAttribute("name", name)); - - if (expression != null) { - rv.addAttribute(new SimpleNodeAttribute("expression", expression)); - } else if (className != null) { - rv.addAttribute(new SimpleNodeAttribute("class", className)); - if (properties != null) { - rv.addAttribute(new SimpleNodeAttribute("properties", properties)); - } - if (propertySeparator != null) { - rv.addAttribute(new SimpleNodeAttribute("propertySeparator", propertySeparator)); - } - } - if (typeName != null) { - rv.addAttribute(new SimpleNodeAttribute("type", typeName)); - } - - return rv; - } - - private Class validateType(String attrType, ClassLoader loader) { - Class realType = null; - for (Class c : AttributeType.getSupportedJavaTypes()) { - if (attrType.equals(c.getName())) { - realType = c; - break; - } - String[] groups = c.getName().split("\\."); - if (attrType.equals(groups[groups.length - 1])) { - if (realType != null) { throw new InvalidConfigurationException("Ambiguous attribute type " + attrType); } - realType = c; - } - } - - if (realType == null) { - // Attempt to load then validate that it's enum - try { - realType = loader.loadClass(attrType); - } catch (ClassNotFoundException e) { - throw new InvalidConfigurationException(String.format("Unable to load class specified as type of attribute %s: %s", - name, e.getMessage())); - } - if (!realType.isEnum()) { - throw new InvalidConfigurationException(String.format("Unsupported attribute type specified %s for search attribute %s", - attrType, name)); - } - } - - return realType; - } - - private String validateType(Class attrType) { - Set> knownTypes = AttributeType.getSupportedJavaTypes(); - String t = attrType.getName(); - if (!knownTypes.contains(attrType) && !attrType.isEnum()) { - throw new InvalidConfigurationException(String.format("Unsupported attribute type specified %s for search attribute %s", t, name)); - } - return t; - } - - private static class UnresolvedType { - // - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/search/QueryExamplesTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/search/QueryExamplesTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/search/QueryExamplesTest.java (revision 0) @@ -1,268 +0,0 @@ -package net.sf.ehcache.search; - -import static net.sf.ehcache.search.Query.KEY; -import static org.junit.Assert.assertEquals; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.SearchAttribute; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import bsh.EvalError; -import bsh.Interpreter; - -/** - * This class was used to develop the API and now that the code has been written it has been made an - * executable test. - * - * @author teck - * @author Greg Luck - */ -public class QueryExamplesTest { - - private static final Logger LOG = LoggerFactory.getLogger(QueryExamplesTest.class); - - private CacheManager cacheManager; - private Ehcache cache; - - @Before - public void before() { - cacheManager = new CacheManager(getClass().getResource("/ehcache-search.xml")); - cache = cacheManager.getCache("cache1"); - SearchTestUtil.populateData(cache); - } - - @After - public void after() { - cacheManager.shutdown(); - } - - @Test - public void testExamples() { - examples(); - } - - void examples() throws SearchException { - - Attribute age = cache.getSearchAttribute("age"); - Attribute gender = cache.getSearchAttribute("gender"); - Attribute name = cache.getSearchAttribute("name"); - - Query query; - Results results; - - // include all keys in the cache - query = cache.createQuery().includeKeys().end(); - results = query.execute(); - for (Result result : results.all()) { - LOG.info("" + result.getKey()); - } - results.discard(); // not required but will speed resource freeing - - // access results in a "paged" manner - query = cache.createQuery().includeKeys().end(); - results = query.execute(); - - int pageSize = 100; - int index = 0; - List page; - do { - page = results.range(index, pageSize); - - for (Result result : page) { - LOG.info("" + result.getKey()); - } - - index += page.size(); - } while (page.size() == pageSize); - - // select age from the cache - query = cache.createQuery().includeAttribute(age).end(); - results = query.execute(); - for (Result result : results.all()) { - LOG.info("" + result.getAttribute(age)); - } - - // select age, gender from the cache - query = cache.createQuery().includeAttribute(age, gender).end(); - results = query.execute(); - for (Result result : results.all()) { - LOG.info("" + result.getAttribute(age)); - // slf4j weirdness - Object object = result.getAttribute(gender); - LOG.info("" + object); - } - - // select max(age) -- named indexed attribute "age" - Query sumQuery = cache.createQuery().includeAggregator(age.sum()).end(); - results = sumQuery.execute(); - for (Result result : results.all()) { - Long sumResult = (Long) result.getAggregatorResults().get(0); - LOG.info("Sum is: " + sumResult); - } - - // select keys with criteria age == 12 AND gender = "timmy" - query = cache.createQuery().includeKeys().addCriteria(age.eq(12).and(gender.eq("timmy"))).end(); - - // same as above (but without AND, uses two add() -- multiple - // criteria implies AND) - query = cache.createQuery().includeKeys().addCriteria(age.eq(12)).addCriteria(gender.eq("timmy")).end(); - - // slightly more complicated expression and multiple ordering - // age = 13 OR (age == 12 AND gender = "timmy") order by age asc, gender desc limit 10 - query = cache.createQuery().includeKeys().addCriteria(age.eq(13).or(age.eq(12).and(gender.eq("timmy")))) - .addOrderBy(age, Direction.ASCENDING).addOrderBy(gender, Direction.DESCENDING).maxResults(10).end(); - } - - @Test - public void testNoIncludeSpecified() { - Attribute age = cache.getSearchAttribute("age"); - Query query = cache.createQuery().addCriteria(age.eq(35)); - try { - query.execute(); - Assert.fail(); - } catch (SearchException e) { - System.err.println("Expected " + e.toString()); - } - } - - @Test - public void testUseShorthandKeyAttribute() { - Results results = cache.createQuery().addCriteria(KEY.eq(1)).includeKeys().execute(); - assertEquals(1, results.size()); - assertEquals(1, results.all().iterator().next().getKey()); - } - - @Test - public void testUseShorthandValueAttribute() { - Object tmpKey = new Object(); - Double value = Math.PI * System.nanoTime(); - cache.put(new Element(tmpKey, value)); - - try { - Results results = cache.createQuery().addCriteria(Query.VALUE.eq(value)).includeKeys().execute(); - assertEquals(1, results.size()); - assertEquals(tmpKey, results.all().iterator().next().getKey()); - } finally { - cache.remove(tmpKey); - } - } - - @Test - public void testIncludeKeysSpecified() { - Attribute age = cache.getSearchAttribute("age"); - Results results = cache.createQuery().addCriteria(age.eq(35)).includeKeys().execute(); - assertEquals(2, results.size()); - for (Result result : results.all()) { - LOG.info("" + cache.get(result.getKey())); - } - } - - @Test - public void testSearchKeys() { - Results results = cache.createQuery().addCriteria(Query.KEY.in(Arrays.asList(1, 3))).includeKeys().execute(); - assertEquals(2, results.size()); - for (Result result : results.all()) { - LOG.info("" + cache.get(result.getKey())); - } - } - - /** - * Show how to execute a query in beanshell - */ - @Test - public void testBasicBeanShellQuery() throws EvalError { - - Interpreter i = new Interpreter(); - Query query = cache.createQuery().includeKeys(); - - Attribute age = cache.getSearchAttribute("age"); - - i.set("query", query); - Results results = null; - i.set("results", results); - i.set("age", age); - - i.eval("results = query.addCriteria(age.eq(35)).execute()"); - results = (Results) i.get("results"); - assertEquals(2, results.size()); - for (Result result : results.all()) { - LOG.info("" + result.getKey()); - } - } - - /** - * Show how to execute a query in beanshell - */ - @Test - public void testInjectedStringBeanShellQuery() throws EvalError { - - Interpreter i = new Interpreter(); - Query query = cache.createQuery().includeKeys(); - - Attribute age = cache.getSearchAttribute("age"); - - i.set("query", query); - Results results = null; - i.set("results", results); - i.set("age", age); - - String userDefinedQuery = "age.eq(35)"; - String fullQueryString = "results = query.addCriteria(" + userDefinedQuery + ").execute()"; - - i.eval(fullQueryString); - results = (Results) i.get("results"); - assertEquals(2, results.size()); - for (Result result : results.all()) { - LOG.info("" + result.getKey()); - } - } - - /** - * Show how to execute a query in beanshell using autodiscovered attributes - */ - @Test - public void testAutoDiscoveredAttributesBeanShellQuery() throws EvalError { - - Interpreter i = new Interpreter(); - - // Auto discover the search attributes and add them to the interpreter's context - Map attributes = cache.getCacheConfiguration().getSearchAttributes(); - for (Map.Entry entry : attributes.entrySet()) { - i.set(entry.getKey(), cache.getSearchAttribute(entry.getKey())); - LOG.info("Setting attribute " + entry.getKey()); - } - - // Define the query and results. Add things which would be set in the GUI i.e. includeKeys and add to context - Query query = cache.createQuery().includeKeys(); - Results results = null; - i.set("query", query); - i.set("results", results); - - // This comes from the freeform text field - String userDefinedQuery = "age.eq(35)"; - - // Add the stuff on that we need - String fullQueryString = "results = query.addCriteria(" + userDefinedQuery + ").execute()"; - - i.eval(fullQueryString); - results = (Results) i.get("results"); - assertEquals(2, results.size()); - for (Result result : results.all()) { - LOG.info("" + result.getKey()); - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ClientArrayValues1.java (revision 0) @@ -1,27 +0,0 @@ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.terracotta.toolkit.Toolkit; - -public class ClientArrayValues1 extends ClientBase { - - public ClientArrayValues1(String[] args) { - super("test", args); - } - - public static void main(String[] args) { - new ClientArrayValues1(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit toolkit) throws Throwable { - cache.put(new Element("key", new String[] { "a", "b", "c" })); -// } else { -// Element elem = cache.get("key"); -// assertNotNull() -// String[] value = elem.getValue(); -// } - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/net/sf/ehcache/osgi/ehcache-scheduled-refresh.xml (revision 0) @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-no-update.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-no-update.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/ehcache-no-update.xml (revision 0) @@ -1,13 +0,0 @@ - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/nonstop/concurrency/LockOperationTimedOutNonstopException.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/nonstop/concurrency/LockOperationTimedOutNonstopException.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/nonstop/concurrency/LockOperationTimedOutNonstopException.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.constructs.nonstop.concurrency; - -import net.sf.ehcache.constructs.nonstop.NonStopCacheException; - -/** - * Special class of {@link NonStopCacheException} which is thrown on timeout of lock operations - * - * @author Abhishek Sanoujam - * - */ -public class LockOperationTimedOutNonstopException extends NonStopCacheException { - - /** - * public constructor - * - * @param message - */ - public LockOperationTimedOutNonstopException(String message) { - super(message); - } - -} Index: rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/management-ehcache-v2/src/main/java/net/sf/ehcache/management/resource/CacheStatisticSampleEntityV2.java (revision 0) @@ -1,33 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.resource; - -import java.util.Map; - -/** - * @author brandony - */ -public class CacheStatisticSampleEntityV2 extends AbstractCacheEntityV2{ - - private String statName; - - private Map statValueByTimeMillis; - - public String getStatName() { - return statName; - } - - public void setStatName(String statName) { - this.statName = statName; - } - - public Map getStatValueByTimeMillis() { - return statValueByTimeMillis; - } - - public void setStatValueByTimeMillis(Map statValueByTimeMillis) { - this.statValueByTimeMillis = statValueByTimeMillis; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/LruMemoryStore.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/LruMemoryStore.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/LruMemoryStore.java (revision 0) @@ -1,719 +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.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.Status; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.pool.Size; -import net.sf.ehcache.pool.SizeOfEngine; -import net.sf.ehcache.pool.SizeOfEngineLoader; -import net.sf.ehcache.writer.CacheWriterManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import net.sf.ehcache.CacheOperationOutcomes.EvictionOutcome; -import net.sf.ehcache.statistics.StatisticBuilder; -import net.sf.ehcache.store.StoreOperationOutcomes.GetOutcome; -import org.terracotta.statistics.Statistic; -import org.terracotta.statistics.observer.OperationObserver; - -import net.sf.ehcache.store.StoreOperationOutcomes.PutOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.RemoveOutcome; - -/** - * An implementation of a LruMemoryStore. - *

- * This uses {@link java.util.LinkedHashMap} as its backing map. It uses the {@link java.util.LinkedHashMap} LRU - * feature. LRU for this implementation means least recently accessed. - * - * @author Greg Luck - * @version $Id$ - */ -public class LruMemoryStore extends AbstractStore { - - private static final Logger LOG = LoggerFactory.getLogger(LruMemoryStore.class.getName()); - - /** - * The cache this store is associated with. - */ - protected Ehcache cache; - - /** - * Map where items are stored by key. - */ - protected Map map; - - /** - * The DiskStore associated with this MemoryStore. - */ - protected final Store diskStore; - - /** - * status. - */ - protected Status status; - - /** - * The maximum size of the store (0 == no limit) - */ - protected long maximumSize; - - private final boolean cachePinned; - private final boolean elementPinningEnabled; - - private final CopyStrategyHandler copyStrategyHandler; - - - private final OperationObserver getObserver = StatisticBuilder.operation(GetOutcome.class).named("get").of(this) - .tag("local-heap").build(); - private final OperationObserver putObserver = StatisticBuilder.operation(PutOutcome.class).named("put").of(this) - .tag("local-heap").build(); - private final OperationObserver removeObserver = StatisticBuilder.operation(RemoveOutcome.class).named("remove").of(this) - .tag("local-heap").build(); - private final OperationObserver evictionObserver; - - - /** - * Constructor for the LruMemoryStore object - * The backing {@link java.util.LinkedHashMap} is created with LRU by access order. - */ - public LruMemoryStore(Ehcache cache, Store diskStore) { - status = Status.STATUS_UNINITIALISED; - this.maximumSize = cache.getCacheConfiguration().getMaxEntriesLocalHeap(); - this.cachePinned = determineCachePinned(cache.getCacheConfiguration()); - this.elementPinningEnabled = !cache.getCacheConfiguration().isOverflowToOffHeap(); - this.cache = cache; - this.diskStore = diskStore; - if (cache.getCacheConfiguration().isOverflowToDisk()) { - evictionObserver = null; - } else { - evictionObserver = StatisticBuilder.operation(EvictionOutcome.class).named("eviction").of(this).build(); - } - map = new SpoolingLinkedHashMap(); - status = Status.STATUS_ALIVE; - copyStrategyHandler = MemoryStore.getCopyStrategyHandler(cache); - } - - private boolean determineCachePinned(CacheConfiguration cacheConfiguration) { - PinningConfiguration pinningConfiguration = cacheConfiguration.getPinningConfiguration(); - if (pinningConfiguration == null) { - return false; - } - - switch (pinningConfiguration.getStore()) { - case LOCALMEMORY: - return false; - - case INCACHE: - return !cacheConfiguration.isOverflowToOffHeap() && !cacheConfiguration.isOverflowToDisk(); - - default: - throw new IllegalArgumentException(); - } - } - - /** - * Puts an item in the cache. Note that this automatically results in - * {@link net.sf.ehcache.store.LruMemoryStore.SpoolingLinkedHashMap#removeEldestEntry} being called. - * - * @param element the element to add - */ - public final boolean put(Element element) throws CacheException { - return putInternal(element, null); - } - - /** - * {@inheritDoc} - */ - public final boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException { - return putInternal(element, writerManager); - } - - private synchronized boolean putInternal(Element element, CacheWriterManager writerManager) throws CacheException { - putObserver.begin(); - boolean newPut = true; - if (element != null) { - newPut = map.put(element.getObjectKey(), element) == null; - if (writerManager != null) { - writerManager.put(element); - } - doPut(element); - } - if (newPut) { - putObserver.end(PutOutcome.ADDED); - } else { - putObserver.end(PutOutcome.UPDATED); - } - return newPut; - } - - /** - * Allow specialised actions over adding the element to the map. - * - * @param element - */ - protected void doPut(Element element) throws CacheException { - //empty - } - - /** - * Gets an item from the cache. - *

- * The last access time in {@link net.sf.ehcache.Element} is updated. - * - * @param key the cache key - * @return the element, or null if there was no match for the key - */ - public final synchronized Element get(Object key) { - getObserver.begin(); - Element e = (Element) map.get(key); - if (e == null) { - getObserver.end(GetOutcome.MISS); - return null; - } else { - getObserver.end(GetOutcome.HIT); - return e; - } - } - - /** - * Gets an item from the cache, without updating statistics. - * - * @param key the cache key - * @return the element, or null if there was no match for the key - */ - public final synchronized Element getQuiet(Object key) { - return (Element) map.get(key); - } - - /** - * Removes an Element from the store. - * - * @param key the key of the Element, usually a String - * @return the Element if one was found, else null - */ - public final Element remove(Object key) { - return removeInternal(key, null); - } - - /** - * {@inheritDoc} - */ - public final Element removeWithWriter(Object key, CacheWriterManager writerManager) throws CacheException { - return removeInternal(key, writerManager); - } - - private synchronized Element removeInternal(Object key, CacheWriterManager writerManager) throws CacheException { - // remove single item. - removeObserver.begin(); - Element element = (Element) map.remove(key); - if (writerManager != null) { - writerManager.remove(new CacheEntry(key, element)); - } - removeObserver.end(RemoveOutcome.SUCCESS); - if (element != null) { - return element; - } else { - return null; - } - } - - /** - * Remove all of the elements from the store. - */ - public final synchronized void removeAll() throws CacheException { - clear(); - } - - /** - * Clears any data structures and places it back to its state when it was first created. - */ - protected final void clear() { - map.clear(); - } - - /** - * Prepares for shutdown. - */ - public final synchronized void dispose() { - if (status.equals(Status.STATUS_SHUTDOWN)) { - return; - } - status = Status.STATUS_SHUTDOWN; - flush(); - - //release reference to cache - cache = null; - } - - - /** - * Flush to disk only if the cache is diskPersistent. - */ - public final void flush() { - if (cache.getCacheConfiguration().isDiskPersistent()) { - if (LOG.isDebugEnabled()) { - LOG.debug(cache.getName() + " is persistent. Spooling " + map.size() + " elements to the disk store."); - } - spoolAllToDisk(); - } - - //should be emptied if clearOnFlush is true - if (cache.getCacheConfiguration().isClearOnFlush()) { - clear(); - } - } - - - /** - * Spools all elements to disk, in preparation for shutdown. - *

- * This revised implementation is a little slower but avoids using increased memory during the method. - */ - protected final void spoolAllToDisk() { - boolean clearOnFlush = cache.getCacheConfiguration().isClearOnFlush(); - for (Object key : getKeys()) { - Element element = (Element) map.get(key); - if (element != null) { - if (!element.isSerializable()) { - if (LOG.isWarnEnabled()) { - LOG.warn("Object with key " + element.getObjectKey() - + " is not Serializable and is not being overflowed to disk."); - } - } else { - spoolToDisk(element); - //Don't notify listeners. They are not being removed from the cache, only a store - //Leave it in the memory store for performance if do not want to clear on flush - if (clearOnFlush) { - remove(key); - } - } - } - } - } - - /** - * Puts the element in the DiskStore. - * Should only be called if isOverflowToDisk is true - *

- * Relies on being called from a synchronized method - * - * @param element The Element - */ - protected void spoolToDisk(Element element) { - diskStore.put(element); - if (LOG.isDebugEnabled()) { - LOG.debug(cache.getName() + "Cache: spool to disk done for: " + element.getObjectKey()); - } - } - - /** - * Gets the status of the MemoryStore. - */ - public final Status getStatus() { - return status; - } - - /** - * Gets an Array of the keys for all elements in the memory cache. - *

- * Does not check for expired entries - * - * @return An Object[] - */ - public final synchronized List getKeys() { - return new ArrayList(map.keySet()); - } - - /** - * Returns the current cache size. - * - * @return The size value - */ - public final int getSize() { - return map.size(); - } - - /** - * Returns nothing since a disk store isn't clustered - * - * @return returns 0 - */ - public final int getTerracottaClusteredSize() { - return 0; - } - - - /** - * An unsynchronized check to see if a key is in the Store. No check is made to see if the Element is expired. - * - * @param key The Element key - * @return true if found. If this method return false, it means that an Element with the given key is definitely not in the MemoryStore. - * If it returns true, there is an Element there. An attempt to get it may return null if the Element has expired. - */ - public final boolean containsKey(Object key) { - return map.containsKey(key); - } - - - /** - * Measures the size of the memory store by using the sizeof engine. - *

- * Warning: This method can be very expensive to run. Allow approximately 1 second - * per 1MB of entries. Running this method could create liveness problems - * because the object lock is held for a long period - * - * @return the size, in bytes - */ - public final synchronized long getSizeInBytes() throws CacheException { - SizeOfEngine defaultSizeOfEngine = SizeOfEngineLoader.newSizeOfEngine( - SizeOfPolicyConfiguration.resolveMaxDepth(cache), - SizeOfPolicyConfiguration.resolveBehavior(cache) - .equals(SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT), - true - ); - long sizeInBytes = 0; - for (Object o : map.entrySet()) { - Map.Entry entry = (Map.Entry)o; - Element element = (Element) entry.getValue(); - if (element != null) { - Size size = defaultSizeOfEngine.sizeOf(entry.getKey(), element, null); - sizeInBytes += size.getCalculated(); - } - } - return sizeInBytes; - } - - - /** - * Evict the Element. - *

- * Evict means that the Element is: - *

    - *
  • if, the store is diskPersistent, the Element is spooled to the DiskStore - *
  • if not, the Element is removed. - *
- * - * @param element the Element to be evicted. - */ - protected final void evict(Element element) throws CacheException { - if (cache.getCacheConfiguration().isOverflowToDisk()) { - if (!element.isSerializable()) { - if (LOG.isWarnEnabled()) { - LOG.warn(new StringBuilder("Object with key ").append(element.getObjectKey()) - .append(" is not Serializable and cannot be overflowed to disk").toString()); - } - cache.getCacheEventNotificationService().notifyElementEvicted(copyStrategyHandler.copyElementForReadIfNeeded(element), false); - } else { - spoolToDisk(element); - } - } else { - evictionObserver.begin(); - evictionObserver.end(EvictionOutcome.SUCCESS); - cache.getCacheEventNotificationService().notifyElementEvicted(copyStrategyHandler.copyElementForReadIfNeeded(element), false); - } - } - - /** - * Before eviction elements are checked. - * - * @param element - */ - protected final void notifyExpiry(Element element) { - cache.getCacheEventNotificationService().notifyElementExpiry(copyStrategyHandler.copyElementForReadIfNeeded(element), false); - } - - - /** - * An algorithm to tell if the MemoryStore is at or beyond its carrying capacity. - */ - protected final boolean isFull() { - return maximumSize > 0 && map.size() > maximumSize; - } - - /** - * Expire all elsments. - *

- * This is a default implementation which does nothing. Expiry on demand is only - * implemented for disk stores. - */ - public void expireElements() { - //empty implementation - } - - /** - * Memory stores are never backed up and always return false - */ - public boolean bufferFull() { - return false; - } - - - /** - * Package local access to the map for testing - */ - Map getBackingMap() { - return map; - } - - /** - * {@inheritDoc} - */ - public Object getMBean() { - return null; - } - - /** - * An extension of LinkedHashMap which overrides {@link #removeEldestEntry} - * to persist cache entries to the auxiliary cache before they are removed. - *

- * This implementation also provides LRU by access order. - */ - public final class SpoolingLinkedHashMap extends java.util.LinkedHashMap { - private static final int INITIAL_CAPACITY = 100; - private static final float GROWTH_FACTOR = .75F; - - /** - * Default constructor. - * Will create an initial capacity of 100, a loading of .75 and - * LRU by access order. - */ - public SpoolingLinkedHashMap() { - super(INITIAL_CAPACITY, GROWTH_FACTOR, true); - } - - /** - * Returns true if this map should remove its eldest entry. - * This method is invoked by put and putAll after - * inserting a new entry into the map. It provides the implementer - * with the opportunity to remove the eldest entry each time a new one - * is added. This is useful if the map represents a cache: it allows - * the map to reduce memory consumption by deleting stale entries. - *

- * Will return true if: - *

    - *
  1. the element has expired - *
  2. the cache size is greater than the in-memory actual. - * In this case we spool to disk before returning. - *
- * - * @param eldest The least recently inserted entry in the map, or if - * this is an access-ordered map, the least recently accessed - * entry. This is the entry that will be removed it this - * method returns true. If the map was empty prior - * to the put or putAll invocation resulting - * in this invocation, this will be the entry that was just - * inserted; in other words, if the map contains a single - * entry, the eldest entry is also the newest. - * @return true if the eldest entry should be removed - * from the map; false if it should be retained. - */ - @Override - protected final boolean removeEldestEntry(Map.Entry eldest) { - Element element = (Element) eldest.getValue(); - return element != null && removeLeastRecentlyUsedElement(element); - } - - /** - * {@inheritDoc} - */ - @Override - public Object put(Object key, Object value) { - Object put = super.put(key, value); - - Iterator it = entrySet().iterator(); - while (isFull() && it.hasNext()) { - Map.Entry entry = (Map.Entry) it.next(); - if (removeEldestEntry(entry)) { - it.remove(); - } - } - - return put; - } - - /** - * Relies on being called from a synchronized method - * - * @param element - * @return true if the LRU element should be removed - */ - private boolean removeLeastRecentlyUsedElement(Element element) throws CacheException { - //check for expiry and remove before going to the trouble of spooling it - if (element.isExpired()) { - notifyExpiry(element); - return true; - } - - if (isFull() && !cachePinned) { - evict(element); - return true; - } else { - return false; - } - - } - } - - - /** - * @return the current eviction policy. This may not be the configured policy, if it has been - * dynamically set. - * @see #setEvictionPolicy(Policy) - */ - public Policy getEvictionPolicy() { - return new LruPolicy(); - } - - /** - * Sets the eviction policy strategy. The Store will use a policy at startup. The store may allow changing - * the eviction policy strategy dynamically. Otherwise implementations will throw an exception if this method - * is called. - * - * @param policy the new policy - */ - public void setEvictionPolicy(Policy policy) { - throw new UnsupportedOperationException("This store is LRU only. It does not support changing the eviction" + - " strategy."); - } - - /** - * {@inheritDoc} - */ - public Object getInternalContext() { - return null; - } - - /** - * {@inheritDoc} - */ - public boolean containsKeyInMemory(Object key) { - return containsKey(key); - } - - /** - * {@inheritDoc} - */ - public boolean containsKeyOffHeap(Object key) { - return false; - } - - /** - * {@inheritDoc} - */ - public boolean containsKeyOnDisk(Object key) { - return false; - } - - /** - * {@inheritDoc} - */ - public Policy getInMemoryEvictionPolicy() { - return getEvictionPolicy(); - } - - /** - * {@inheritDoc} - */ - @Statistic(name = "size", tags = "local-heap") - public int getInMemorySize() { - return getSize(); - } - - /** - * {@inheritDoc} - */ - @Statistic(name = "size-in-bytes", tags = "local-heap") - public long getInMemorySizeInBytes() { - return getSizeInBytes(); - } - - /** - * {@inheritDoc} - */ - public int getOffHeapSize() { - return 0; - } - - /** - * {@inheritDoc} - */ - public long getOffHeapSizeInBytes() { - return 0; - } - - /** - * {@inheritDoc} - */ - public int getOnDiskSize() { - return 0; - } - - /** - * {@inheritDoc} - */ - public long getOnDiskSizeInBytes() { - return 0; - } - - /** - * {@inheritDoc} - */ - public void setInMemoryEvictionPolicy(Policy policy) { - setEvictionPolicy(policy); - } - - /** - * Unsupported in LruMemoryStore - */ - public Element putIfAbsent(Element element) throws NullPointerException { - throw new UnsupportedOperationException(); - } - - /** - * Unsupported in LruMemoryStore - */ - public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { - throw new UnsupportedOperationException(); - } - - /** - * Unsupported in LruMemoryStore - */ - public boolean replace(Element old, Element element, ElementValueComparator comparator) - throws NullPointerException, IllegalArgumentException { - throw new UnsupportedOperationException(); - } - - /** - * Unsupported in LruMemoryStore - */ - public Element replace(Element element) throws NullPointerException { - throw new UnsupportedOperationException(); - } -} - Index: rctags/ehcache-2.10.9.1.15/distribution/events/src/main/resources/ehcache.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/events/src/main/resources/ehcache.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/events/src/main/resources/ehcache.xml (revision 0) @@ -1,12 +0,0 @@ - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/package.html (revision 0) @@ -1,7 +0,0 @@ - - - - - This package contains the cache configuration code. - - Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/AbstractWriteBehindAtomicityTestBase.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/AbstractWriteBehindAtomicityTestBase.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/AbstractWriteBehindAtomicityTestBase.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import org.terracotta.tests.base.AbstractClientBase; - -import com.tc.test.config.model.TestConfig; -import com.tc.util.Assert; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; - -public abstract class AbstractWriteBehindAtomicityTestBase extends AbstractCacheTestBase { - - public AbstractWriteBehindAtomicityTestBase(final String ehcacheConfigPath, TestConfig testConfig, - Class... c) { - super(ehcacheConfigPath, testConfig, c); - testConfig.getClientConfig().getBytemanConfig().setScript("/byteman/writeBehindAtomicity.btm"); - // disableTest(); - } - - // 1) Begin putWithWriter - // 2) lock() putWithWriter - // 3) Begin Transaction - // 4) Commit Transaction - // 5) unlock() putWithWriter - // 6) Done putWithWriter - @Override - protected void evaluateClientOutput(String clientName, int exitCode, File output) throws Throwable { - super.evaluateClientOutput(clientName, exitCode, output); - int txnCount = 0; - boolean underExplicitLock = false; - FileReader fr = null; - BufferedReader reader = null; - try { - fr = new FileReader(output); - reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - // only check for main thread - if (st.contains("main")) { - if (st.contains("BEGINOPERATION")) { - Assert.assertEquals(false, underExplicitLock); - underExplicitLock = true; - } else if (st.contains("COMMITTRANSACTION") && underExplicitLock) { - txnCount++; - Assert.assertEquals(txnCount, 1); - } else if (st.contains("ENDOPERATION")) { - Assert.assertEquals(true, underExplicitLock); - underExplicitLock = false; - Assert.assertEquals(txnCount, 1); - txnCount = 0; - } - } - } - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - reader.close(); - } catch (Exception e) { - // - } - } - - Assert.assertEquals(false, underExplicitLock); - Assert.assertEquals(txnCount, 0); - } - -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/SimpleOsgiTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/SimpleOsgiTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/SimpleOsgiTest.java (revision 0) @@ -1,126 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package net.sf.ehcache.osgi; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages; -import static org.ops4j.pax.exam.CoreOptions.options; -import static org.terracotta.test.OsgiUtil.commonOptions; -import static org.terracotta.test.OsgiUtil.getMavenBundle; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.terracotta.context.ContextManager; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Serializable; -import java.net.URL; - -/** - * Test a simple BigMemory usage with BM Go license key. The product name should include "BigMemory" and not "Ehcache" - * NOTE: this test only works in fullmode - * - * @author hhuynh - */ -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerMethod.class) -public class SimpleOsgiTest { - - @Configuration - public Option[] config() { - return options(bootDelegationPackages("sun.*,jdk.*"), - // need this for REST agent test - getMavenBundle("net.sf.ehcache", "ehcache-ee", "ehcache"), - commonOptions()); - } - - @Test - public void testSimpleCache() throws Exception { - CacheManager manager = new CacheManager(SimpleOsgiTest.class.getResource("/net/sf/ehcache/osgi/simple-ehcache.xml")); - try { - Cache cache = manager.getCache("sampleCache1"); - Element element = new Element("key1", "value1"); - cache.put(element); - Element element1 = cache.get("key1"); - assertEquals("value1", element1.getObjectValue()); - assertEquals(1, cache.getSize()); - } finally { - manager.shutdown(); - } - } - - @Test - public void testValueClass() throws Exception { - CacheManager manager = new CacheManager(SimpleOsgiTest.class.getResource("/net/sf/ehcache/osgi/simple-ehcache.xml")); - try { - Cache cache = manager.getCache("sampleCache1"); - Element element = new Element("key1", new Value("value1")); - cache.put(element); - Element element1 = cache.get("key1"); - assertEquals("value1", ((Value) element1.getObjectValue()).v); - assertEquals(1, cache.getSize()); - } finally { - manager.shutdown(); - } - } - - @Test - public void testUsingNonExportedClass() { - try { - ContextManager cm = new ContextManager(); - fail("Expected class not found exception"); - } catch (Throwable e) { - // expected - } - } - - @Test - public void testRestAgent() throws Exception { - CacheManager manager = new CacheManager( - SimpleOsgiTest.class - .getResource("/net/sf/ehcache/osgi/rest-enabled-ehcache.xml")); - InputStream in = null; - try { - Cache testCache = manager.getCache("testCache"); - testCache.put(new Element("k", "v")); - assertEquals(1, testCache.getSize()); - URL url = new URL("http://localhost:9888/tc-management-api/agents"); - in = url.openStream(); - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String line = null; - StringBuilder sb = new StringBuilder(); - while ((line = reader.readLine()) != null) { - sb.append(line.trim()).append("\n"); - } - System.out.println("Rest response: " + sb); - assertTrue(sb.toString().contains("\"agentId\":\"embedded\"")); - } finally { - manager.shutdown(); - if (in != null) { - in.close(); - } - } - } - - private static class Value implements Serializable { - public String v; - - public Value(String value) { - v = value; - } - } -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/TimeStampedCounterValue.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/TimeStampedCounterValue.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/counter/sampled/TimeStampedCounterValue.java (revision 0) @@ -1,68 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util.counter.sampled; - -import java.io.Serializable; - -/** - * A counter value at a particular time instance - * - * @author Abhishek Sanoujam - * @since 1.7 - */ -public class TimeStampedCounterValue implements Serializable { - private final long counterValue; - private final long timestamp; - - /** - * Constructor accepting the value of both timestamp and the counter value. - * - * @param timestamp - * @param value - */ - public TimeStampedCounterValue(long timestamp, long value) { - this.timestamp = timestamp; - this.counterValue = value; - } - - /** - * Get the counter value - * - * @return The counter value - */ - public long getCounterValue() { - return this.counterValue; - } - - /** - * Get value of the timestamp - * - * @return the timestamp associated with the current value - */ - public long getTimestamp() { - return this.timestamp; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return "value: " + this.counterValue + ", timestamp: " + this.timestamp; - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/Cache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/Cache.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/Cache.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.management; - -import javax.management.NotCompliantMBeanException; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.hibernate.management.impl.EhcacheHibernateMbeanNames; -import net.sf.ehcache.util.CacheTransactionHelper; - -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import java.io.Serializable; - -/** - * A Cache implementation that supports JMX MBeans - * @author Greg Luck - * @version $Id: Cache.java 10789 2018-04-26 02:08:13Z adahanne $ - * @since 1.3 - */ -public class Cache implements CacheMBean, Serializable { - - private static final long serialVersionUID = 3477287016924524437L; - - - /** - * An Ehcache backing instance - */ - private transient Ehcache cache; - private ObjectName objectName; - - - /** - * A constructor for JCache. - * - * JCache is an adaptor for an Ehcache, and therefore requires an Ehcace in its constructor. - *

- * The {@link net.sf.ehcache.config.ConfigurationFactory} and clients can create these. - *

- * A client can specify their own settings here and pass the {@link Ehcache} object - * into {@link net.sf.ehcache.CacheManager#addCache} to specify parameters other than the defaults. - *

- * Only the CacheManager can initialise them. - * - * @param cache An ehcache - * @throws net.sf.ehcache.CacheException - */ - public Cache(Ehcache cache) throws CacheException { - this.cache = cache; - objectName = createObjectName(cache.getCacheManager().toString(), cache.getName()); - } - - /** - * Creates an object name using the scheme "net.sf.ehcache:type=Cache,CacheManager=,name=" - */ - static ObjectName createObjectName(String cacheManagerName, String cacheName) { - ObjectName objectName; - try { - objectName = new ObjectName("net.sf.ehcache:type=Cache,CacheManager=" + cacheManagerName + ",name=" - + EhcacheHibernateMbeanNames.mbeanSafe(cacheName)); - } catch (MalformedObjectNameException e) { - throw new CacheException(e); - } - return objectName; - } - - /** - * Removes all cached items. - * - * @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE} - */ - public void removeAll() throws IllegalStateException, CacheException { - CacheTransactionHelper.beginTransactionIfNeeded(cache); - try { - cache.removeAll(); - } finally { - CacheTransactionHelper.commitTransactionIfNeeded(cache); - } - } - - /** - * Flushes all cache items from memory to the disk store, and from the DiskStore to disk. - * - * @throws IllegalStateException if the cache is not {@link net.sf.ehcache.Status#STATUS_ALIVE} - */ - public void flush() throws IllegalStateException, CacheException { - cache.flush(); - } - - /** - * Gets the status attribute of the Cache. - * - * @return The status value as a String from the Status enum class - */ - public String getStatus() { - return cache.getStatus().toString(); - } - - /** - * Gets the cache name. - */ - public String getName() { - return cache.getName(); - } - - /** - * Is the cache configured with Terracotta clustering? - */ - public boolean isTerracottaClustered() { - return cache.getCacheConfiguration().isTerracottaClustered(); - } - - /** - * May the cache contain elements which the SizeOf engine could not fully size? - */ - public boolean hasAbortedSizeOf() { - return cache.hasAbortedSizeOf(); - } - - /** - * Gets the JMX read-only CacheConfiguration - */ - public CacheConfiguration getCacheConfiguration() { - return new CacheConfiguration(cache); - } - - /** - * Gets the JMX cache statistics - */ - public CacheStatistics getStatistics() { - return new CacheStatistics(cache); - } - - /** - * Gets the JMX store bean - */ - Store getStore() throws NotCompliantMBeanException { - return Store.getBean(cache); - } - - /** - * @return the object name for this MBean - */ - ObjectName getObjectName() { - return objectName; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/Harness.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/Harness.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/Harness.java (revision 0) @@ -1,34 +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 java.io.StringReader; - -public class Harness { - public static void main(String[] args) throws Exception { - { - EhcacheSearchParser parser = new EhcacheSearchParser(new StringReader("select * " + - " where ('name' = 'tom' and (not ('age' = (class foo.bar.Baz)'10' or 'foo' > 11 )) and 'zip' = '21104') group by key order by " + - "'name' desc limit 10" - )); - ParseModel model = parser.QueryStatement(); - System.out.println(model); - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/PersistenceConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/PersistenceConfiguration.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/PersistenceConfiguration.java (revision 0) @@ -1,129 +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; - -/** - * Class to hold the persistence policy configuration. - * - * @author Chris Dennis - */ -public class PersistenceConfiguration { - - /** - * Default synchronous writes setting - */ - public static final boolean DEFAULT_SYNCHRONOUS_WRITES = false; - - /** - * Enumeration of the legal persistence strategies - */ - public static enum Strategy { - /** - * Standard open source (non fault-tolerant) on-disk persistence - */ - LOCALTEMPSWAP, - /** - * Enterprise fault tolerant persistence - */ - LOCALRESTARTABLE, - /** - * No persistence - */ - NONE, - /** - * Terracotta clustered persistence (requires a Terracotta clustered cache). - */ - DISTRIBUTED; - } - - private volatile Strategy strategy; - private volatile boolean synchronousWrites; - - /** - * Gets the persistence strategy - * - * @return the persistence strategy - */ - public Strategy getStrategy() { - return strategy; - } - - /** - * Sets the persistence strategy - * - * @param strategy the persistence strategy - */ - public void setStrategy(String strategy) { - if (strategy == null) { - throw new IllegalArgumentException("strategy must be non-null"); - } - strategy(Strategy.valueOf(strategy.toUpperCase())); - } - - /** - * Builder method to set the persistence strategy - * - * @param strategy the persistence strategy - * @return this PersistenceConfiguration object - */ - public PersistenceConfiguration strategy(Strategy strategy) { - this.strategy = strategy; - return this; - } - - /** - * Builder method to set the persistence strategy using a String object - * - * @param strategy the persistence strategy - * @return this PersistenceConfiguration object - */ - public PersistenceConfiguration strategy(String strategy) { - setStrategy(strategy); - return this; - } - - /** - * Gets the persistence write mode - * - * @return the persistence write mode - */ - public boolean getSynchronousWrites() { - return synchronousWrites; - } - - /** - * Sets the persistence write mode - * - * @param synchronousWrites the persistence write mode - */ - public void setSynchronousWrites(boolean synchronousWrites) { - this.synchronousWrites = synchronousWrites; - } - - /** - * Builder method to set the persistence write mode - * - * @param synchronousWrites the persistence write mode - * @return this PersistenceConfiguration object - */ - public PersistenceConfiguration synchronousWrites(boolean synchronousWrites) { - setSynchronousWrites(synchronousWrites); - return this; - } - - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/nontransactional/EmptySecondLevelCacheEntryTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/nontransactional/EmptySecondLevelCacheEntryTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/container/hibernate/nontransactional/EmptySecondLevelCacheEntryTest.java (revision 0) @@ -1,16 +0,0 @@ -/* - * All content copyright (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package org.terracotta.ehcache.tests.container.hibernate.nontransactional; - -import junit.framework.Test; - -public class EmptySecondLevelCacheEntryTest extends NonTransactionalCacheTest { - - public static Test suite() { - return new NonTransactionalCacheTest.TestSetup(EmptySecondLevelCacheEntryTest.class, - EmptySecondLevelCacheEntryServlet.class); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/small.ico =================================================================== diff -u -N -r11494 -r11522 Binary files differ Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoaderFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoaderFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/net/sf/ehcache/osgi/EvenCacheLoaderFactory.java (revision 0) @@ -1,19 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package net.sf.ehcache.osgi; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.loader.CacheLoader; -import net.sf.ehcache.loader.CacheLoaderFactory; - -import java.util.Properties; - -public class EvenCacheLoaderFactory extends CacheLoaderFactory { - - @Override - public CacheLoader createCacheLoader(Ehcache cache, Properties properties) { - return new EvenCacheLoader(); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/.project =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/.project (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/.project (revision 0) @@ -1,23 +0,0 @@ - - - ehcache-scheduled-refresh - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - Index: rctags/ehcache-2.10.9.1.15/distribution/src/main/assembly/root/QUICK-START.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/src/main/assembly/root/QUICK-START.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/src/main/assembly/root/QUICK-START.html (revision 0) @@ -1,20 +0,0 @@ - - - - - - - - -Ehcache Quickstart - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/DiskStoreHelper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/DiskStoreHelper.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/DiskStoreHelper.java (revision 0) @@ -1,59 +0,0 @@ -package net.sf.ehcache.store.disk; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheStoreHelper; -import net.sf.ehcache.store.CacheStore; -import net.sf.ehcache.store.LegacyStoreWrapper; -import net.sf.ehcache.store.Store; - -import java.lang.reflect.Field; -import java.util.concurrent.Future; - -/** - * @author Alex Snaps - */ -public class DiskStoreHelper { - - public static Future flushAllEntriesToDisk(final Cache cache) { - CacheStoreHelper cacheStoreHelper = new CacheStoreHelper(cache); - return flushAllEntriesToDisk(cacheStoreHelper.getStore()); - } - - public static Future flushAllEntriesToDisk(final Store store) { - if (store instanceof CacheStore) { - final DiskStore authority = getField("authoritativeTier", store); - return flushAllEntriesToDisk(authority); - } else if (store instanceof LegacyStoreWrapper) { - final DiskStore authority = getField("disk", store); - return flushAllEntriesToDisk(authority); - } else if (store instanceof DiskStore) { - final DiskStorageFactory factory = getField("disk", store); - return factory.flush(); - } else if (store instanceof LegacyStoreWrapper) { - final DiskStore disk = getField("disk", store); - return flushAllEntriesToDisk(disk); - } else { - return null; - } - } - - private static T getField(final String fieldName, final Object obj) { - try { - Field field = null; - Class clazz = obj.getClass(); - while(field == null && clazz != null) { - try { - field = clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - clazz = clazz.getSuperclass(); - } catch (SecurityException e) { - throw new RuntimeException(e); - } - } - field.setAccessible(true); - return (T) field.get(obj); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/ods/FileAllocationTreeTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/ods/FileAllocationTreeTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/disk/ods/FileAllocationTreeTest.java (revision 0) @@ -1,104 +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.disk.ods; - -import java.util.ArrayList; -import java.util.BitSet; -import java.util.List; -import java.util.Random; - -import org.junit.Test; - -import junit.framework.Assert; - -public class FileAllocationTreeTest { - - @Test - public void testUniformSizedAllocations() { - FileAllocationTree test = new FileAllocationTree(100, null); - - for (int i = 0; i < 100; i++) { - Assert.assertEquals(i, test.alloc(1).start()); - } - Assert.assertEquals(100, test.getFileSize()); - } - - @Test - public void testUniformSizedFrees() { - FileAllocationTree test = new FileAllocationTree(100, null); - test.alloc(100); - Assert.assertEquals(100, test.getFileSize()); - - for (int i = 0; i < 100; i++) { - Assert.assertEquals(100, test.getFileSize()); - test.free(new Region(i)); - } - Assert.assertEquals(0, test.getFileSize()); - } - - @Test - public void testUniformRepeatedAllocFree() { - FileAllocationTree test = new FileAllocationTree(100, null); - - for (int i = 1; i < 100; i++) { - int count = (int) Math.floor(100d / i); - for (int j = 1; j <= count; j++) { - List regions = new ArrayList(); - for (int k = 0; k < j; k++) { - Region r = test.alloc(i); - Assert.assertEquals("Testing " + j + " Regions of size " + i + ": Alloc " + k, i, r.size()); - Assert.assertEquals("Testing " + j + " Regions of size " + i + ": Alloc " + k, k * i, r.start()); - regions.add(r); - } - for (Region r : regions) { - test.free(r); - } - Assert.assertEquals("Testing " + j + " Regions of size " + i, 0, test.getFileSize()); - } - } - } - - @Test - public void testRandomAllocFree() { - for (int n = 0; n < 100; n++) { - FileAllocationTree test = new FileAllocationTree(10000, null); - BitSet reference = new BitSet(); - Random rndm = new Random(); - - for (int i = 0; i < 100; i++) { - if (rndm.nextBoolean()) { - Region r = test.alloc(rndm.nextInt(100)); - BitSet ref = reference.get((int) r.start(), (int) r.end() + 1); - reference.set((int) r.start(), (int) r.end() + 1); - } else { - int length = reference.length(); - if (length > 0) { - int random = rndm.nextInt(length); - int start = reference.nextSetBit(random); - if (start >= 0) { - int max = reference.nextClearBit(start); - int end = start + rndm.nextInt(max - start); - Region r = new Region(start, end); - test.free(r); - reference.clear(start, end + 1); - } - } - } - } - } - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/servermap/servermap-l1-capacity-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/servermap/servermap-l1-capacity-test.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/servermap/servermap-l1-capacity-test.xml (revision 0) @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/wan/WANUtilTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/wan/WANUtilTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/test/java/org/terracotta/modules/ehcache/wan/WANUtilTest.java (revision 0) @@ -1,109 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.wan; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.io.Serializable; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class WANUtilTest { - private static final String CACHE_MANAGER_NAME = "CACHE_MANAGER_NAME"; - private static final String CACHE_NAME = "CACHE_NAME"; - - private WANUtil wanUtil; - private ConcurrentMap cacheConfigMap; - private ConcurrentMap cacheManagerConfigMap; - private boolean testResult; - - @Before - public void setUp() { - cacheConfigMap = new ConcurrentHashMap(); - cacheManagerConfigMap = new ConcurrentHashMap(); - - wanUtil = getTestableWANUtil(); - } - - - @Test - public void testIsWANReadyWhenOrchestratorWasUp() throws Exception { - whenWANReady().callIsWANReady().assertResultIs(true); - } - - @Test - public void testIsWANReadyWhenOrchestratorWasDown() throws Exception { - callIsWANReady().assertResultIs(false); - } - - @Test(expected = IllegalArgumentException.class) - public void testIsWanEnabledCacheForNullParameters() throws Exception { - callIsWanEnabledCache(CACHE_NAME, null).assertResultIs(false); - callIsWanEnabledCache(null, CACHE_MANAGER_NAME).assertResultIs(false); - } - - @Test - public void testIsWanEnabledCacheWhenCacheMarkedWanEnabled() { - whenCacheMarkedWanEnabled().callIsWanEnabledCache(CACHE_MANAGER_NAME, CACHE_NAME).assertResultIs(true); - } - - @Test - public void testaddCurrentOrchestrator() throws Exception { - final String ORCHESTRATOR = "localhost:1000"; - final String WAN_CURRENT_ORCHESTRATOR = "__WAN__CURRENT_ORCHESTRATOR"; - wanUtil.addCurrentOrchestrator(CACHE_MANAGER_NAME, CACHE_NAME, ORCHESTRATOR); - Assert.assertEquals(cacheConfigMap.get(WAN_CURRENT_ORCHESTRATOR), ORCHESTRATOR); - } - - @Test - public void testIsWanEnabledCacheWhenCacheMarkedWanDisabled() throws Exception { - callIsWanEnabledCache(CACHE_MANAGER_NAME, CACHE_NAME).assertResultIs(false); - } - - private WANUtilTest whenCacheMarkedWanEnabled() { - wanUtil.markCacheWanEnabled(CACHE_MANAGER_NAME, CACHE_NAME); - return this; - } - - private WANUtilTest callIsWanEnabledCache(String cacheManagerName, String cacheName) { - testResult = wanUtil.isWanEnabledCache(cacheManagerName, cacheName); - return this; - } - - private WANUtilTest callIsWANReady() { - testResult = wanUtil.isWANReady(CACHE_MANAGER_NAME); - return this; - } - - private WANUtilTest whenWANReady() { - wanUtil.markWANReady(CACHE_MANAGER_NAME); - return this; - } - - private void assertResultIs(boolean expectedResult) { - Assert.assertEquals(expectedResult, testResult); - } - - private WANUtil getTestableWANUtil() { - return new WANUtil(null) { - @Override - ConcurrentMap getCacheConfigMap(String cacheManagerName, String cacheName) { - return cacheConfigMap; - } - - @Override - ConcurrentMap getCacheManagerConfigMap(String cacheManagerName) { - return cacheManagerConfigMap; - } - - @Override - void notifyClients(String cacheManagerName) { - // Do Nothing - } - }; - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentCLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentCLoader.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentCLoader.java (revision 0) @@ -1,65 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.loader; - -import net.sf.ehcache.CacheException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentCLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentCLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentCLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderC"; - } - - /** - * @param key - * @return - * @throws net.sf.ehcache.CacheException - */ - public Object load(Object key) throws CacheException { - LOG.info("Loading Component C({})", key); - return new ComponentC(key); - } - - @Override - public Map loadAll(Collection keys, Object argument) throws CacheException { - Map result = new HashMap(); - - for (Object key : keys) { - result.put(key, load(key)); - } - - return result; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SlewClock.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SlewClock.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/SlewClock.java (revision 0) @@ -1,154 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.util; - -import net.sf.ehcache.util.lang.VicariousThreadLocal; - -import java.util.concurrent.atomic.AtomicLong; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SlewClock will return the current time in millis, but will never go back in time. - * If it detects that a back movement in time, it will slew the results while keeping them incrementing until time has caught up - * - * @author Chris Denis - * @author Alex Snaps - */ -final class SlewClock { - - private static final Logger LOG = LoggerFactory.getLogger(SlewClock.class); - - private static final TimeProvider PROVIDER = TimeProviderLoader.getTimeProvider(); - - private static final long DRIFT_MAXIMAL = Integer.getInteger("net.sf.ehcache.util.Timestamper.drift.max", 50); - - private static final long SLEEP_MAXIMAL = Integer.getInteger("net.sf.ehcache.util.Timestamper.sleep.max", 50); - - private static final int SLEEP_BASE = Integer.getInteger("net.sf.ehcache.util.Timestamper.sleep.min", 25); - - private static final AtomicLong CURRENT = new AtomicLong(Long.MIN_VALUE); - - private static final VicariousThreadLocal OFFSET = new VicariousThreadLocal(); - - private SlewClock() { - // You shall not instantiate me! - } - - /** - * For testing purposes, you probably never want to use this. - * This method will resync, basically resetting any on going slewing, its internal clock tracking with whatever value - * the provider seeds it with. - * - * @deprecated - */ - @Deprecated - static void realignWithTimeProvider() { - CURRENT.set(getCurrentTime()); - } - - /** - * Will return the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. - * But without ever going back. If a movement back in time is detected, the method will slew until time caught up - * @return The difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. - */ - static long timeMillis() { - boolean interrupted = false; - try { - while (true) { - long mono = CURRENT.get(); - long wall = getCurrentTime(); - if (wall == mono) { - OFFSET.remove(); - return wall; - } else if (wall > mono) { - if (CURRENT.compareAndSet(mono, wall)) { - OFFSET.remove(); - return wall; - } - } else { - long delta = mono - wall; - if (delta < DRIFT_MAXIMAL) { - OFFSET.remove(); - return mono; - } else { - Long lastDelta = OFFSET.get(); - if (lastDelta == null || delta < lastDelta) { - if (CURRENT.compareAndSet(mono, mono + 1)) { - OFFSET.set(Long.valueOf(delta)); - return mono + 1; - } - } else { - OFFSET.set(Long.valueOf(Math.max(delta, lastDelta))); - try { - long sleep = sleepTime(delta, lastDelta); - LOG.trace("{} sleeping for {}ms to adjust for wall-clock drift.", Thread.currentThread(), sleep); - Thread.sleep(sleep); - } catch (InterruptedException e) { - interrupted = true; - } - } - } - } - } - } finally { - if (interrupted) { - Thread.currentThread().interrupt(); - } - } - } - - /** - * Verifies whether the current thread is currently catching up on time. - * To be meaning full, this method has to be called after the thread has called {@link #timeMillis()} at least once - * @return true if the thread is being marked as catching up on time - */ - static boolean isThreadCatchingUp() { - return OFFSET.get() != null; - } - - /** - * The method will check how much behind is the current thread compared to the wall clock since the last {@link #timeMillis()} call. - * To be meaning full, this method has to be called after the thread has called {@link #timeMillis()} at least once - * @return the amount of milliseconds the thread is behind the wall clock, 0 if none. - */ - static long behind() { - Long offset = OFFSET.get(); - return offset == null ? 0 : offset; - } - - private static long sleepTime(final long current, final long previous) { - long target = SLEEP_BASE + (current - previous) * 2; - return Math.min(target > 0 ? target : SLEEP_BASE, SLEEP_MAXIMAL); - } - - private static long getCurrentTime() { - return PROVIDER.currentTimeMillis(); - } - - /** - * Defines how the {@link SlewClock} utility class will get to the wall clock - */ - interface TimeProvider { - - /** - * @return the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC. - */ - long currentTimeMillis(); - - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache/src/main/resources/META-INF/terracotta/public-api-types =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache/src/main/resources/META-INF/terracotta/public-api-types (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache/src/main/resources/META-INF/terracotta/public-api-types (revision 0) @@ -1 +0,0 @@ -# Don't remove this line -- if file is empty then everything will become an API type Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheManagerEventListenerRegistry.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheManagerEventListenerRegistry.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/event/CacheManagerEventListenerRegistry.java (revision 0) @@ -1,201 +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.event; - -import java.util.Iterator; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArraySet; - -import net.sf.ehcache.Status; - -/** - * Registered listeners for registering and unregistering CacheManagerEventListeners and sending notifications to registrants. - *

- * There is one of these per CacheManager. It is a composite listener. - * - * @author Greg Luck - * @version $Id: CacheManagerEventListenerRegistry.java 10789 2018-04-26 02:08:13Z adahanne $ - * @since 1.3 - */ -public class CacheManagerEventListenerRegistry implements CacheManagerEventListener { - - private volatile Status status; - - /** - * A Set of CacheEventListeners keyed by listener instance. - * CacheEventListener implementations that will be notified of this cache's events. - * - * @see CacheManagerEventListener - */ - private Set listeners; - - /** - * Construct a new registry - */ - public CacheManagerEventListenerRegistry() { - status = Status.STATUS_UNINITIALISED; - listeners = new CopyOnWriteArraySet(); - } - - /** - * Adds a listener to the notification service. No guarantee is made that listeners will be - * notified in the order they were added. - * - * @param cacheManagerEventListener the listener to add. Can be null, in which case nothing happens - * @return true if the listener is being added and was not already added - */ - public final boolean registerListener(CacheManagerEventListener cacheManagerEventListener) { - if (cacheManagerEventListener == null) { - return false; - } - return listeners.add(cacheManagerEventListener); - } - - /** - * Removes a listener from the notification service. - * - * @param cacheManagerEventListener the listener to remove - * @return true if the listener was present - */ - public final boolean unregisterListener(CacheManagerEventListener cacheManagerEventListener) { - return listeners.remove(cacheManagerEventListener); - } - - /** - * Returns whether or not at least one cache manager event listeners has been registered. - * - * @return true if a one or more listeners have registered, otherwise false - */ - public boolean hasRegisteredListeners() { - return listeners.size() > 0; - } - - /** - * Gets a Set of the listeners registered to this class - * - * @return a set of type CacheManagerEventListener - */ - public Set getRegisteredListeners() { - return listeners; - } - - /** - * Initialises the listeners, ready to receive events. - */ - public void init() { - //init once - Iterator iterator = listeners.iterator(); - while (iterator.hasNext()) { - CacheManagerEventListener cacheManagerEventListener = (CacheManagerEventListener) iterator.next(); - cacheManagerEventListener.init(); - } - status = Status.STATUS_ALIVE; - } - - /** - * Returns the listener status. - * - * @return the status at the point in time the method is called - */ - public Status getStatus() { - return status; - } - - /** - * Tell listeners to dispose themselves. - * Because this method is only ever called from a synchronized cache method, it does not itself need to be - * synchronized. - */ - public void dispose() { - Iterator iterator = listeners.iterator(); - while (iterator.hasNext()) { - CacheManagerEventListener cacheManagerEventListener = (CacheManagerEventListener) iterator.next(); - cacheManagerEventListener.dispose(); - } - listeners.clear(); - status = Status.STATUS_SHUTDOWN; - } - - /** - * Called immediately after a cache has been added and activated. - *

- * Note that the CacheManager calls this method from a synchronized method. Any attempt to - * call a synchronized method on CacheManager from this method will cause a deadlock. - *

- * Note that activation will also cause a CacheEventListener status change notification - * from {@link net.sf.ehcache.Status#STATUS_UNINITIALISED} to - * {@link net.sf.ehcache.Status#STATUS_ALIVE}. Care should be taken on processing that - * notification because: - *

    - *
  • the cache will not yet be accessible from the CacheManager. - *
  • the addCaches methods which cause this notification are synchronized on the - * CacheManager. An attempt to call {@link net.sf.ehcache.CacheManager#getEhcache(String)} - * will cause a deadlock. - *
- * The calling method will block until this method returns. - *

- * - * @param cacheName the name of the Cache the operation relates to - * @see CacheEventListener - */ - public void notifyCacheAdded(String cacheName) { - Iterator iterator = listeners.iterator(); - while (iterator.hasNext()) { - CacheManagerEventListener cacheManagerEventListener = (CacheManagerEventListener) iterator.next(); - cacheManagerEventListener.notifyCacheAdded(cacheName); - } - } - - /** - * Called immediately after a cache has been disposed and removed. The calling method will - * block until this method returns. - *

- * Note that the CacheManager calls this method from a synchronized method. Any attempt to - * call a synchronized method on CacheManager from this method will cause a deadlock. - *

- * Note that a {@link CacheEventListener} status changed will also be triggered. Any - * attempt from that notification to access CacheManager will also result in a deadlock. - * - * @param cacheName the name of the Cache the operation relates to - */ - public void notifyCacheRemoved(String cacheName) { - Iterator iterator = listeners.iterator(); - while (iterator.hasNext()) { - CacheManagerEventListener cacheManagerEventListener = (CacheManagerEventListener) iterator.next(); - cacheManagerEventListener.notifyCacheRemoved(cacheName); - } - } - - /** - * Returns a string representation of the object. In general, the - * toString method returns a string that - * "textually represents" this object. The result should - * be a concise but informative representation that is easy for a - * person to read. - * - * @return a string representation of the object. - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(" cacheManagerEventListeners: "); - for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { - CacheManagerEventListener cacheManagerEventListener = (CacheManagerEventListener) iterator.next(); - sb.append(cacheManagerEventListener.getClass().getName()).append(" "); - } - return sb.toString(); - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/hibernate-config/nontransactional/domain/HolidayCalendar.hbm.xml (revision 0) @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SoftLockManagerProvider.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SoftLockManagerProvider.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/SoftLockManagerProvider.java (revision 0) @@ -1,96 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.transaction; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListener; -import net.sf.ehcache.transaction.SoftLockManager; - -import org.terracotta.modules.ehcache.ToolkitInstanceFactory; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -public class SoftLockManagerProvider { - private final ConcurrentMap softLockFactories = new ConcurrentHashMap(); - private final ToolkitInstanceFactory toolkitInstanceFactory; - - public SoftLockManagerProvider( - ToolkitInstanceFactory toolkitInstanceFactory) { - this.toolkitInstanceFactory = toolkitInstanceFactory; - } - - public SoftLockManager getOrCreateClusteredSoftLockFactory(Ehcache cache) { - String name = toolkitInstanceFactory.getFullyQualifiedCacheName(cache); - SoftLockManager softLockFactory = softLockFactories.get(name); - if (softLockFactory == null) { - softLockFactory = new ReadCommittedClusteredSoftLockFactory(toolkitInstanceFactory, cache.getCacheManager() - .getName(), cache.getName()); - SoftLockManager old = softLockFactories.putIfAbsent(name, softLockFactory); - if (old == null) { - // Put successful add a Cache Event Listener. - cache.getCacheEventNotificationService().registerListener(new EventListener(name)); - } else { - softLockFactory = old; - } - } - return softLockFactory; - } - - private void disposeSoftLockFactory(String fullyQualifiedCacheName) { - softLockFactories.remove(fullyQualifiedCacheName); - } - - private class EventListener implements CacheEventListener { - private final String fullyQualifiedCacheName; - - private EventListener(String fullyQualifiedCacheName) { - this.fullyQualifiedCacheName = fullyQualifiedCacheName; - } - - @Override - public void dispose() { - disposeSoftLockFactory(fullyQualifiedCacheName); - } - - @Override - public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException { - // DO Nothing - } - - @Override - public void notifyElementPut(Ehcache cache, Element element) throws CacheException { - // DO Nothing - } - - @Override - public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException { - // DO Nothing - } - - @Override - public void notifyElementExpired(Ehcache cache, Element element) { - // DO Nothing - } - - @Override - public void notifyElementEvicted(Ehcache cache, Element element) { - // DO Nothing - } - - @Override - public void notifyRemoveAll(Ehcache cache) { - // DO Nothing - } - - @Override - public EventListener clone() throws CloneNotSupportedException { - return (EventListener) super.clone(); - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/OtherClassLoaderEventClient2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/OtherClassLoaderEventClient2.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/OtherClassLoaderEventClient2.java (revision 0) @@ -1,136 +0,0 @@ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; - -import org.terracotta.toolkit.Toolkit; - -import com.otherclassloader.Client; -import com.otherclassloader.Value; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Arrays; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.atomic.AtomicReference; - -public class OtherClassLoaderEventClient2 extends ClientBase { - - public OtherClassLoaderEventClient2(String[] args) { - super("test", args); - } - - public static void main(String[] args) { - new OtherClassLoaderEventClient2(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit toolkit) throws Throwable { - - String config = cache.getCacheManager().getActiveConfigurationText(); - - // This loader simulates ehcache in an isolated loader (similiar to an osgi bundle) - ClassLoader parentLoader = null; - boolean isPreJava9 = System.getProperty("java.specification.version").contains("."); - if (!isPreJava9) { - parentLoader = (ClassLoader)ClassLoader.class.getMethod("getPlatformClassLoader").invoke(null); - } - EhcacheLoader ehcacheLoader = new EhcacheLoader(parentLoader); - - // make sure the "app" types not visible to loader where ehcache is running - try { - ehcacheLoader.loadClass(Value.class.getName()); - throw new AssertionError(); - } catch (ClassNotFoundException cnfe) { - // expected - } - - // The "app" loader is like an applicatoin bundle that imports ehcache - AppLoader appLoader = new AppLoader(ehcacheLoader); - Thread.currentThread().setContextClassLoader(appLoader); - - Class clientClass = appLoader.loadClass(Client.class.getName()); - final CyclicBarrier localBarrier = new CyclicBarrier(2); - final Runnable client = (Runnable) clientClass.getConstructor(String.class, CyclicBarrier.class) - .newInstance(config, localBarrier); - final AtomicReference error = new AtomicReference(); - Thread thread = new Thread() { - @Override - public void run() { - try { - client.run(); - } catch (Throwable t) { - t.printStackTrace(); - error.set(t); - } - } - }; - thread.start(); - - localBarrier.await(); - getBarrierForAllClients().await(); - - thread.join(); - if (error.get() != null) { throw error.get(); } - } - - private static URL[] getSystemUrls() { - String pathSeparator = System.getProperty("path.separator"); - String[] classPathEntries = System.getProperty("java.class.path").split(pathSeparator); - return Arrays.stream(classPathEntries).map(s -> { - try { - return new File(s).toURI().toURL(); - } catch (MalformedURLException e) { - e.printStackTrace(); - return null; - } - }).toArray(URL[]::new); - } - - static class EhcacheLoader extends URLClassLoader { - EhcacheLoader(ClassLoader parentLoader) { - super(getSystemUrls(), parentLoader); - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException { - // hide "app" classes from loader used to load ehcache - if (name.startsWith("com.otherclassloader.")) { throw new ClassNotFoundException(name); } - - return super.findClass(name); - } - - } - - static class AppLoader extends ClassLoader { - - AppLoader(EhcacheLoader ehcacheLoader) { - super(ehcacheLoader); - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException { - if (name.startsWith("com.otherclassloader.")) { - InputStream in = ClassLoader.getSystemClassLoader() - .getResourceAsStream(name.replace('.', '/').concat(".class")); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - try { - while (in.available() > 0) { - baos.write(in.read()); - } - byte[] data = baos.toByteArray(); - return defineClass(name, data, 0, data.length); - } catch (IOException ioe) { - throw new ClassNotFoundException(name, ioe); - } - } - throw new ClassNotFoundException(name); - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/checkstyle/checkstyle.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/checkstyle/checkstyle.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-scheduled-refresh/checkstyle/checkstyle.xml (revision 0) @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/package.html (revision 0) @@ -1,5 +0,0 @@ - - - This package contains JMX related classes for Hibernate and ehcache statistics - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/util/LargeCollectionTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/util/LargeCollectionTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/util/LargeCollectionTest.java (revision 0) @@ -1,122 +0,0 @@ -package net.sf.ehcache.util; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import junit.framework.Assert; - -import org.junit.Test; - -public class LargeCollectionTest { - - @Test - public void testIteration() throws IOException { - - AggregateIterator iterator = newIterator(); - int i = 0; - while (iterator.hasNext()) { - String s = iterator.next(); - Assert.assertNotSame("key1", s); - Assert.assertNotSame("key2", s); - i++; - } - Assert.assertEquals(198, i); - - LargeSet set = new LargeSet() { - - @Override - public Iterator sourceIterator() { - return newIterator(); - } - - @Override - public int sourceSize() { - return 198; - } - - }; - - Assert.assertEquals(198, set.size()); - - HashSet additionalSet = new HashSet(); - - for (int j = 0; j < 100; j++) { - additionalSet.add("keyb" + j); - } - - HashSet removeSet = new HashSet(); - - for (int j = 0; j < 50; j++) { - removeSet.add("keyb" + j); - } - - int beforeSize = set.size(); - set.addAll(additionalSet); - set.removeAll(removeSet); - - Assert.assertEquals(beforeSize + 50, set.size()); -// iterator = newIterator(); -// while(iterator.hasNext()) { -// iterator.next(); -// iterator.remove(); -// } - - - } - - private AggregateIterator newIterator() { - HashSet removeSet = new HashSet(); - removeSet.add("key1"); - removeSet.add("key2"); - - HashSet sourceSet1 = new HashSet(); - for (int i = 0; i < 100; i++) { - sourceSet1.add("key" + i); - } - - HashSet sourceSet2 = new HashSet(); - for (int i = 0; i < 100; i++) { - sourceSet1.add("keya" + i); - } - List sources = new ArrayList(4); - sources.add(sourceSet1.iterator()); - sources.add(sourceSet2.iterator()); - - AggregateIterator iterator = new AggregateIterator(removeSet, sources); - return iterator; - } - - @Test - public void testSize() throws Exception { - final Set authority = new HashSet(); - authority.add("1"); - authority.add("2"); - authority.add("3"); - - Set set = new LargeSet() { - @Override - public Iterator sourceIterator() { - return authority.iterator(); - } - - @Override - public int sourceSize() { - return authority.size(); - } - }; - - Assert.assertEquals(3, set.size()); - set.remove("1"); - set.remove("2"); - Assert.assertEquals(1, set.size()); - authority.remove("2"); - authority.remove("3"); - Assert.assertEquals(0, set.size()); - - - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/hibernate-config/nontransactional/hibernate.cfg.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/resources/hibernate-config/nontransactional/hibernate.cfg.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/AbstractStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/AbstractStatistic.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/AbstractStatistic.java (revision 0) @@ -1,91 +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 net.sf.ehcache.statistics.extended.ExtendedStatistics.Statistic; - -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class AbstractStatistic. - * - * @param the generic type - * @author cdennis - */ -abstract class AbstractStatistic implements Statistic { - - /** The source. */ - private final ValueStatistic source; - - /** The history. */ - private final SampledStatistic history; - - /** - * Instantiates a new abstract statistic. - * - * @param executor the executor - * @param historySize the history size - * @param historyNanos the history nanos - */ - AbstractStatistic(ValueStatistic source, ScheduledExecutorService executor, int historySize, long historyNanos) { - this.source = source; - this.history = new SampledStatistic(source, executor, historySize, historyNanos); - } - - /** - * {@inheritDoc} - */ - @Override - public T value() { - return source.value(); - } - - /** - * {@inheritDoc} - */ - @Override - public List> history() { - return history.history(); - } - - /** - * Start sampling. - */ - final void startSampling() { - history.startSampling(); - } - - /** - * Stop sampling. - */ - final void stopSampling() { - history.stopSampling(); - } - - /** - * Sets the history. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - final void setHistory(int historySize, long historyNanos) { - history.adjust(historySize, historyNanos); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/BatchOperation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/BatchOperation.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CacheUsageListener.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CacheUsageListener.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CacheUsageListener.java (revision 0) @@ -1,150 +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; - -/** - * Interface for listeners to any change in usage statistics of an - * Ehcache. - * - *

- * Implementations of this interface should implement the {@link Object#equals(Object)} and the {@link Object#hashCode()} as registering and - * removing listeners depends on these - *

- * - * @author Abhishek Sanoujam - * @since 1.7 - */ -public interface CacheUsageListener { - - /** - * Called on a cache hit in the MemoryStore - */ - void notifyCacheHitInMemory(); - - /** - * Called on a cache hit in the off-heap store - */ - void notifyCacheHitOffHeap(); - - /** - * Called on a cache hit in the DiskStore - */ - void notifyCacheHitOnDisk(); - - /** - * Called when an element is inserted in the cache - */ - void notifyCacheElementPut(); - - /** - * Called when an element is updated in the cache, i.e. a put for an already - * existing key - */ - void notifyCacheElementUpdated(); - - /** - * Called when an element is not found in the cache - */ - void notifyCacheMissedWithNotFound(); - - /** - * Called on a cache miss in the MemoryStore - */ - void notifyCacheMissInMemory(); - - /** - * Called on a cache miss in the off-heap store - */ - void notifyCacheMissOffHeap(); - - /** - * Called on a cache miss in the DiskStore - */ - void notifyCacheMissOnDisk(); - - /** - * Called when an element is found in the cache but already expired - */ - void notifyCacheMissedWithExpired(); - - /** - * Notified with time taken for a get operation in the cache - * - * DEPRECATED: use notifyGetTimeNanos(long) - * - * @param millis - * @deprecated - */ - @Deprecated - void notifyTimeTakenForGet(final long millis); - - /** - * Notified with time taken for a get operation in the cache - * - * @param nanos - */ - void notifyGetTimeNanos(final long nanos); - - /** - * Called when an element is expired in the cache - */ - void notifyCacheElementEvicted(); - - /** - * Called when an element in the cache expires - */ - void notifyCacheElementExpired(); - - /** - * Called when an element is removed from the cache - */ - void notifyCacheElementRemoved(); - - /** - * Called when Cache.removeAll() is called - */ - void notifyRemoveAll(); - - /** - * Notified when the statistics accuracy is changed. - * - * @param statisticsAccuracy the statistics accuracy - */ - void notifyStatisticsAccuracyChanged(int statisticsAccuracy); - - /** - * Called to dispose off the listener - */ - void dispose(); - - /** - * Called when a search finishes execution - * - * @param executeTime elapsed time in millis - */ - void notifyCacheSearch(long executeTime); - - /** - * Called when the Cache's XAResource has been asked to commit - */ - void notifyXaCommit(); - - /** - * Called when the Cache's XAResource has been asked to rollback - */ - void notifyXaRollback(); - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/checkstyle/ClassHeader.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/checkstyle/ClassHeader.txt (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/checkstyle/ClassHeader.txt (revision 0) @@ -1,15 +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. - */ Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/terracotta/ehcache-tc-embedded.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/terracotta/ehcache-tc-embedded.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/BTMTwoResourceTx1.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/BTMTwoResourceTx1.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/package.html (revision 0) @@ -1,7 +0,0 @@ - - - - -This package contains annotations to control SizeOf calculations for the pooling in Ehcache. - - Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/LockGCNotFlushingEntriesTestClient.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/LockGCNotFlushingEntriesTestClient.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/LockGCNotFlushingEntriesTestClient.java (revision 0) @@ -1,40 +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; - -public class LockGCNotFlushingEntriesTestClient extends ServerMapClientBase { - - public LockGCNotFlushingEntriesTestClient(String[] args) { - super("testLockGC", args); - } - - public static void main(String[] args) { - new LockGCNotFlushingEntriesTestClient(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 < 1000; i++) { - cache.put(new Element("key-" + i, "value-" + i)); - } - - System.out.println("Cache populated. Sleeping for 120 secs. size: " + cache.getSize() + " inMemorySize: " - + cache.getStatistics().getLocalHeapSize()); - Thread.sleep(120 * 1000); - - System.out.println("After sleeping 120 secs. size: " + cache.getSize() + " inMemorySize: " - + cache.getStatistics().getLocalHeapSize()); - // assert range as some may have got evicted while populating cache - assertTrue(1000 == cache.getSize()); - assertTrue(1000 == cache.getStatistics().getLocalHeapSize()); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/CacheEntryFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/CacheEntryFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/CacheEntryFactory.java (revision 0) @@ -1,37 +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; - - -/** - * Creates objects to populate the cache. - * @version $Id: CacheEntryFactory.java 5594 2012-05-07 16:04:31Z cdennis $ - * @author Greg Luck - */ -public interface CacheEntryFactory { - /** - * Creates the cacheEntry for the given cache key. - * - * ehcache requires cache entries to be serializable. - * - * Note that this method must be thread safe. - * - * @return The entry, or null if it does not exist. - * @throws Exception On failure creating the object. - */ - Object createEntry(Object key) throws Exception; -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/coherence/RestartingL1ExpressTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/coherence/RestartingL1ExpressTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/coherence/RestartingL1ExpressTest.java (revision 0) @@ -1,131 +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.coherence; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; -import com.tc.util.runtime.Os; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; - -public class RestartingL1ExpressTest extends AbstractCacheTestBase { - - public static final int CLIENT_COUNT = 3; - public static final String SHOULD_CRASH = "shouldCrash"; - public static final String AFTER_RESTART = "afterRestart"; - - public RestartingL1ExpressTest(TestConfig testConfig) { - super("basic-cache-test.xml", testConfig, RestartingL1ExpressClient.class); - - if (Os.isWindows()) { - disableTest(); - } - } - - @Override - protected void startClients() throws Throwable { - // n nodes start in coherent, then setCoherent(false) - // assert coherent=false in all n nodes - // n-1 nodes call setCoherent(true) - // 1 node exits without calling setCoherent(true) - // n-1 nodes assert coherent - // 1 node restarts, asserts cache coherent - // java RestartingL1ExpressClient -> (no-args), n-1 nodes, does not crash - // java RestartingL1ExpressClient shouldCrash -> (one arg), 1 node, exits this node without calling - // setCoherent(true) - // java RestartingL1ExpressClient shouldCrash afterRestart -> (two args), 1 node, restarts and asserts cache - // coherent - Runner[] runners = new Runner[CLIENT_COUNT]; - for (int i = 0; i < runners.length; i++) { - if (i == 0) { - // start the restarting client - runners[i] = new Runner(RestartingL1ExpressClient.class, "restart-crasher-client"); - runners[i].addClientArg(SHOULD_CRASH); - } else { - runners[i] = new Runner(RestartingL1ExpressClient.class, "restart-normal-client-" + (i - 1)); - } - } - for (Runner runner : runners) { - runner.start(); - } - System.out.println("Waiting for first client to finish"); - // wait for first client to exit - runners[0].finish(); - System.out.println("done with first client"); - - // restart this client in restart - Runner runner0 = runners[0] = new Runner(RestartingL1ExpressClient.class, "restart-afterRestart-client"); - runner0.addClientArg(SHOULD_CRASH); - runner0.addClientArg(AFTER_RESTART); - runner0.start(); - - for (Runner runner : runners) { - runner.finish(); - } - } - - @Override - protected void evaluateClientOutput(String clientName, int exitCode, File output) throws Throwable { - super.evaluateClientOutput(clientName, exitCode, output); - - FileReader fr = null; - try { - fr = new FileReader(output); - BufferedReader reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - if (st.contains(RestartingL1ExpressClient.PASS_OUTPUT)) return; - } - throw new AssertionError("Client exited without pass output string: " + RestartingL1ExpressClient.PASS_OUTPUT); - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - } catch (Exception e) { - // - } - } - } - - private class Runner extends Thread { - - private final AtomicReference error = new AtomicReference(); - private final Class clientClass; - private final String clientName; - private final List extraClientArgs; - - public Runner(Class clientClass, String clientName) { - this.clientClass = clientClass; - this.clientName = clientName; - this.extraClientArgs = new ArrayList(); - } - - @Override - public void run() { - try { - runClient(clientClass, clientName, extraClientArgs); - } catch (Throwable t) { - error.set(t); - } - } - - public void finish() throws Throwable { - join(); - Throwable t = error.get(); - if (t != null) throw t; - } - - public void addClientArg(String arg) { - extraClientArgs.add(arg); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CountingCacheLoaderFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/loader/CountingCacheLoaderFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/management/ManagementServerLoaderTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/management/ManagementServerLoaderTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/test/resources/terracotta/ehcache-terracotta-jms.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/terracotta/ehcache-terracotta-jms.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/resources/terracotta/ehcache-terracotta-jms.xml (revision 0) @@ -1,15 +0,0 @@ - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache/src/test/resources/serializedforms/SerializedReadCommittedClusteredSoftLockSerializationTest.testBasic.ser =================================================================== diff -u -N -r11494 -r11522 Binary files differ Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/XATransactionalStoreTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/XATransactionalStoreTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/XATransactionalStoreTest.java (revision 0) @@ -1,415 +0,0 @@ -package net.sf.ehcache.store; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import javax.transaction.RollbackException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.concurrent.CacheLockProvider; -import net.sf.ehcache.concurrent.LockType; -import net.sf.ehcache.config.CacheConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import bitronix.tm.TransactionManagerServices; -import net.sf.ehcache.config.Configuration; - -/** - * @author Alex Snaps - */ -@Category(CheckShorts.class) -public class XATransactionalStoreTest { - - private TransactionManager transactionManager; - private Cache cach1; - private Cache cache; - private CacheManager cacheManager; - - @Before - public void setup() throws Exception { - TransactionManagerServices.getConfiguration().setServerId("XATransactionalStoreTest").setJournal("null"); - transactionManager = TransactionManagerServices.getTransactionManager(); - - Configuration configuration = new Configuration(); - configuration.cache(new CacheConfiguration("xaCache", 1000).transactionalMode(CacheConfiguration.TransactionalMode.XA_STRICT)); - configuration.cache(new CacheConfiguration("otherXaCache", 1000).transactionalMode(CacheConfiguration.TransactionalMode.XA_STRICT)); - cacheManager = new CacheManager(configuration); - - cache = cacheManager.getCache("xaCache"); - cach1 = cacheManager.getCache("otherXaCache"); - - transactionManager.begin(); - cache.removeAll(); - cach1.removeAll(); - transactionManager.commit(); - } - - @After - public void tearDown() throws Exception { - cacheManager.shutdown(); - TransactionManagerServices.getTransactionManager().shutdown(); - } - - @Test - public void testPutIfAbsent() throws Exception { - transactionManager.begin(); - assertEquals("Cache should be empty to start", 0, cache.getSize()); - assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); - assertNull(cach1.putIfAbsent(new Element("key", "value1"))); - assertNull(cache.putIfAbsent(new Element("key", "value1"))); - Transaction tx1 = transactionManager.suspend(); - transactionManager.begin(); - assertNull(cache.putIfAbsent(new Element("key", "value2"))); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("This should have thrown an Exception, as the putIfAbsent should have failed!"); - } catch (RollbackException e) { - // Expected - } - - CacheLockProvider clp = (CacheLockProvider) cache.getInternalContext(); - assertFalse(clp.getSyncForKey("key").isHeldByCurrentThread(LockType.WRITE)); - - transactionManager.begin(); - Element element = cache.get("key"); - assertEquals("value2", element.getValue()); - assertNull(cach1.get("key")); - assertEquals(element, cache.putIfAbsent(new Element("key", "value3"))); - transactionManager.commit(); - - transactionManager.begin(); - element = cache.get("key"); - assertEquals("value2", element.getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key2", "randomValue")); - cache.putIfAbsent(new Element("key2", "notThere!")); - assertEquals("randomValue", cache.get("key2").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - assertEquals("randomValue", cache.get("key2").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cach1.remove("key2"); - cache.remove("key2"); - cache.putIfAbsent(new Element("key2", "nowThere!")); - assertEquals("nowThere!", cache.get("key2").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - assertEquals("nowThere!", cache.get("key2").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.remove("key2"); - cache.putIfAbsent(new Element("key2", "nowThere!")); - assertEquals("nowThere!", cache.get("key2").getValue()); - Transaction tx2 = transactionManager.suspend(); - - transactionManager.begin(); - assertEquals("nowThere!", cache.get("key2").getValue()); - cache.put(new Element("key2", "newValue")); - transactionManager.commit(); - - transactionManager.resume(tx2); - cach1.put(new Element("fake", "entry")); - try { - transactionManager.commit(); - fail("This should have thrown an Exception!"); - } catch (RollbackException e) { - // Expected - } - - transactionManager.begin(); - assertEquals("newValue", cache.get("key2").getValue()); - transactionManager.commit(); - } - - @Test - public void testRemoveElement() throws Exception { - transactionManager.begin(); - assertEquals("Cache should be empty to start", 0, cache.getSize()); - assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); - assertFalse(cache.removeElement(new Element("blah", "someValue"))); - cache.put(new Element("blah", "value")); - assertFalse(cache.removeElement(new Element("blah", "someValue"))); - transactionManager.commit(); - transactionManager.begin(); - assertNotNull(cache.get("blah")); - assertTrue(cache.removeElement(new Element("blah", "value"))); - transactionManager.commit(); - transactionManager.begin(); - assertNull(cache.get("blah")); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.removeElement(new Element("key", "value")); - Transaction tx1 = transactionManager.suspend(); - transactionManager.begin(); - assertTrue(cache.removeElement(new Element("key", "value"))); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element is deleted already"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNull(cache.get("key")); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.removeElement(new Element("key", "value")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "newValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element has changed in the meantime!"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertEquals("newValue", cache.get("key").getValue()); - transactionManager.commit(); - } - - @Test - public void testReplace() throws Exception { - transactionManager.begin(); - assertEquals("Cache should be empty to start", 0, cache.getSize()); - assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); - assertNull(cache.replace(new Element("blah", "someValue"))); - cache.put(new Element("blah", "value")); - assertNotNull(cache.replace(new Element("blah", "someValue"))); - transactionManager.commit(); - transactionManager.begin(); - assertNotNull(cache.get("blah")); - assertEquals("someValue", cache.get("blah").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "newValue")); - Transaction tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.remove("key"); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element is deleted already"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNull(cache.get("key")); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "newValue")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "allNewValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element is deleted already"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertNotNull("allNewValue", cache.get("key").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "newValue")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "allNewValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element value has changed"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertNotNull("allNewValue", cache.get("key").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "value")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "newValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element has changed in the meantime!"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertEquals("newValue", cache.get("key").getValue()); - transactionManager.commit(); - } - - @Test - public void testReplaceElement() throws Exception { - transactionManager.begin(); - assertEquals("Cache should be empty to start", 0, cache.getSize()); - assertEquals("Cach1 should be empty to start", 0, cach1.getSize()); - assertFalse(cache.replace(new Element("blah", "someValue"), new Element("blah", "someOtherValue"))); - cache.put(new Element("blah", "value")); - assertTrue(cache.replace(new Element("blah", "value"), new Element("blah", "someValue"))); - transactionManager.commit(); - transactionManager.begin(); - assertNotNull(cache.get("blah")); - assertEquals("someValue", cache.get("blah").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - assertEquals("someValue", cache.get("blah").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "value"), new Element("key", "newValue")); - Transaction tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.remove("key"); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element is deleted already"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNull(cache.get("key")); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - assertFalse(cache.replace(new Element("key", "wrongValue"), new Element("key", "newValue"))); - assertTrue(cache.replace(new Element("key", "value"), new Element("key", "newValue"))); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "allNewValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element's value has changed"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertNotNull("allNewValue", cache.get("key").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "value"), new Element("key", "newValue")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "allNewValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element is deleted already"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertNotNull("allNewValue", cache.get("key").getValue()); - transactionManager.commit(); - - transactionManager.begin(); - cache.put(new Element("key", "value")); - transactionManager.commit(); - transactionManager.begin(); - cach1.put(new Element("random", "things")); - cache.replace(new Element("key", "value"), new Element("key", "wrongValue")); - tx1 = transactionManager.suspend(); - transactionManager.begin(); - cache.put(new Element("key", "newValue")); - transactionManager.commit(); - transactionManager.resume(tx1); - try { - transactionManager.commit(); - fail("Transaction should have failed, element has changed in the meantime!"); - } catch (RollbackException e) { - // Expected - } - transactionManager.begin(); - assertNotNull(cache.get("key")); - assertEquals("newValue", cache.get("key").getValue()); - transactionManager.commit(); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/strategy/NonStrictReadWriteEhcacheEntityRegionAccessStrategy.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/strategy/NonStrictReadWriteEhcacheEntityRegionAccessStrategy.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/strategy/NonStrictReadWriteEhcacheEntityRegionAccessStrategy.java (revision 0) @@ -1,120 +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.strategy; - -import net.sf.ehcache.hibernate.regions.EhcacheEntityRegion; - -import org.hibernate.cache.CacheException; -import org.hibernate.cache.EntityRegion; -import org.hibernate.cache.access.EntityRegionAccessStrategy; -import org.hibernate.cache.access.SoftLock; -import org.hibernate.cfg.Settings; - -/** - * Ehcache specific non-strict read/write entity region access strategy - * - * @author Chris Dennis - */ -public class NonStrictReadWriteEhcacheEntityRegionAccessStrategy extends AbstractEhcacheAccessStrategy - implements EntityRegionAccessStrategy { - - /** - * Create a non-strict read/write access strategy accessing the given collection region. - */ - public NonStrictReadWriteEhcacheEntityRegionAccessStrategy(EhcacheEntityRegion region, Settings settings) { - super(region, settings); - } - - /** - * {@inheritDoc} - */ - public EntityRegion getRegion() { - return region; - } - - /** - * {@inheritDoc} - */ - public Object get(Object key, long txTimestamp) throws CacheException { - return region.get(key); - } - - /** - * {@inheritDoc} - */ - public boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride) - throws CacheException { - if (minimalPutOverride && region.contains(key)) { - return false; - } else { - region.put(key, value); - return true; - } - } - - /** - * Since this is a non-strict read/write strategy item locking is not used. - */ - public SoftLock lockItem(Object key, Object version) throws CacheException { - return null; - } - - /** - * Since this is a non-strict read/write strategy item locking is not used. - */ - public void unlockItem(Object key, SoftLock lock) throws CacheException { - region.remove(key); - } - - /** - * Returns false since this is an asynchronous cache access strategy. - */ - public boolean insert(Object key, Object value, Object version) throws CacheException { - return false; - } - - /** - * Returns false since this is a non-strict read/write cache access strategy - */ - public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - return false; - } - - /** - * Removes the entry since this is a non-strict read/write cache strategy. - */ - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException { - remove(key); - return false; - } - - /** - * {@inheritDoc} - */ - public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) - throws CacheException { - unlockItem(key, lock); - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public void remove(Object key) throws CacheException { - region.remove(key); - } -} Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/AsyncWriteBehind.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/AsyncWriteBehind.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/AsyncWriteBehind.java (revision 0) @@ -1,94 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.writer.CacheWriter; -import net.sf.ehcache.writer.writebehind.OperationsFilter; -import net.sf.ehcache.writer.writebehind.WriteBehind; - -import org.terracotta.modules.ehcache.async.AsyncCoordinator; -import org.terracotta.modules.ehcache.async.scatterpolicies.ItemScatterPolicy; -import org.terracotta.modules.ehcache.writebehind.operations.DeleteAsyncOperation; -import org.terracotta.modules.ehcache.writebehind.operations.SingleAsyncOperation; -import org.terracotta.modules.ehcache.writebehind.operations.WriteAsyncOperation; - -public class AsyncWriteBehind implements WriteBehind { - public static final ItemScatterPolicy POLICY = new SingleAsyncOperationItemScatterPolicy(); - - private final AsyncCoordinator async; - private final int concurrency; - - /** - * Instantiate a new instance of {@code AsyncWriteBehind} by providing the async coordinator instance that will be - * used for the underlying behavior. - * - * @param async the async coordinator instance that will be used by the write behind queue - * @param writeBehindConcurrency the amount of buckets and threads to use - */ - public AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency) { - if(async == null) { - throw new IllegalArgumentException("AsyncCoordinator can't be null"); - } - if(writeBehindConcurrency < 1) { - throw new IllegalArgumentException("writeBehindConcurrency has to be at least one"); - } - this.async = async; - this.concurrency = writeBehindConcurrency; - } - - @Override - public void start(CacheWriter writer) throws CacheException { - async.start(new CacheWriterProcessor(writer), concurrency, POLICY); - } - - // This method is to be called from within a clustered Lock as it does not take any clustered lock inside. - @Override - public void write(Element element) { - async.add(new WriteAsyncOperation(element)); - } - - // This method is to be called from within a clustered Lock as it does not take any clustered lock inside. - @Override - public void delete(CacheEntry entry) { - async.add(new DeleteAsyncOperation(entry.getKey(), entry.getElement())); - } - - @Override - public void setOperationsFilter(OperationsFilter filter) { - OperationsFilterWrapper filterWrapper = new OperationsFilterWrapper(filter); - async.setOperationsFilter(filterWrapper); - } - - @Override - public void stop() throws CacheException { - async.stop(); - } - - @Override - public long getQueueSize() { - return async.getQueueSize(); - } - - private static class SingleAsyncOperationItemScatterPolicy implements ItemScatterPolicy { - private SingleAsyncOperationItemScatterPolicy() { - // - } - - @Override - public int selectBucket(final int count, final SingleAsyncOperation item) { - Object key; - try { - key = item.getKey(); - } catch (Exception e) { - throw new CacheException(e); - } - return Math.abs(key.hashCode() % count); - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/SizeOfFilter.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/SizeOfFilter.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/SizeOfFilter.java (revision 0) @@ -1,44 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof.filter; - -import java.lang.reflect.Field; -import java.util.Collection; - -/** - * Filter to filter types or fields of object graphs passed to a SizeOf engine - * - * @author Chris Dennis - * @see net.sf.ehcache.pool.sizeof.SizeOf - */ -public interface SizeOfFilter { - - /** - * Returns the fields to walk and measure for a type - * @param klazz the type - * @param fields the fields already "qualified" - * @return the filtered Set - */ - Collection filterFields(Class klazz, Collection fields); - - /** - * Checks whether the type needs to be filtered - * @param klazz the type - * @return true, if to be filtered out - */ - boolean filterClass(Class klazz); -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xml (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/config/ehcache.xml (revision 0) @@ -1,1247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/BlockingCacheEntryFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/BlockingCacheEntryFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/BlockingCacheEntryFactory.java (revision 0) @@ -1,69 +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; - -/** - * A cache entry factory that blocks until signaled. - *

- * This is useful for writing tests. - * - * @author Greg Luck - * @version $Id: BlockingCacheEntryFactory.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public class BlockingCacheEntryFactory implements CacheEntryFactory { - - private final Object value; - private int count; - - /** - * Constructs a new object - * - * @param value the factory always creates values equal to this value - */ - public BlockingCacheEntryFactory(final Object value) { - this.value = value; - } - - - /** - * @return number of entries the factory has created. - */ - public int getCount() { - return count; - } - - - /** - * Signals the factory. - */ - public synchronized void signal(final int count) { - this.count += count; - notify(); - } - - /** - * Fetches an entry. - */ - public synchronized Object createEntry(final Object key) throws Exception { - // Wait until signalled - while (count == 0) { - wait(); - } - count--; - return value; - } -} Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/OperationsFilterWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/OperationsFilterWrapper.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/OperationsFilterWrapper.java (revision 0) @@ -1,40 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import org.terracotta.modules.ehcache.async.ItemsFilter; -import org.terracotta.modules.ehcache.writebehind.operations.SingleAsyncOperation; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.writer.writebehind.OperationConverter; -import net.sf.ehcache.writer.writebehind.OperationsFilter; -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; - -import java.util.List; - -public class OperationsFilterWrapper implements ItemsFilter { - private final OperationsFilter delegate; - - public OperationsFilterWrapper(OperationsFilter delegate) { - this.delegate = delegate; - } - - @Override - public void filter(final List items) { - delegate.filter(items, new OperationConverter() { - public KeyBasedOperation convert(Object source) { - SingleAsyncOperation operation = (SingleAsyncOperation) source; - try { - return new KeyBasedOperationWrapper(operation.getKey(), operation.getCreationTime()); - } catch (Exception e) { - throw new CacheException(e); - } - } - }); - } - - OperationsFilter getDelegate() { - return delegate; - } -} Index: rctags/ehcache-2.10.9.1.15/distribution/events/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/distribution/events/.settings/org.eclipse.jdt.core.prefs (revision 11494) +++ rctags/ehcache-2.10.9.1.15/distribution/events/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,6 +0,0 @@ -#Mon Apr 02 19:16:29 PDT 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/ConfigurationHelper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/ConfigurationHelper.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/ConfigurationHelper.java (revision 0) @@ -1,424 +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; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.config.CacheConfiguration.CacheDecoratorFactoryConfiguration; -import net.sf.ehcache.constructs.CacheDecoratorFactory; -import net.sf.ehcache.distribution.CacheManagerPeerListener; -import net.sf.ehcache.distribution.CacheManagerPeerListenerFactory; -import net.sf.ehcache.distribution.CacheManagerPeerProvider; -import net.sf.ehcache.distribution.CacheManagerPeerProviderFactory; -import net.sf.ehcache.event.CacheManagerEventListener; -import net.sf.ehcache.event.CacheManagerEventListenerFactory; -import net.sf.ehcache.exceptionhandler.CacheExceptionHandler; -import net.sf.ehcache.exceptionhandler.CacheExceptionHandlerFactory; -import net.sf.ehcache.exceptionhandler.ExceptionHandlingDynamicCacheProxy; -import net.sf.ehcache.util.ClassLoaderUtil; -import net.sf.ehcache.util.PropertyUtil; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The configuration for ehcache. - *

- * This class can be populated through: - *

    - *
  • introspection by {@link ConfigurationFactory} or - *
  • programmatically - *
- * - * @author Greg Luck - * @version $Id: ConfigurationHelper.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public final class ConfigurationHelper { - - private static final Logger LOG = LoggerFactory.getLogger(ConfigurationHelper.class.getName()); - - private final Configuration configuration; - private final CacheManager cacheManager; - - private final ClassLoader loader; - - /** - * Only Constructor - * - * @param cacheManager - * @param configuration - */ - public ConfigurationHelper(CacheManager cacheManager, Configuration configuration) { - if (cacheManager == null || configuration == null) { - throw new IllegalArgumentException("Cannot have null parameters"); - } - this.cacheManager = cacheManager; - this.configuration = configuration; - this.loader = configuration.getClassLoader(); - } - - /** - * Tries to create a CacheLoader from the configuration using the factory - * specified. - * - * @return The CacheExceptionHandler, or null if it could not be found. - */ - public static CacheExceptionHandler createCacheExceptionHandler( - CacheConfiguration.CacheExceptionHandlerFactoryConfiguration factoryConfiguration, ClassLoader loader) throws CacheException { - String className = null; - CacheExceptionHandler cacheExceptionHandler = null; - if (factoryConfiguration != null) { - className = factoryConfiguration.getFullyQualifiedClassPath(); - } - if (className == null || className.length() == 0) { - LOG.debug("No CacheExceptionHandlerFactory class specified. Skipping..."); - } else { - CacheExceptionHandlerFactory factory = (CacheExceptionHandlerFactory) - ClassLoaderUtil.createNewInstance(loader, className); - Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), - factoryConfiguration.getPropertySeparator()); - return factory.createExceptionHandler(properties); - } - return cacheExceptionHandler; - } - - - /** - * Tries to load the class specified otherwise defaults to null - * - * @return a map of CacheManagerPeerProviders - */ - public Map createCachePeerProviders() { - String className = null; - Map cacheManagerPeerProviders = new HashMap(); - List cachePeerProviderFactoryConfiguration = - configuration.getCacheManagerPeerProviderFactoryConfiguration(); - for (FactoryConfiguration factoryConfiguration : cachePeerProviderFactoryConfiguration) { - - if (factoryConfiguration != null) { - className = factoryConfiguration.getFullyQualifiedClassPath(); - } - if (className == null) { - LOG.debug("No CachePeerProviderFactoryConfiguration specified. Not configuring a CacheManagerPeerProvider."); - return null; - } else { - CacheManagerPeerProviderFactory cacheManagerPeerProviderFactory = - (CacheManagerPeerProviderFactory) - ClassLoaderUtil.createNewInstance(loader, className); - Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), - factoryConfiguration.getPropertySeparator()); - CacheManagerPeerProvider cacheManagerPeerProvider = - cacheManagerPeerProviderFactory.createCachePeerProvider(cacheManager, properties); - cacheManagerPeerProviders.put(cacheManagerPeerProvider.getScheme(), cacheManagerPeerProvider); - - } - } - return cacheManagerPeerProviders; - } - - /** - * Tries to load the class specified otherwise defaults to null - */ - public Map createCachePeerListeners() { - String className = null; - Map cacheManagerPeerListeners = new HashMap(); - List cacheManagerPeerListenerFactoryConfigurations = - configuration.getCacheManagerPeerListenerFactoryConfigurations(); - boolean first = true; - for (FactoryConfiguration factoryConfiguration : cacheManagerPeerListenerFactoryConfigurations) { - - if (factoryConfiguration != null) { - className = factoryConfiguration.getFullyQualifiedClassPath(); - } - if (className == null) { - LOG.debug("No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener."); - return null; - } else { - CacheManagerPeerListenerFactory cacheManagerPeerListenerFactory = (CacheManagerPeerListenerFactory) - ClassLoaderUtil.createNewInstance(loader, className); - Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), - factoryConfiguration.getPropertySeparator()); - CacheManagerPeerListener cacheManagerPeerListener = - cacheManagerPeerListenerFactory.createCachePeerListener(cacheManager, properties); - cacheManagerPeerListeners.put(cacheManagerPeerListener.getScheme(), cacheManagerPeerListener); - } - } - return cacheManagerPeerListeners; - } - - /** - * Tries to load the class specified. - * - * @return If there is none returns null. - * @param cacheManager - */ - public final CacheManagerEventListener createCacheManagerEventListener(CacheManager cacheManager) throws CacheException { - String className = null; - FactoryConfiguration cacheManagerEventListenerFactoryConfiguration = - configuration.getCacheManagerEventListenerFactoryConfiguration(); - if (cacheManagerEventListenerFactoryConfiguration != null) { - className = cacheManagerEventListenerFactoryConfiguration.getFullyQualifiedClassPath(); - } - if (className == null || className.length() == 0) { - LOG.debug("No CacheManagerEventListenerFactory class specified. Skipping..."); - return null; - } else { - CacheManagerEventListenerFactory factory = (CacheManagerEventListenerFactory) - ClassLoaderUtil.createNewInstance(loader, className); - Properties properties = PropertyUtil.parseProperties(cacheManagerEventListenerFactoryConfiguration.properties, - cacheManagerEventListenerFactoryConfiguration.getPropertySeparator()); - return factory.createCacheManagerEventListener(cacheManager, properties); - } - } - - - /** - * @return the disk store path, or null if not set. - */ - public final String getDiskStorePath() { - DiskStoreConfiguration diskStoreConfiguration = configuration.getDiskStoreConfiguration(); - if (diskStoreConfiguration == null) { - return null; - } else { - return diskStoreConfiguration.getPath(); - } - } - - /** - * @return the Default Cache - * @throws net.sf.ehcache.CacheException if there is no default cache - */ - public final Ehcache createDefaultCache() throws CacheException { - CacheConfiguration cacheConfiguration = configuration.getDefaultCacheConfiguration(); - if (cacheConfiguration == null) { - return null; - } else { - cacheConfiguration.name = Cache.DEFAULT_CACHE_NAME; - return createCache(cacheConfiguration); - } - } - - /** - * Creates unitialised caches for each cache configuration found - * - * @return an empty set if there are none, - */ - public final Set createCaches() { - Set caches = new HashSet(); - Set cacheConfigurations = configuration.getCacheConfigurations().entrySet(); - for (Iterator iterator = cacheConfigurations.iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - CacheConfiguration cacheConfiguration = (CacheConfiguration) entry.getValue(); - Ehcache cache = createCache(cacheConfiguration); - caches.add(cache); - } - return caches; - } - - /** - * Calculates the number of caches in the configuration that are diskPersistent - */ - public final int numberOfCachesThatUseDiskStorage() { - int count = 0; - Set cacheConfigurations = configuration.getCacheConfigurations().entrySet(); - for (CacheConfiguration cacheConfig : configuration.getCacheConfigurations().values()) { - if (cacheConfig.isOverflowToDisk() || cacheConfig.isDiskPersistent() || - (cacheConfig.isOverflowToOffHeap() && cacheConfig.isSearchable())) { - count++; - } else { - PersistenceConfiguration persistence = cacheConfig.getPersistenceConfiguration(); - if (persistence != null) { - switch (persistence.getStrategy()) { - case LOCALTEMPSWAP: - case LOCALRESTARTABLE: - count++; - break; - default: - break; - } - } - } - } - return count; - } - - /** - * Creates a cache from configuration where the configuration cache name matches the given name - * - * @return the cache, or null if there is no match - */ - final Ehcache createCacheFromName(String name) { - CacheConfiguration cacheConfiguration = null; - Set cacheConfigurations = configuration.getCacheConfigurations().entrySet(); - for (Iterator iterator = cacheConfigurations.iterator(); iterator.hasNext();) { - Map.Entry entry = (Map.Entry) iterator.next(); - CacheConfiguration cacheConfigurationCandidate = (CacheConfiguration) entry.getValue(); - if (cacheConfigurationCandidate.name.equals(name)) { - cacheConfiguration = cacheConfigurationCandidate; - break; - } - } - if (cacheConfiguration == null) { - return null; - } else { - return createCache(cacheConfiguration); - } - } - - /** - * Create a cache given a cache configuration - * - * @param cacheConfiguration - */ - final Ehcache createCache(CacheConfiguration cacheConfiguration) { - CacheConfiguration configClone = cacheConfiguration.clone(); - - // make sure all caches use the same classloader that the CacheManager is configured to use - configClone.setClassLoader(configuration.getClassLoader()); - - Ehcache cache = new Cache(configClone, null, null); - cache = applyCacheExceptionHandler(configClone, cache); - return cache; - } - - private Ehcache applyCacheExceptionHandler(CacheConfiguration cacheConfiguration, Ehcache cache) { - CacheExceptionHandler cacheExceptionHandler = - createCacheExceptionHandler(cacheConfiguration.getCacheExceptionHandlerFactoryConfiguration(), loader); - cache.setCacheExceptionHandler(cacheExceptionHandler); - - if (cache.getCacheExceptionHandler() != null) { - return ExceptionHandlingDynamicCacheProxy.createProxy(cache); - } - return cache; - } - - /** - * Creates decorated ehcaches for the cache, if any configured in ehcache.xml - * - * @param cache the cache - * @return List of the decorated ehcaches, if any configured in ehcache.xml otherwise returns empty list - */ - public List createCacheDecorators(Ehcache cache) { - CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); - if (cacheConfiguration == null) { - return createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader); - } - List cacheDecoratorConfigurations = cacheConfiguration.getCacheDecoratorConfigurations(); - if (cacheDecoratorConfigurations == null || cacheDecoratorConfigurations.size() == 0) { - LOG.debug("CacheDecoratorFactory not configured. Skipping for '" + cache.getName() + "'."); - return createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader); - } - List result = new ArrayList(); - for (CacheDecoratorFactoryConfiguration factoryConfiguration : cacheDecoratorConfigurations) { - Ehcache decoratedCache = createDecoratedCache(cache, factoryConfiguration, false, loader); - if (decoratedCache != null) { - result.add(decoratedCache); - } - } - for (Ehcache defaultDecoratedCache : createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader)) { - result.add(defaultDecoratedCache); - } - return result; - } - - /** - * Creates default cache decorators specified in the default cache configuration if any - * @param cache the underlying cache that will be decorated - * @param defaultCacheConfiguration default cache configuration - * @param loader - * @return list of decorated caches - */ - public static List createDefaultCacheDecorators(Ehcache cache, CacheConfiguration defaultCacheConfiguration, ClassLoader loader) { - if (cache == null) { - throw new CacheException("Underlying cache cannot be null when creating decorated caches."); - } - List defaultCacheDecoratorConfigurations = defaultCacheConfiguration == null ? - null : defaultCacheConfiguration.getCacheDecoratorConfigurations(); - if (defaultCacheDecoratorConfigurations == null || defaultCacheDecoratorConfigurations.size() == 0) { - LOG.debug("CacheDecoratorFactory not configured for defaultCache. Skipping for '" + cache.getName() + "'."); - return Collections.emptyList(); - } - List result = new ArrayList(); - Set newCacheNames = new HashSet(); - for (CacheDecoratorFactoryConfiguration factoryConfiguration : defaultCacheDecoratorConfigurations) { - Ehcache decoratedCache = createDecoratedCache(cache, factoryConfiguration, true, loader); - if (decoratedCache != null) { - if (newCacheNames.contains(decoratedCache.getName())) { - throw new InvalidConfigurationException( - "Looks like the defaultCache is configured with multiple CacheDecoratorFactory's " - + "that does not set unique names for newly created caches. Please fix the " - + "CacheDecoratorFactory and/or the config to set unique names for newly created caches."); - } - newCacheNames.add(decoratedCache.getName()); - result.add(decoratedCache); - } - } - return result; - } - - /** - * Creates the decorated cache from the decorator config specified. Returns null if the name of the factory class is not specified - */ - private static Ehcache createDecoratedCache(Ehcache cache, - CacheConfiguration.CacheDecoratorFactoryConfiguration factoryConfiguration, boolean forDefaultCache, ClassLoader loader) { - if (factoryConfiguration == null) { - return null; - } - String className = factoryConfiguration.getFullyQualifiedClassPath(); - if (className == null) { - LOG.debug("CacheDecoratorFactory was specified without the name of the factory. Skipping..."); - return null; - } else { - CacheDecoratorFactory factory = (CacheDecoratorFactory) ClassLoaderUtil.createNewInstance(loader, className); - Properties properties = PropertyUtil.parseProperties(factoryConfiguration.getProperties(), - factoryConfiguration.getPropertySeparator()); - if (forDefaultCache) { - return factory.createDefaultDecoratedEhcache(cache, properties); - } else { - return factory.createDecoratedEhcache(cache, properties); - } - } - } - - /** - * @deprecated internal use only - * @param sa search attribute - * @return attribute type as class - */ - public static Class getSearchAttributeType(SearchAttribute sa, ClassLoader loader) { - return sa.getType(loader); - } - - /** - * @return the Configuration used - */ - public final Configuration getConfigurationBean() { - return configuration; - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapElementTTIExpressTestClient.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapElementTTIExpressTestClient.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/JvmInformationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/JvmInformationTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/sizeof/JvmInformationTest.java (revision 0) @@ -1,71 +0,0 @@ -package net.sf.ehcache.pool.sizeof; - -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -/** - * Basic test used during refactoring of enum to make sure no differences were introduced - */ -public class JvmInformationTest { - - @Test - public void hotspot32Bits() { - verifyJvmInfo(JvmInformation.HOTSPOT_32_BIT, 0, 0, 4, 8, 8, 8, 4, true, true, true); - verifyJvmInfo(JvmInformation.HOTSPOT_32_BIT_WITH_CONCURRENT_MARK_AND_SWEEP, 0, 0, 4, 16, 8, 8, 4, true, true, true); - } - - @Test - public void hotspot64Bits() { - verifyJvmInfo(JvmInformation.HOTSPOT_64_BIT, 0, 0, 8, 8, 8, 16, 8, true, true, true); - verifyJvmInfo(JvmInformation.HOTSPOT_64_BIT_WITH_CONCURRENT_MARK_AND_SWEEP, 0, 0, 8, 24, 8, 16, 8, true, true, true); - verifyJvmInfo(JvmInformation.HOTSPOT_64_BIT_WITH_COMPRESSED_OOPS, 0, 0, 4, 8, 8, 12, 8, true, true, true); - verifyJvmInfo(JvmInformation.HOTSPOT_64_BIT_WITH_COMPRESSED_OOPS_AND_CONCURRENT_MARK_AND_SWEEP, 0, 0, 4, 24, 8, 12, 8, true, true, true); - } - - @Test - public void openJdk32Bits() { - verifyJvmInfo(JvmInformation.OPENJDK_32_BIT, 0, 0, 4, 8, 8, 8, 4, true, true, true); - verifyJvmInfo(JvmInformation.OPENJDK_32_BIT_WITH_CONCURRENT_MARK_AND_SWEEP, 0, 0, 4, 16, 8, 8, 4, true, true, true); - } - - @Test - public void openJdk64Bits() { - verifyJvmInfo(JvmInformation.OPENJDK_64_BIT, 0, 0, 8, 8, 8, 16, 8, true, true, true); - verifyJvmInfo(JvmInformation.OPENJDK_64_BIT_WITH_CONCURRENT_MARK_AND_SWEEP, 0, 0, 8, 24, 8, 16, 8, true, true, true); - verifyJvmInfo(JvmInformation.OPENJDK_64_BIT_WITH_COMPRESSED_OOPS, 0, 0, 4, 8, 8, 12, 8, true, true, true); - verifyJvmInfo(JvmInformation.OPENJDK_64_BIT_WITH_COMPRESSED_OOPS_AND_CONCURRENT_MARK_AND_SWEEP, 0, 0, 4, 24, 8, 12, 8, true, true, true); - } - - @Test - public void ibm32Bits() { - verifyJvmInfo(JvmInformation.IBM_32_BIT, 0, 0, 4, 8, 8, 16, 4, true, false, true); - } - - @Test - public void ibm64Bits() { - verifyJvmInfo(JvmInformation.IBM_64_BIT, 0, 0, 8, 8, 8, 24, 8, true, false, true); - verifyJvmInfo(JvmInformation.IBM_64_BIT_WITH_COMPRESSED_REFS, 0, 0, 4, 16, 8, 16, 4, false, false, true); - } - - @Test - public void unknown() { - verifyJvmInfo(JvmInformation.UNKNOWN_32_BIT, 0, 0, 4, 8, 8, 8, 4, true, true, true); - verifyJvmInfo(JvmInformation.UNKNOWN_64_BIT, 0, 0, 8, 8, 8, 16, 8, true, true, true); - } - - private void verifyJvmInfo(JvmInformation jvmInfo, int agentSizeOfAdj, int fieldOffsetAdj, int javaPointerSize, int minObjSize, int objAlign, int objHeaderSize, int pointerSize, - boolean supportAgentSizeOf, boolean supportReflectionSizeOf, boolean supportUnsafeSizeOf) { - assertThat(jvmInfo.getAgentSizeOfAdjustment(), is(agentSizeOfAdj)); - assertThat(jvmInfo.getFieldOffsetAdjustment(), is(fieldOffsetAdj)); - assertThat(jvmInfo.getJavaPointerSize(), is(javaPointerSize)); - assertThat(jvmInfo.getMinimumObjectSize(), is(minObjSize)); - assertThat(jvmInfo.getObjectAlignment(), is(objAlign)); - assertThat(jvmInfo.getObjectHeaderSize(), is(objHeaderSize)); - assertThat(jvmInfo.getPointerSize(), is(pointerSize)); - assertThat(jvmInfo.supportsAgentSizeOf(), is(supportAgentSizeOf)); - assertThat(jvmInfo.supportsReflectionSizeOf(), is(supportReflectionSizeOf)); - assertThat(jvmInfo.supportsUnsafeSizeOf(), is(supportUnsafeSizeOf)); - } -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/CachePinningTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/CachePinningTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/CachePinningTest.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; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; - -import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; - -import junit.framework.Assert; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.store.disk.DiskStoreHelper; - -import org.hamcrest.Matchers; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests for Cache pinning - * - * @author Ludovic Orban - */ -public class CachePinningTest { - - private static final int ELEMENT_COUNT = 4000; - - private CacheManager cacheManager; - - @Before - public void setUp() throws Exception { - cacheManager = new CacheManager( - new Configuration() - .diskStore(new DiskStoreConfiguration().path("java.io.tmpdir/CachePinningTest")) - ); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - cacheManager = null; - } - - @Test - public void testClassicLru() throws Exception { - System.setProperty(Cache.NET_SF_EHCACHE_USE_CLASSIC_LRU, "true"); - try { - testMemoryOnly(); - } finally { - System.setProperty(Cache.NET_SF_EHCACHE_USE_CLASSIC_LRU, "false"); - } - } - - @Test - public void testMemoryOnly() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .maxEntriesLocalHeap(10) - .name("memoryOnlyCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("memoryOnlyCache_inCache"), ELEMENT_COUNT, 0); - } - - @Test - public void testOverflowToDisk() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .maxEntriesLocalHeap(10) - .maxElementsOnDisk(20) - .overflowToDisk(true) - .name("overflowToDiskCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("overflowToDiskCache_inCache"), 10, ELEMENT_COUNT - 10); - } - - @Test - public void testDiskPersistent() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .maxEntriesLocalHeap(10) - .maxElementsOnDisk(20) - .overflowToDisk(true) - .diskPersistent(true) - .name("diskPersistentCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("diskPersistentCache_inCache"), 10, ELEMENT_COUNT - 10); - } - - private void doAssertions(Cache cache, long expectedMemoryHits, long expectedDiskHits) throws ExecutionException, InterruptedException { - - cache.removeAll(); - flushDisk(cache); - - for (int i = 0; i < ELEMENT_COUNT; i++) { - cache.put(new Element(i, i)); - if(i % 100 == 0) { - flushDisk(cache); - } - } - - flushDisk(cache); - Assert.assertEquals(ELEMENT_COUNT, cache.getSize()); - - for (int i = 0; i < ELEMENT_COUNT; i++) { - assertNotNull(cache.get(i)); - } - -// Assert.assertEquals(expectedMemoryHits, ); - Assert.assertEquals(ELEMENT_COUNT - cache.getStatistics().localHeapHitCount(), cache.getStatistics().localHeapMissCount()); - Assert.assertEquals(cache.getStatistics().localHeapMissCount(), cache.getStatistics().localDiskHitCount()); - Assert.assertEquals(0, cache.getStatistics().localDiskMissCount()); - Assert.assertEquals(0, cache.getStatistics().cacheEvictedCount()); - } - - private void flushDisk(final Cache cache) throws InterruptedException, ExecutionException { - final Future future = DiskStoreHelper.flushAllEntriesToDisk(cache); - if(future != null) { - future.get(); - } - } -} - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotNull.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotNull.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotNull.java (revision 0) @@ -1,62 +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 net.sf.ehcache.Element; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * @author vfunshte - * - */ -public class NotNull extends BaseCriteria { - - private final String attributeName; - - /** - * @param attributeName - */ - public NotNull(String attributeName) { - this.attributeName = attributeName; - } - - /** - * Get attribute name. - * - * @return attribute name. - */ - public String getAttributeName() { - return attributeName; - } - - - @Override - public boolean execute(Element e, Map attributeExtractors) { - return getExtractor(getAttributeName(), attributeExtractors).attributeFor(e, getAttributeName()) != null; - } - - @Override - public Set> getAttributes() { - return Collections.>singleton(new Attribute(attributeName)); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/AggregateIterator.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/AggregateIterator.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/AggregateIterator.java (revision 0) @@ -1,146 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - -/** - * This Iterator iterates over a collection of iterators. - * @author Nabib - * @param - */ -public class AggregateIterator < T > implements Iterator < T > { - - /** - * Collection of removed elements. - */ - private final Collection < ? > removeColl; - - /** - * Iterators of iterators. - */ - private final Iterator < Iterator < T > > iterators; - - /** - * Current iterator position. - */ - private Iterator < T > currentIterator; - - /** - * Next element position. - */ - private T next; - - /** - * Current element position. - */ - private T current; - - /** - * @param collRemove - * collection of removed entries to check against - * @param listIterators - * collection of iterators - */ - public AggregateIterator(final Collection < ? > collRemove, - final List < Iterator < T > > listIterators) { - this.removeColl = collRemove; - this.iterators = listIterators.iterator(); - while (this.iterators.hasNext()) { - this.currentIterator = getNextIterator(); - while (this.currentIterator.hasNext()) { - next = this.currentIterator.next(); - if (!removeColl.contains(next)) { - return; - } - } - } - next = null; - } - - /** - * {@inheritDoc} - */ - public final boolean hasNext() { - return next != null; - } - - /** - * {@inheritDoc} - */ - public final T next() { - if (next == null) { - throw new NoSuchElementException(); - } else { - T returnNext = next; - current = returnNext; - next = null; - if (this.currentIterator == null) { - throw new NoSuchElementException(); - } - - while (this.currentIterator.hasNext()) { - - T nextCandidate = this.currentIterator.next(); - if (removeColl.contains(nextCandidate)) { - continue; - } else { - next = nextCandidate; - return returnNext; - } - } - while (this.iterators.hasNext()) { - this.currentIterator = this.iterators.next(); - while (this.currentIterator.hasNext()) { - - T nextCandidate = this.currentIterator.next(); - if (removeColl.contains(nextCandidate)) { - continue; - } else { - next = nextCandidate; - return returnNext; - } - } - } - return returnNext; - } - } - - /** - * {@inheritDoc} - */ - public final void remove() { - if (current == null) { - throw new IllegalStateException(); - } - this.removeColl.remove(current); - current = null; - } - - /** - * Get next Iterator. - * @return Iterator - */ - private Iterator < T > getNextIterator() { - return iterators.next(); - } - - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionStats.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionStats.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/CacheRegionStats.java (revision 0) @@ -1,281 +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.SecondLevelCacheStatistics; - -/** - * @author gkeim - * - */ -public class CacheRegionStats implements Serializable { - private static final String COMPOSITE_TYPE_NAME = "CacheRegionStats"; - private static final String COMPOSITE_TYPE_DESCRIPTION = "Statistics per Cache-region"; - private static final String[] ITEM_NAMES = new String[] {"region", "shortName", "hitCount", - "missCount", "putCount", "hitRatio", "elementCountInMemory", "elementCountOnDisk", "elementCountTotal", }; - private static final String[] ITEM_DESCRIPTIONS = new String[] {"region", "shortName", "hitCount", - "missCount", "putCount", "hitRatio", "elementCountInMemory", "elementCountOnDisk", "elementCountTotal", }; - private static final OpenType[] ITEM_TYPES = new OpenType[] {SimpleType.STRING, - SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.LONG, SimpleType.DOUBLE, SimpleType.LONG, - SimpleType.LONG, SimpleType.LONG, }; - private static final CompositeType COMPOSITE_TYPE; - private static final String TABULAR_TYPE_NAME = "Statistics by Cache-region"; - private static final String TABULAR_TYPE_DESCRIPTION = "All Cache Region Statistics"; - private static final String[] INDEX_NAMES = new String[] {"region", }; - 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); - } - } - - /** - * region name - */ - protected final String region; - - /** - * region short name - */ - protected final String shortName; - - /** - * hit count - */ - protected long hitCount; - - /** - * miss count - */ - protected long missCount; - - /** - * put count - */ - protected long putCount; - - /** - * hit ratio - */ - protected double hitRatio; - - /** - * in-memory element count - */ - protected long elementCountInMemory; - - /** - * on-disk element count - */ - protected long elementCountOnDisk; - - /** - * total element count - */ - protected long elementCountTotal; - - /** - * @param region - */ - public CacheRegionStats(String region) { - this.region = region; - this.shortName = CacheRegionUtils.determineShortName(region); - } - - /** - * @param region - * @param src - */ - public CacheRegionStats(String region, SecondLevelCacheStatistics src) { - this(region); - - try { - this.hitCount = BeanUtils.getLongBeanProperty(src, "hitCount"); - this.missCount = BeanUtils.getLongBeanProperty(src, "missCount"); - this.putCount = BeanUtils.getLongBeanProperty(src, "putCount"); - this.hitRatio = determineHitRatio(); - this.elementCountInMemory = BeanUtils.getLongBeanProperty(src, "elementCountInMemory"); - this.elementCountOnDisk = BeanUtils.getLongBeanProperty(src, "elementCountOnDisk"); - this.elementCountTotal = BeanUtils.getLongBeanProperty(src, "elementCountOnDisk"); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("Exception retrieving statistics", e); - } - } - - /** - * @param cData - */ - public CacheRegionStats(final CompositeData cData) { - int i = 0; - region = (String) cData.get(ITEM_NAMES[i++]); - shortName = (String) cData.get(ITEM_NAMES[i++]); - hitCount = (Long) cData.get(ITEM_NAMES[i++]); - missCount = (Long) cData.get(ITEM_NAMES[i++]); - putCount = (Long) cData.get(ITEM_NAMES[i++]); - hitRatio = (Double) cData.get(ITEM_NAMES[i++]); - elementCountInMemory = (Long) cData.get(ITEM_NAMES[i++]); - elementCountOnDisk = (Long) cData.get(ITEM_NAMES[i++]); - elementCountTotal = (Long) cData.get(ITEM_NAMES[i++]); - } - - private static int safeParseInt(String s) { - try { - return Integer.parseInt(s); - } catch (Exception e) { - return -1; - } - } - - /** - * @return hit ratio - */ - protected double determineHitRatio() { - double result = 0; - long readCount = getHitCount() + getMissCount(); - if (readCount > 0) { - result = getHitCount() / ((double) readCount); - } - return result; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "region=" + getRegion() + "shortName=" + getShortName() + ", hitCount=" + getHitCount() + ", missCount=" - + getMissCount() + ", putCount" + getPutCount() + ", hitRatio" + getHitRatio() + ", elementCountInMemory=" - + getElementCountInMemory() + ", elementCountOnDisk=" + getElementCountOnDisk() + ", elementCountTotal=" - + getElementCountTotal(); - } - - /** - * @return region name - */ - public String getRegion() { - return region; - } - - /** - * @return short name - */ - public String getShortName() { - return shortName; - } - - /** - * @return hit count - */ - public long getHitCount() { - return hitCount; - } - - /** - * @return miss count - */ - public long getMissCount() { - return missCount; - } - - /** - * @return put count - */ - public long getPutCount() { - return putCount; - } - - /** - * @return hit ratio - */ - public double getHitRatio() { - return hitRatio; - } - - /** - * @return in-memory element count - */ - public long getElementCountInMemory() { - return elementCountInMemory; - } - - /** - * @return on-disk element count - */ - public long getElementCountOnDisk() { - return elementCountOnDisk; - } - - /** - * @return total element count - */ - public long getElementCountTotal() { - return elementCountTotal; - } - - /** - * @return composite data - */ - public CompositeData toCompositeData() { - try { - return new CompositeDataSupport(COMPOSITE_TYPE, ITEM_NAMES, new Object[] {getRegion(), getShortName(), - getHitCount(), getMissCount(), getPutCount(), getHitRatio(), getElementCountInMemory(), - getElementCountOnDisk(), getElementCountTotal(), }); - } catch (OpenDataException e) { - throw new RuntimeException(e); - } - } - - /** - * @return tabular data - */ - public static TabularData newTabularDataInstance() { - return new TabularDataSupport(TABULAR_TYPE); - } - - /** - * @param tabularData - * @return array of region statistics - */ - public static CacheRegionStats[] fromTabularData(final TabularData tabularData) { - final List countList = new ArrayList(tabularData.size()); - for (final Iterator pos = tabularData.values().iterator(); pos.hasNext();) { - countList.add(new CacheRegionStats((CompositeData) pos.next())); - } - return countList.toArray(new CacheRegionStats[countList.size()]); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/.settings/org.eclipse.jdt.core.prefs (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,347 +0,0 @@ -#Sat Feb 04 12:32:17 PST 2012 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -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=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=ignore -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=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=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -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=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=140 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 -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_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -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=true -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=140 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -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.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=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=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not 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=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=do not 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=do not 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.join_lines_in_comments=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -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=false -org.eclipse.jdt.core.formatter.lineSplit=140 -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=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/refreshahead/StringifyCacheLoaderFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/constructs/refreshahead/StringifyCacheLoaderFactory.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/AbstractCopyingCacheStore.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/AbstractCopyingCacheStore.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/AbstractCopyingCacheStore.java (revision 0) @@ -1,348 +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.CacheException; -import net.sf.ehcache.Element; -import net.sf.ehcache.Status; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.terracotta.TerracottaNotRunningException; -import net.sf.ehcache.writer.CacheWriterManager; - -import org.terracotta.context.annotations.ContextChild; - -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Copies elements, either on read, write or both before using the underlying store to actually store things - * When copying both ways, the store might not see the same types being stored - * @param the store type it wraps - * - * @author Alex Snaps - */ -abstract class AbstractCopyingCacheStore implements Store { - - @ContextChild - private final T store; - private final CopyStrategyHandler copyStrategyHandler; - - /** - * Creates a copying instance of store, that wraps the actual storage - * @param store the real store - * @param copyOnRead whether to copy on reads - * @param copyOnWrite whether to copy on writes - * @param copyStrategyInstance the copy strategy to use on every copy operation - * @param loader classloader of the containing cache - */ - public AbstractCopyingCacheStore(final T store, final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategyInstance, ClassLoader loader) { - - this.store = store; - copyStrategyHandler = new CopyStrategyHandler(copyOnRead, copyOnWrite, copyStrategyInstance, loader); - } - - @Override - public void addStoreListener(final StoreListener listener) { - store.addStoreListener(listener); - } - - @Override - public void removeStoreListener(final StoreListener listener) { - store.removeStoreListener(listener); - } - - @Override - public boolean put(final Element e) throws CacheException { - return e == null || store.put(copyStrategyHandler.copyElementForWriteIfNeeded(e)); - } - - @Override - public void putAll(final Collection elements) throws CacheException { - for (Element element : elements) { - put(element); - } - } - - @Override - public boolean putWithWriter(final Element element, final CacheWriterManager writerManager) throws CacheException { - return store.putWithWriter(copyStrategyHandler.copyElementForWriteIfNeeded(element), writerManager); - } - - @Override - public Element get(final Object key) { - return copyStrategyHandler.copyElementForReadIfNeeded(store.get(key)); - } - - @Override - public Element getQuiet(final Object key) { - return copyStrategyHandler.copyElementForReadIfNeeded(store.getQuiet(key)); - } - - @Override - public List getKeys() { - return store.getKeys(); - } - - @Override - public Element remove(final Object key) { - return copyStrategyHandler.copyElementForReadIfNeeded(store.remove(key)); - } - - @Override - public void removeAll(final Collection keys) { - for (Object key : keys) { - remove(key); - } - } - - @Override - public Element removeWithWriter(final Object key, final CacheWriterManager writerManager) throws CacheException { - return copyStrategyHandler.copyElementForReadIfNeeded(store.removeWithWriter(key, writerManager)); - } - - @Override - public void removeAll() throws CacheException { - store.removeAll(); - } - - @Override - public Element putIfAbsent(final Element element) throws NullPointerException { - return copyStrategyHandler.copyElementForReadIfNeeded(store.putIfAbsent(copyStrategyHandler.copyElementForWriteIfNeeded(element))); - } - - @Override - public Element removeElement(final Element element, final ElementValueComparator comparator) throws NullPointerException { - Element removed = store.removeElement(copyStrategyHandler.copyElementForRemovalIfNeeded(element), comparator); - return copyStrategyHandler.copyElementForReadIfNeeded(removed); - } - - @Override - public boolean replace(final Element old, final Element element, - final ElementValueComparator comparator) throws NullPointerException, IllegalArgumentException { - Element oldElement = copyStrategyHandler.copyElementForRemovalIfNeeded(old); - Element newElement = copyStrategyHandler.copyElementForWriteIfNeeded(element); - return store.replace(oldElement, newElement, comparator); - } - - @Override - public Element replace(final Element element) throws NullPointerException { - return copyStrategyHandler.copyElementForReadIfNeeded(store.replace(copyStrategyHandler.copyElementForWriteIfNeeded(element))); - } - - @Override - public void dispose() { - store.dispose(); - } - - @Override - public int getSize() { - return store.getSize(); - } - - @Override - public int getInMemorySize() { - return store.getInMemorySize(); - } - - @Override - public int getOffHeapSize() { - return store.getOffHeapSize(); - } - - @Override - public int getOnDiskSize() { - return store.getOnDiskSize(); - } - - @Override - public int getTerracottaClusteredSize() { - return store.getTerracottaClusteredSize(); - } - - @Override - public long getInMemorySizeInBytes() { - return store.getInMemorySizeInBytes(); - } - - @Override - public long getOffHeapSizeInBytes() { - return store.getOffHeapSizeInBytes(); - } - - @Override - public long getOnDiskSizeInBytes() { - return store.getOnDiskSizeInBytes(); - } - - @Override - public boolean hasAbortedSizeOf() { - return store.hasAbortedSizeOf(); - } - - @Override - public Status getStatus() { - return store.getStatus(); - } - - @Override - public boolean containsKey(final Object key) { - return store.containsKey(key); - } - - @Override - public boolean containsKeyOnDisk(final Object key) { - return store.containsKeyOnDisk(key); - } - - @Override - public boolean containsKeyOffHeap(final Object key) { - return store.containsKeyOffHeap(key); - } - - @Override - public boolean containsKeyInMemory(final Object key) { - return store.containsKeyInMemory(key); - } - - @Override - public void expireElements() { - store.expireElements(); - } - - @Override - public void flush() throws IOException { - store.flush(); - } - - @Override - public boolean bufferFull() { - return store.bufferFull(); - } - - @Override - public Policy getInMemoryEvictionPolicy() { - return store.getInMemoryEvictionPolicy(); - } - - @Override - public void setInMemoryEvictionPolicy(final Policy policy) { - store.setInMemoryEvictionPolicy(policy); - } - - @Override - public Object getInternalContext() { - return store.getInternalContext(); - } - - @Override - public boolean isCacheCoherent() { - return store.isCacheCoherent(); - } - - @Override - public boolean isClusterCoherent() throws TerracottaNotRunningException { - return store.isClusterCoherent(); - } - - @Override - public boolean isNodeCoherent() throws TerracottaNotRunningException { - return store.isNodeCoherent(); - } - - @Override - public void setNodeCoherent(final boolean coherent) throws UnsupportedOperationException, TerracottaNotRunningException { - store.setNodeCoherent(coherent); - } - - @Override - public void waitUntilClusterCoherent() throws UnsupportedOperationException, TerracottaNotRunningException, InterruptedException { - store.waitUntilClusterCoherent(); - } - - @Override - public Object getMBean() { - return store.getMBean(); - } - - @Override - public void setAttributeExtractors(final Map extractors) { - store.setAttributeExtractors(extractors); - } - - @Override - public Results executeQuery(final StoreQuery query) throws SearchException { - return store.executeQuery(query); - } - - @Override - public Attribute getSearchAttribute(final String attributeName) { - return store.getSearchAttribute(attributeName); - } - - @Override - public Set getSearchAttributes() { - return store.getSearchAttributes(); - } - - @Override - public Map getAllQuiet(final Collection keys) { - Map elements = new HashMap(); - for (Object key : keys) { - elements.put(key, getQuiet(key)); - } - return elements; - } - - @Override - public Map getAll(final Collection keys) { - Map elements = new HashMap(); - for (Object key : keys) { - elements.put(key, get(key)); - } - return elements; - } - - @Override - public void recalculateSize(final Object key) { - store.recalculateSize(key); - } - - /** - * Accessor to the underlying store - * @return the underlying store - */ - public T getUnderlyingStore() { - return store; - } - - /** - * Accessor to the {@link CopyStrategyHandler} - * - * @return the copy strategy handler - */ - protected CopyStrategyHandler getCopyStrategyHandler() { - return copyStrategyHandler; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/impl/RoundRobinOnHeapPoolEvictor.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/impl/RoundRobinOnHeapPoolEvictor.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/pool/impl/RoundRobinOnHeapPoolEvictor.java (revision 0) @@ -1,47 +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.PoolAccessor; -import net.sf.ehcache.pool.PoolEvictor; -import net.sf.ehcache.pool.PoolParticipant; - -import java.util.Collection; - -/** - * @author Ludovic Orban - */ -public class RoundRobinOnHeapPoolEvictor implements PoolEvictor { - public boolean freeSpace(Collection> from, long bytes) { - long remaining = bytes; - - while (true) { - for (PoolAccessor accessor : from) { - long beforeEvictionSize = accessor.getSize(); - if (!accessor.getParticipant().evict(1, bytes)) { - return false; - } - long afterEvictionSize = accessor.getSize(); - - remaining -= (beforeEvictionSize - afterEvictionSize); - if (remaining <= 0L) { - return true; - } - } - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/manager/selector/FactorySelector.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/manager/selector/FactorySelector.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/manager/selector/FactorySelector.java (revision 0) @@ -1,76 +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.manager.selector; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import javax.transaction.TransactionManager; - -/** - * Abstract selector for calling a factory method - * - * @author Ludovic Orban - */ -public abstract class FactorySelector extends Selector { - private static final Logger LOG = LoggerFactory.getLogger(FactorySelector.class); - - private final String factoryClassName; - private final String factoryMethodName; - - /** - * Constructor - * - * @param vendor the transaction manager vendor name - * @param factoryClassName the class used to lookup the transaction manager - * @param factoryMethodName the method to be called on the class used to lookup the transaction manager - */ - public FactorySelector(String vendor, String factoryClassName, String factoryMethodName) { - super(vendor); - this.factoryClassName = factoryClassName; - this.factoryMethodName = factoryMethodName; - } - - /** - * {@inheritDoc} - */ - @Override - protected TransactionManager doLookup() { - TransactionManager transactionManager = null; - - try { - Class factoryClass = Class.forName(factoryClassName); - Class[] signature = null; - Object[] args = null; - Method method = factoryClass.getMethod(factoryMethodName, signature); - transactionManager = (TransactionManager) method.invoke(null, args); - } catch (ClassNotFoundException e) { - LOG.debug("FactorySelector failed lookup: {}", (Object) e); - } catch (NoSuchMethodException e) { - LOG.debug("FactorySelector failed lookup: {}", (Object) e); - } catch (InvocationTargetException e) { - LOG.debug("FactorySelector failed lookup: {}", (Object) e); - } catch (IllegalAccessException e) { - LOG.debug("FactorySelector failed lookup: {}", (Object) e); - } - return transactionManager; - } - - -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/CoalesceKeysFilterTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/CoalesceKeysFilterTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/CoalesceKeysFilterTest.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.writer; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.Element; -import net.sf.ehcache.writer.writebehind.CastingOperationConverter; -import net.sf.ehcache.writer.writebehind.CoalesceKeysFilter; -import net.sf.ehcache.writer.writebehind.operations.DeleteOperation; -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; -import net.sf.ehcache.writer.writebehind.operations.WriteOperation; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Tests for a key-based operations coalescing - * - * @author Geert Bevin - * @version $Id: CoalesceKeysFilterTest.java 8024 2013-08-22 10:33:13Z ljacomet $ - */ -@Category(CheckShorts.class) -public class CoalesceKeysFilterTest { - - @Test - public void testFilter() { - List operations = new ArrayList(); - operations.add(new WriteOperation(new Element("key1", "value1"), 10)); - operations.add(new WriteOperation(new Element("key2", "value2"), 10)); - operations.add(new WriteOperation(new Element("key1", "value3"), 30)); - operations.add(new WriteOperation(new Element("key1", "value4"), 20)); - operations.add(new DeleteOperation(new CacheEntry("key3", new Element("key3", "value5")), 30)); - operations.add(new WriteOperation(new Element("key4", "value6"), 40)); - operations.add(new DeleteOperation(new CacheEntry("key2", new Element("key2", "value7")), 20)); - operations.add(new DeleteOperation(new CacheEntry("key4", new Element("key4", "value8")), 30)); - operations.add(new WriteOperation(new Element("key4", "value9"), 20)); - operations.add(new WriteOperation(new Element("key5", "value10"), 50)); - - // key1 - W 10, W 30, W 20 = 3 - // key2 - W 10, D 20 = 2 - // key3 - D 30 = 1 - // key4 - W 40, D 30, W 20 = 3 - // key5 - W 50 = 1 - // operations = k1, k2, k1, k2, k4, k1, k3, k4, k4, k5 = 10 (create time order) - // operations = k1 10, k2 10, k1 30, k1 20, k3 30, k4 40, k2 20, k4 30, k4 20, k5 50 = 10 (add order) - // operations = k1 30, k3 30, k4 40, k2 20, k5 50 = 5 - - new CoalesceKeysFilter().filter(operations, CastingOperationConverter.getInstance()); - - assertEquals(5, operations.size()); - assertEquals("key1", operations.get(0).getKey()); - assertEquals("value3", ((WriteOperation) operations.get(0)).getElement().getValue()); - - assertTrue(operations.get(1) instanceof DeleteOperation); - assertEquals("key3", operations.get(1).getKey()); - - assertEquals("key4", operations.get(2).getKey()); - assertEquals("value6", ((WriteOperation) operations.get(2)).getElement().getValue()); - - assertTrue(operations.get(3) instanceof DeleteOperation); - assertEquals("key2", operations.get(3).getKey()); - - assertEquals("key5", operations.get(4).getKey()); - assertEquals("value10", ((WriteOperation) operations.get(4)).getElement().getValue()); - } -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/test/resources/unparseable.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/test/resources/unparseable.txt (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-search-parser/src/test/resources/unparseable.txt (revision 0) @@ -1,58 +0,0 @@ -// things which should not be parsed. - -// simplest -slect * from foo - -// really simple from foo where clause -select foo from foo where name = foo -select * from foo where name' != foo -select * from foo where (name < foo -select key from foo where name & foo - -// add some aggregators to the target list -select key,summer(foo) from foo - -// ok, some casting. note that no parsing is done in quoted string which is being cast. -select * from foo where age = bool 'true' -select * from foo where age = (string)10 -select * from foo where age = (long)'11' - -// some ands -select key,value from foo where (age > 100 and zip=20144 -select key,value from foo where (age > 100 and zip=20144 and time) -select key,value from foo where ((age > 100 and zip=20144 and time > 10 and fun>100) - -// some ors -select key,value from foo where (age > 100 or zip=20144 -select key,value from foo where (age > 100 or zip=20144 or > 10) -select key,value from foo where (age > 100 or zip=20144) or time > 10 or fun>100) - -// ors and ands, partying together -select key,value from foo where (age > 100 and zip=20144) or time > 10) -select key,value from foo where ((age > 100 or zip=20144 and (time > 10 or fun>100)) -select key,value from foo where ((age > 100 or zip=20144) time > 10) -select key,value from foo where ((age > 100 and zip'=20144) or (time > 10 and fun>100)) - -// group by? -select * from foo where ((age > 100 and zip=20144) or time > 10) groupby age -select * from foo where ((age > 100 and zip=20144) or time > 10) group by - -// order by? -select * from foo where ((age > 100 and zip=20144) or time > 10) orderby age -select * from foo where ((age > 100 and zip=20144) or time > 10) order by age order by - -// order and group by, mixing order -select * from foo where ((age > 100 and zip=20144) or time > 10) group age order age - -// limit must go on the end! -select * from foo where ((age > 100 and zip=20144) or time > 10) order by age group by age order by zip limit 10 group by zip - -// some quoting chicanery -select * from foo where foo='tom\' -select * from foo where foo=\'tom\foo -select * from foo where foo='tom\u04' - -select * from foo where name = (date)'abcde' -select * from foo where name = (date)'12-20' - -select a, b from foo where bar is not not null \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsRemoteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsRemoteTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/modules/ehcache/event/ClusteredEventsRemoteTest.java (revision 0) @@ -1,77 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.event; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListener; - -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.Set; - -import junit.framework.Assert; - -public class ClusteredEventsRemoteTest extends AbstractCacheTestBase { - - private static final int NODE_COUNT = 5; - - public ClusteredEventsRemoteTest(TestConfig testConfig) { - super("clustered-events-test.xml", testConfig, App.class, App.class, App.class, App.class, App.class); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.clusteredStore.checkContainsKeyOnPut=true"); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super("testRemote", args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - final int index = barrier.await(); - - Assert.assertEquals(0, cache.getSize()); - - barrier.await(); - - cache.put(new Element("key" + index, "value" + index)); - cache.put(new Element("key" + index, "valueUpdated" + index)); - cache.remove("key" + index); - - barrier.await(); - - cache.removeAll(); - - barrier.await(); - - Thread.sleep(10000); - - EhcacheTerracottaEventListener listener = null; - Set listeners = cache.getCacheEventNotificationService().getCacheEventListeners(); - for (CacheEventListener l : listeners) { - if (l instanceof EhcacheTerracottaEventListener) { - listener = (EhcacheTerracottaEventListener) l; - break; - } - } - - Assert.assertNotNull(listener); - - Assert.assertEquals(NODE_COUNT - 1, listener.getPut().size()); - Assert.assertEquals(NODE_COUNT - 1, listener.getUpdate().size()); - Assert.assertEquals(NODE_COUNT - 1, listener.getRemove().size()); - Assert.assertEquals(NODE_COUNT - 1, listener.getRemoveAll()); - } - - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolEvictor.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolEvictor.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/pool/PoolEvictor.java (revision 0) @@ -1,40 +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; - -import java.util.Collection; - -/** - * PoolEvictors are responsible for finding the best candidates in a collection of resources using a shared - * resource pool and performing eviction on them. - * - * @param The type of the resources to free space on. - * @author Ludovic Orban - * @author Alex Snaps - */ -public interface PoolEvictor { - - /** - * Free at least N bytes from a collection of resources - * - * @param from a collection of resources to free from - * @param bytes the number of bytes to free up - * @return true if at least N bytes could be freed - */ - boolean freeSpace(Collection> from, long bytes); - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/AutoVersioningElementTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/AutoVersioningElementTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/AutoVersioningElementTest.java (revision 0) @@ -1,53 +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 static org.junit.Assert.assertEquals; -import net.sf.ehcache.store.MemoryStoreEvictionPolicy; - -import org.junit.Test; - -public class AutoVersioningElementTest { - - @Test - public void testVersioningCanRevertToOldBehavior() { - System.setProperty("net.sf.ehcache.element.version.auto", "true"); - try { - CacheManager cacheManager = CacheManager.getInstance(); - cacheManager.addCache(new Cache("mltest", 50, MemoryStoreEvictionPolicy.LRU, true, null, true, 0, 0, false, 120, null, null, 0, 2, false)); - Cache cache = cacheManager.getCache("mltest"); - - Element a = new Element("a key", "a value", 1L); - cache.put(a); - Element aAfter = cache.get("a key"); - assertEquals(aAfter.getLastUpdateTime(), aAfter.getVersion()); - - Element b = new Element("a key", "a value"); - cache.put(b); - Element bAfter = cache.get("a key"); - assertEquals(bAfter.getLastUpdateTime(), bAfter.getVersion()); - - Element c = new Element("a key", "a value", 3L); - cache.put(c); - Element cAfter = cache.get("a key"); - assertEquals(cAfter.getLastUpdateTime(), cAfter.getVersion()); - } finally { - System.getProperties().remove("net.sf.ehcache.element.version.auto"); - CacheManager.getInstance().shutdown(); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheStatsImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheStatsImpl.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/hibernate/management/impl/EhcacheStatsImpl.java (revision 0) @@ -1,624 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.hibernate.management.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.management.MBeanNotificationInfo; -import javax.management.NotCompliantMBeanException; -import javax.management.Notification; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.hibernate.management.api.EhcacheStats; -import net.sf.ehcache.management.sampled.SampledCacheManager; - -/** - * Implementation of {@link EhcacheStats} - * - *

- * - * @author Abhishek Sanoujam - * - */ -public class EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { - private static final long MILLIS_PER_SECOND = 1000; - private static final MBeanNotificationInfo NOTIFICATION_INFO; - - private final SampledCacheManager sampledCacheManager; - private final CacheManager cacheManager; - private long statsSince = System.currentTimeMillis(); - - static { - final String[] notifTypes = new String[] {CACHE_ENABLED, CACHE_REGION_CHANGED, CACHE_FLUSHED, CACHE_REGION_FLUSHED, - CACHE_STATISTICS_ENABLED, CACHE_STATISTICS_RESET, }; - final String name = Notification.class.getName(); - final String description = "Ehcache Hibernate Statistics Event"; - NOTIFICATION_INFO = new MBeanNotificationInfo(notifTypes, name, description); - } - - /** - * Constructor accepting the backing {@link CacheManager} - * @throws NotCompliantMBeanException - */ - public EhcacheStatsImpl(CacheManager manager) throws NotCompliantMBeanException { - super(EhcacheStats.class); - this.sampledCacheManager = new SampledCacheManager(manager); - this.cacheManager = manager; - } - - /** - * {@inheritDoc} - */ - public void flushRegionCache(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.flush(); - } - } - - /** - * {@inheritDoc} - */ - public void flushRegionCaches() { - for (String name : cacheManager.getCacheNames()) { - Cache cache = this.cacheManager.getCache(name); - if (cache != null) { - cache.flush(); - } - } - - } - - /** - * {@inheritDoc} - */ - public String generateActiveConfigDeclaration() { - return this.cacheManager.getActiveConfigurationText(); - } - - /** - * {@inheritDoc} - */ - public String generateActiveConfigDeclaration(String region) { - return this.cacheManager.getActiveConfigurationText(region); - } - - /** - * {@inheritDoc} - */ - public long getCacheHitCount() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cacheHitCount(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public double getCacheHitRate() { - long now = System.currentTimeMillis(); - double deltaSecs = (double) (now - statsSince) / MILLIS_PER_SECOND; - return getCacheHitCount() / deltaSecs; - } - - /** - * {@inheritDoc} - */ - public long getCacheHitSample() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cacheHitOperation().rate().value().longValue(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public long getCacheMissCount() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cacheMissCount(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public double getCacheMissRate() { - long now = System.currentTimeMillis(); - double deltaSecs = (double) (now - statsSince) / MILLIS_PER_SECOND; - return getCacheMissCount() / deltaSecs; - } - - /** - * {@inheritDoc} - */ - public long getCacheMissSample() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cacheMissOperation().rate().value().longValue(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public long getCachePutCount() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cachePutCount(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public double getCachePutRate() { - long now = System.currentTimeMillis(); - double deltaSecs = (double) (now - statsSince) / MILLIS_PER_SECOND; - return getCachePutCount() / deltaSecs; - } - - /** - * {@inheritDoc} - */ - public long getCachePutSample() { - long count = 0; - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - count += cache.getStatistics().cachePutOperation().rate().value().longValue(); - } - } - return count; - } - - /** - * {@inheritDoc} - */ - public String getOriginalConfigDeclaration() { - return this.cacheManager.getOriginalConfigurationText(); - } - - /** - * {@inheritDoc} - */ - public String getOriginalConfigDeclaration(String region) { - return this.cacheManager.getOriginalConfigurationText(region); - } - - /** - * {@inheritDoc} - */ - public Map> getRegionCacheAttributes() { - Map> result = new HashMap>(); - for (String regionName : this.cacheManager.getCacheNames()) { - result.put(regionName, getRegionCacheAttributes(regionName)); - } - return result; - } - - /** - * {@inheritDoc} - */ - public Map getRegionCacheAttributes(String regionName) { - Map result = new HashMap(); - result.put("Enabled", isRegionCacheEnabled(regionName)); - result.put("LoggingEnabled", isRegionCacheLoggingEnabled(regionName)); - result.put("MaxTTISeconds", getRegionCacheMaxTTISeconds(regionName)); - result.put("MaxTTLSeconds", getRegionCacheMaxTTLSeconds(regionName)); - result.put("TargetMaxInMemoryCount", getRegionCacheTargetMaxInMemoryCount(regionName)); - result.put("TargetMaxTotalCount", getRegionCacheTargetMaxTotalCount(regionName)); - result.put("OrphanEvictionEnabled", isRegionCacheOrphanEvictionEnabled(regionName)); - result.put("OrphanEvictionPeriod", getRegionCacheOrphanEvictionPeriod(regionName)); - return result; - } - - /** - * {@inheritDoc} - */ - public int getRegionCacheMaxTTISeconds(String region) { - Cache cache = cacheManager.getCache(region); - if (cache != null) { - return (int) cache.getCacheConfiguration().getTimeToIdleSeconds(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public int getRegionCacheMaxTTLSeconds(String region) { - Cache cache = cacheManager.getCache(region); - if (cache != null) { - return (int) cache.getCacheConfiguration().getTimeToLiveSeconds(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public int getRegionCacheOrphanEvictionPeriod(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null && cache.isTerracottaClustered()) { - return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEvictionPeriod(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public Map getRegionCacheSamples() { - Map rv = new HashMap(); - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - rv.put(name, new int[] {cache.getStatistics().cacheHitOperation().rate().value().intValue() , - cache.getStatistics().cacheMissNotFoundOperation().rate().value().intValue() , - cache.getStatistics().cacheMissExpiredOperation().rate().value().intValue() , - cache.getStatistics().cachePutOperation().rate().value().intValue()}); - } - } - return rv; - } - - /** - * {@inheritDoc} - */ - public int getRegionCacheTargetMaxInMemoryCount(String region) { - Cache cache = cacheManager.getCache(region); - if (cache != null) { - return cache.getCacheConfiguration().getMaxElementsInMemory(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public int getRegionCacheTargetMaxTotalCount(String region) { - Cache cache = cacheManager.getCache(region); - if (cache != null) { - return cache.getCacheConfiguration().getMaxElementsOnDisk(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public String[] getTerracottaHibernateCacheRegionNames() { - ArrayList rv = new ArrayList(); - for (String name : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(name); - if (cache != null) { - if (cache.getCacheConfiguration().isTerracottaClustered()) { - rv.add(name); - } - } - } - return rv.toArray(new String[] {}); - } - - /** - * {@inheritDoc} - */ - public boolean isRegionCacheEnabled(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return !cache.isDisabled(); - } else { - return false; - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheEnabled(String region, boolean enabled) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.setDisabled(!enabled); - } - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - - /** - * {@inheritDoc} - */ - public boolean isRegionCachesEnabled() { - for (String name : this.cacheManager.getCacheNames()) { - Cache cache = this.cacheManager.getCache(name); - if (cache != null) { - if (cache.isDisabled()) { - return false; - } - } - } - return true; - } - - /** - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#setRegionCachesEnabled(boolean) - */ - public void setRegionCachesEnabled(final boolean flag) { - for (String name : this.cacheManager.getCacheNames()) { - Cache cache = this.cacheManager.getCache(name); - if (cache != null) { - cache.setDisabled(!flag); - } - } - sendNotification(CACHE_ENABLED, flag); - } - - /** - * {@inheritDoc} - */ - public boolean isRegionCacheLoggingEnabled(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return cache.getCacheConfiguration().getLogging(); - } else { - return false; - } - } - - /** - * {@inheritDoc} - */ - public boolean isRegionCacheOrphanEvictionEnabled(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null && cache.isTerracottaClustered()) { - return cache.getCacheConfiguration().getTerracottaConfiguration().getOrphanEviction(); - } else { - return false; - } - } - - /** - * {@inheritDoc} - */ - public boolean isTerracottaHibernateCache(String region) { - Cache cache = cacheManager.getCache(region); - if (cache != null) { - return cache.getCacheConfiguration().isTerracottaClustered(); - } else { - return false; - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheLoggingEnabled(String region, boolean loggingEnabled) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.getCacheConfiguration().setLogging(loggingEnabled); - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheMaxTTISeconds(String region, int maxTTISeconds) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.getCacheConfiguration().setTimeToIdleSeconds(maxTTISeconds); - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheMaxTTLSeconds(String region, int maxTTLSeconds) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.getCacheConfiguration().setTimeToLiveSeconds(maxTTLSeconds); - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheTargetMaxInMemoryCount(String region, int targetMaxInMemoryCount) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.getCacheConfiguration().setMaxElementsInMemory(targetMaxInMemoryCount); - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - } - - /** - * {@inheritDoc} - */ - public void setRegionCacheTargetMaxTotalCount(String region, int targetMaxTotalCount) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - cache.getCacheConfiguration().setMaxElementsOnDisk(targetMaxTotalCount); - sendNotification(CACHE_REGION_CHANGED, getRegionCacheAttributes(region), region); - } - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsInMemory(java.lang.String) - */ - public int getNumberOfElementsInMemory(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return (int) cache.getStatistics().getLocalHeapSize(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOffHeap(java.lang.String) - */ - public int getNumberOfElementsOffHeap(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return (int) cache.getStatistics().getLocalOffHeapSize(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getNumberOfElementsOnDisk(java.lang.String) - */ - public int getNumberOfElementsOnDisk(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return (int) cache.getStatistics().getLocalDiskSize(); - } else { - return -1; - } - } - - /** - * {@inheritDoc} - */ - public long getMaxGetTimeMillis() { - long rv = 0; - for (String cacheName : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(cacheName); - if (cache != null) { - rv = Math.max(rv, TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheSearchOperation().latency().maximum().value().longValue(), - TimeUnit.NANOSECONDS)); - } - } - return rv; - } - - /** - * {@inheritDoc} - */ - public long getMinGetTimeMillis() { - long rv = 0; - for (String cacheName : cacheManager.getCacheNames()) { - Cache cache = cacheManager.getCache(cacheName); - if (cache != null) { - rv = Math.max(rv, TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheSearchOperation().latency().minimum().value().longValue(), - TimeUnit.NANOSECONDS)); - // TODO CRSS why max? - } - } - return rv; - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMaxGetTimeMillis(java.lang.String) - */ - public long getMaxGetTimeMillis(String cacheName) { - Cache cache = cacheManager.getCache(cacheName); - if (cache != null) { - return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().maximum().value().longValue(), - TimeUnit.NANOSECONDS); - } else { - return 0; - } - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getMinGetTimeMillis(java.lang.String) - */ - public long getMinGetTimeMillis(String cacheName) { - Cache cache = cacheManager.getCache(cacheName); - if (cache != null) { - return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().minimum().value().longValue(), - TimeUnit.NANOSECONDS); - } else { - return 0; - } - } - - /** - * {@inheritDoc} - * - * @see net.sf.ehcache.hibernate.management.api.EhcacheStats#getAverageGetTimeMillis(java.lang.String) - */ - public float getAverageGetTimeMillis(String region) { - Cache cache = this.cacheManager.getCache(region); - if (cache != null) { - return TimeUnit.MILLISECONDS.convert(cache.getStatistics().cacheGetOperation().latency().average().value().longValue(), - TimeUnit.NANOSECONDS); - } else { - return -1f; - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void doDispose() { - // no-op - } - - /** - * @see BaseEmitterBean#getNotificationInfo() - */ - @Override - public MBeanNotificationInfo[] getNotificationInfo() { - return new MBeanNotificationInfo[]{NOTIFICATION_INFO}; - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ExpiryListenerClient1.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ExpiryListenerClient1.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/ExpiryListenerClient1.java (revision 0) @@ -1,82 +0,0 @@ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListener; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import java.util.concurrent.Callable; -import java.util.concurrent.atomic.AtomicLong; - -import junit.framework.Assert; - -public class ExpiryListenerClient1 extends ClientBase implements CacheEventListener { - - private final AtomicLong localExpiredCount = new AtomicLong(); - - public ExpiryListenerClient1(String[] args) { - super("test", args); - } - - public static void main(String[] args) { - new ExpiryListenerClient1(args).run(); - } - - @Override - protected void runTest(final Cache cache, final Toolkit toolkit) throws Throwable { - cache.getCacheEventNotificationService().registerListener(this); - cache.put(new Element("key", "value")); - // assume the TTL of the cache is set to 3s - System.out.println("TTL value of the cache: " + cache.getCacheConfiguration().getTimeToLiveSeconds()); - Assert.assertEquals(3, cache.getCacheConfiguration().getTimeToLiveSeconds()); - - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - return cache.getSize() == 0 && localExpiredCount.get() > 0; - } - }); - // assert eviction has already occurred - Assert.assertEquals(0, cache.getSize()); - Assert.assertTrue(localExpiredCount.get() > 0); - } - - public void dispose() { - // - } - - public void notifyElementEvicted(Ehcache cache, Element element) { - // - } - - public void notifyElementExpired(Ehcache cache, Element element) { - localExpiredCount.incrementAndGet(); - Assert.assertNotNull(element.getKey()); - Assert.assertNull(element.getValue()); - System.out.println("Got evicted: " + element); - } - - public void notifyElementPut(Ehcache cache, Element element) throws CacheException { - // - } - - public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException { - // - } - - public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException { - // - } - - public void notifyRemoveAll(Ehcache cache) { - // - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ClusteredSoftLockIDKey.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ClusteredSoftLockIDKey.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/transaction/ClusteredSoftLockIDKey.java (revision 0) @@ -1,66 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.transaction; - -import net.sf.ehcache.transaction.SoftLockID; -import net.sf.ehcache.transaction.TransactionID; - -import java.io.Serializable; - -/** - * @author Ludovic Orban - */ -// Dont think We need this class . -public class ClusteredSoftLockIDKey implements Serializable { - private static final int PRIME = 31; - private final TransactionID transactionID; - private final Object key; - - public ClusteredSoftLockIDKey(SoftLockID softLockId) { - this.transactionID = softLockId.getTransactionID(); - this.key = softLockId.getKey(); - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - int hashCode = PRIME; - - hashCode *= transactionID.hashCode(); - hashCode *= key.hashCode(); - - return hashCode; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object object) { - if (object instanceof ClusteredSoftLockIDKey) { - ClusteredSoftLockIDKey other = (ClusteredSoftLockIDKey) object; - - if (!transactionID.equals(other.transactionID)) { return false; } - - if (!key.equals(other.key)) { return false; } - - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return "Clustered Soft Lock ID [transactionID: " + transactionID + ", key: " + key + "]"; - } - - - - -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/DoubleConfigStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/DoubleConfigStandaloneCacheTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/DoubleConfigStandaloneCacheTest.java (revision 0) @@ -1,45 +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; - -/** - * @author cdennis - */ -public class DoubleConfigStandaloneCacheTest extends AbstractCacheTestBase { - - public DoubleConfigStandaloneCacheTest(TestConfig testConfig) { - super("double-config-cache-test.xml", testConfig); - } - - @Override - protected void evaluateClientOutput(String clientName, int exitCode, File output) throws Throwable { - if ((exitCode == 0)) { throw new AssertionError("Client " + clientName + " exited with exit code: " + exitCode); } - - FileReader fr = null; - try { - fr = new FileReader(output); - BufferedReader reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - if (st.contains("InvalidConfigurationException")) return; - } - throw new AssertionError("Client " + clientName + " did not pass"); - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - } catch (Exception e) { - // - } - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/TerracottaClient.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/TerracottaClient.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/terracotta/TerracottaClient.java (revision 0) @@ -1,235 +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.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.cluster.CacheCluster; -import net.sf.ehcache.config.TerracottaClientConfiguration; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Method; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; - -/** - * Class encapsulating the idea of a Terracotta client. Provides access to the {@link ClusteredInstanceFactory} for the cluster - * - * @author Abhishek Sanoujam - * - */ -public class TerracottaClient { - - /** - * System property used to specify the secrect provider to use - */ - public static final String CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTY = "com.terracotta.express.SecretProvider"; - - private static final Logger LOGGER = LoggerFactory.getLogger(TerracottaClient.class); - private static final int REJOIN_SLEEP_MILLIS_ON_EXCEPTION = Integer.getInteger("net.sf.ehcache.rejoin.sleepMillisOnException", 5000); - - private static final String CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAME = "net.sf.ehcache.terracotta.security.SingletonSecretProviderWrapper"; - - private final TerracottaClientConfiguration terracottaClientConfiguration; - private volatile ClusteredInstanceFactoryWrapper clusteredInstanceFactory; - private final TerracottaCacheCluster cacheCluster = new TerracottaCacheCluster(); - private final CacheManager cacheManager; - private ExecutorService l1TerminatorThreadPool; - - /** - * Constructor accepting the {@link CacheManager} and the {@link TerracottaClientConfiguration} - * - * @param cacheManager the cache manager to be clustered - * @param terracottaClientConfiguration the configuration for the terracotta client - */ - public TerracottaClient(CacheManager cacheManager, TerracottaClientConfiguration terracottaClientConfiguration) { - this.cacheManager = cacheManager; - this.terracottaClientConfiguration = terracottaClientConfiguration; - if (terracottaClientConfiguration != null) { - terracottaClientConfiguration.freezeConfig(); - - // If we're going clustered and secured and a secret provider is configured, it's time to wrap the - // secret provider before the L1 can use it. - // We must set this ehcache secret provider as both the L1 and the agent will use a different instance - // and will want to fetch the password. In case of a console fetcher, the password would be asked twice. - String secretProviderClassname = System.getProperty(CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTY); - String tcUrl = terracottaClientConfiguration.getUrl(); - if (tcUrl != null && tcUrl.contains("@") && secretProviderClassname != null) { - try { - System.setProperty(CUSTOM_SECRET_PROVIDER_SYSTEM_PROPERTY, CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAME); - Class secretProviderWrapperClass = Class.forName(CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAME); - secretProviderWrapperClass.getMethod("useAsDelegate", String.class).invoke(secretProviderWrapperClass, secretProviderClassname); - } catch (Exception e) { - throw new CacheException("Unable to initialize " + CUSTOM_SECRET_PROVIDER_WRAPPER_CLASSNAME, e); - } - } - } - } - - /* - * --------- THIS METHOD IS NOT FOR PUBLIC USE ---------- - * private method, used in unit-tests using reflection - * - * @param testHelper the mock TerracottaClusteredInstanceHelper for testing - */ - private static void setTestMode(TerracottaClusteredInstanceHelper testHelper) { - try { - Method method = TerracottaClusteredInstanceHelper.class.getDeclaredMethod("setTestMode", - TerracottaClusteredInstanceHelper.class); - method.setAccessible(true); - method.invoke(null, testHelper); - } catch (Exception e) { - // just print a stack trace and ignore - e.printStackTrace(); - } - } - - /** - * Returns the {@link ClusteredInstanceFactory} associated with this client - * - * @return The ClusteredInstanceFactory - */ - public ClusteredInstanceFactory getClusteredInstanceFactory() { - return clusteredInstanceFactory; - } - - /** - * Returns true if the clusteredInstanceFactory was created, otherwise returns false. - * Multiple threads calling this method block and only one of them creates the factory. - * - * @return true if the clusteredInstanceFactory was created, otherwise returns false - */ - public boolean createClusteredInstanceFactory() { - if (terracottaClientConfiguration == null) { - return false; - } - if (clusteredInstanceFactory != null) { - return false; - } - final boolean created; - synchronized (this) { - if (clusteredInstanceFactory == null) { - clusteredInstanceFactory = createNewClusteredInstanceFactory(); - created = true; - } else { - created = false; - } - } - return created; - } - - /** - * Get the {@link CacheCluster} associated with this client - * - * @return the {@link CacheCluster} associated with this client - */ - public TerracottaCacheCluster getCacheCluster() { - if (clusteredInstanceFactory == null) { - throw new CacheException("Cannot get CacheCluster as ClusteredInstanceFactory has not been initialized yet."); - } - return cacheCluster; - } - - /** - * Shuts down the client - */ - public synchronized void shutdown() { - if (clusteredInstanceFactory != null) { - shutdownClusteredInstanceFactoryWrapper(clusteredInstanceFactory); - } - } - - /** - * Wait for the Orchestrator for this CacheManager - * @param cacheManagerName Name of the cache manager - */ - public void waitForOrchestrator(String cacheManagerName) { - clusteredInstanceFactory.waitForOrchestrator(cacheManagerName); - } - - private void shutdownClusteredInstanceFactoryWrapper(ClusteredInstanceFactoryWrapper clusteredInstanceFactory) { - clusteredInstanceFactory.getActualFactory().getTopology().removeAllListeners(); - clusteredInstanceFactory.shutdown(); - } - - private synchronized ClusteredInstanceFactoryWrapper createNewClusteredInstanceFactory() { - // shut down the old factory - if (clusteredInstanceFactory != null) { - info("Shutting down old ClusteredInstanceFactory..."); - shutdownClusteredInstanceFactoryWrapper(clusteredInstanceFactory); - } - info("Creating new ClusteredInstanceFactory"); - ClusteredInstanceFactory factory; - factory = TerracottaClusteredInstanceHelper.getInstance().newClusteredInstanceFactory(terracottaClientConfiguration, cacheManager.getConfiguration().getClassLoader()); - CacheCluster underlyingCacheCluster = factory.getTopology(); - - cacheCluster.setUnderlyingCacheCluster(underlyingCacheCluster); - - return new ClusteredInstanceFactoryWrapper(this, factory); - } - - private synchronized ExecutorService getL1TerminatorThreadPool() { - if (l1TerminatorThreadPool == null) { - l1TerminatorThreadPool = Executors.newCachedThreadPool(new ThreadFactory() { - private final ThreadGroup threadGroup = new ThreadGroup("Rejoin Terminator Thread Group"); - - public Thread newThread(Runnable runnable) { - Thread t = new Thread(threadGroup, runnable, "L1 Terminator"); - t.setDaemon(true); - return t; - } - }); - } - return l1TerminatorThreadPool; - } - - private void info(String msg) { - info(msg, null); - } - - private void info(String msg, Throwable t) { - if (t == null) { - LOGGER.info(getLogPrefix() + msg); - } else { - LOGGER.info(getLogPrefix() + msg, t); - } - } - - private String getLogPrefix() { - return "Thread [" + Thread.currentThread().getName() + "] [cacheManager: " + getCacheManagerName() + "]: "; - } - - private void debug(String msg) { - LOGGER.debug(getLogPrefix() + msg); - } - - private void warn(String msg) { - LOGGER.warn(getLogPrefix() + msg); - } - - private String getCacheManagerName() { - if (cacheManager.isNamed()) { - return "'" + cacheManager.getName() + "'"; - } else { - return "no name"; - } - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/SimpleNodeAttribute.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/SimpleNodeAttribute.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/SimpleNodeAttribute.java (revision 0) @@ -1,256 +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; - -/** - * Implementation of the {@link NodeAttribute} interface - * - * @author Abhishek Sanoujam - * - */ -public class SimpleNodeAttribute implements NodeAttribute { - - private final String name; - private String value; - private String defaultValue; - private boolean optional = true; - - /** - * Constructor accepting the name of the attribute - * - * @param name - * the name of the attribute - */ - public SimpleNodeAttribute(String name) { - this(name, (String) null); - } - - /** - * Constructor accepting name and Enum value of the attribute - * - * @param name - * the name of the attribute - * @param value - * the Enum value of the attribute - */ - public SimpleNodeAttribute(String name, Enum value) { - this(name, value.name().toLowerCase()); - } - - /** - * Constructor accepting name and int value of the attribute - * - * @param name - * the name of the attribute - * @param value - * the int value of the attribute - */ - public SimpleNodeAttribute(String name, int value) { - this(name, String.valueOf(value)); - } - - /** - * Constructor accepting name and long value of the attribute - * - * @param name - * the name of the attribute - * @param value - * the long value of the attribute - */ - public SimpleNodeAttribute(String name, long value) { - this(name, String.valueOf(value)); - } - - /** - * Constructor accepting name and boolean value of the attribute - * - * @param name - * the name of the attribute - * @param value - * the boolean value of the attribute - */ - public SimpleNodeAttribute(String name, boolean value) { - this(name, String.valueOf(value)); - } - - /** - * Constructor accepting name and String value of the attribute - * - * @param name - * the name of the attribute - * @param value - * the String value of the attribute - */ - public SimpleNodeAttribute(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * {@inheritDoc} - */ - public String getName() { - return name; - } - - /** - * {@inheritDoc} - */ - public String getValue() { - return value; - } - - /** - * {@inheritDoc} - */ - public boolean isOptional() { - return optional; - } - - /** - * {@inheritDoc} - */ - public void setOptional(boolean optional) { - this.optional = optional; - } - - /** - * {@inheritDoc} - */ - public String getDefaultValue() { - return defaultValue; - } - - /** - * {@inheritDoc} - */ - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - /** - * {@inheritDoc} - */ - public void setValue(String value) { - this.value = value; - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof NodeAttribute)) { - return false; - } - NodeAttribute other = (NodeAttribute) obj; - if (name == null) { - if (other.getName() != null) { - return false; - } - } else if (!name.equals(other.getName())) { - return false; - } - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return "SimpleAttribute [name=" + name + "]"; - } - - /** - * {@inheritDoc} - */ - public SimpleNodeAttribute optional(boolean optional) { - this.optional = optional; - return this; - } - - /** - * {@inheritDoc} - */ - public SimpleNodeAttribute defaultValue(String defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * Same as {@link #defaultValue(String)} using String.valueOf(defaultValue) - * - * @param defaultValue - * the default value - * @return the same instance - */ - public SimpleNodeAttribute defaultValue(boolean defaultValue) { - return this.defaultValue(String.valueOf(defaultValue)); - } - - /** - * Same as {@link #defaultValue(String)} using String.valueOf(defaultValue) - * - * @param defaultValue - * the default value - * @return the same instance - */ - public SimpleNodeAttribute defaultValue(int defaultValue) { - return this.defaultValue(String.valueOf(defaultValue)); - } - - /** - * Same as {@link #defaultValue(String)} using String.valueOf(defaultValue) - * - * @param defaultValue - * the default value - * @return the same instance - */ - public SimpleNodeAttribute defaultValue(Enum defaultValue) { - return this.defaultValue(defaultValue.name().toLowerCase()); - } - - /** - * Same as {@link #defaultValue(String)} using String.valueOf(defaultValue) - * - * @param defaultValue - * the default value - * @return the same instance - */ - public SimpleNodeAttribute defaultValue(long defaultValue) { - return this.defaultValue(String.valueOf(defaultValue)); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/management/package.html (revision 0) @@ -1,10 +0,0 @@ - - - - -This package contains JMX MBeans and implementations for management of ehcache. -

-The client API is exposed through the ManagementService. Use ManagementService.registerMBeans(...) -to register a selection of MBeans to the MBeanServer provided to the method. - - Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/package.html (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/writer/writebehind/operations/package.html (revision 0) @@ -1,7 +0,0 @@ - - - - -This package contains the operations for the write behind functionalities. - - \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/TestCacheWriterRetries.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/TestCacheWriterRetries.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/writer/TestCacheWriterRetries.java (revision 0) @@ -1,237 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.writer; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Element; -import net.sf.ehcache.writer.writebehind.operations.SingleOperationType; - -public class TestCacheWriterRetries extends AbstractTestCacheWriter { - private final int retries; - private final List writerEvents = new ArrayList(); - private final Map retryCount = new HashMap(); - private final Map writeCount = new HashMap(); - private final Map deleteCount = new HashMap(); - private final Map> thrownAwayElements = new HashMap>(); - private volatile boolean throwing = true; - - { - for (SingleOperationType singleOperationType : SingleOperationType.values()) { - thrownAwayElements.put(singleOperationType, new ArrayList()); - } - } - - public TestCacheWriterRetries(int retries) { - this.retries = retries; - } - - public List getWriterEvents() { - return writerEvents; - } - - public Map getWriteCount() { - return writeCount; - } - - public Map getDeleteCount() { - return deleteCount; - } - - private void failUntilNoMoreRetries(Object key) { - int remainingRetries; - if (!retryCount.containsKey(key)) { - remainingRetries = retries; - } else { - remainingRetries = retryCount.get(key); - } - if (remainingRetries-- > 0) { - retryCount.put(key, remainingRetries); - throw new RuntimeException("Throwing exception to test retries, " + remainingRetries + " remaining for " + key); - } - retryCount.remove(key); - } - - private void increaseWriteCount(Object key) { - if (!writeCount.containsKey(key)) { - writeCount.put(key, 1); - } else { - writeCount.put(key, writeCount.get(key) + 1); - } - } - - private void increaseDeleteCount(Object key) { - if (!deleteCount.containsKey(key)) { - deleteCount.put(key, 1); - } else { - deleteCount.put(key, deleteCount.get(key) + 1); - } - } - - private void put(Object key, Element element) { - writerEvents.add(new WriterEvent(element)); - increaseWriteCount(key); - } - - @Override - public synchronized void write(Element element) throws CacheException { - final Object key = element.getObjectKey(); - if (throwing) { - failUntilNoMoreRetries(key); - } - put(key, element); - } - - @Override - public synchronized void writeAll(Collection elements) throws CacheException { - Iterator it = elements.iterator(); - while (it.hasNext()) { - Element element = it.next(); - // fail on the last item in the batch - final Object key = element.getObjectKey(); - if (!it.hasNext() && throwing) { - failUntilNoMoreRetries(key); - } - put(key, element); - } - } - - private void remove(Object key) { - writerEvents.add(new WriterEvent(key)); - increaseDeleteCount(key); - } - - @Override - public synchronized void delete(CacheEntry entry) throws CacheException { - Object key = entry.getKey(); - if (throwing) { - failUntilNoMoreRetries(key); - } - remove(key); - } - - @Override - public synchronized void deleteAll(Collection entries) throws CacheException { - Iterator it = entries.iterator(); - while (it.hasNext()) { - CacheEntry entry = it.next(); - Object key = entry.getKey(); - if (!it.hasNext() && throwing) { - failUntilNoMoreRetries(key); - } - remove(key); - } - } - - @Override - public void throwAway(final Element element, final SingleOperationType operationType, final RuntimeException e) { - thrownAwayElements.get(operationType).add(element); - } - - public void setThrowing(final boolean throwing) { - this.throwing = throwing; - } - - public boolean isThrowing() { - return throwing; - } - - public List getThrownAwayElements(SingleOperationType type) { - return Collections.unmodifiableList(thrownAwayElements.get(type)); - } - - class WriterEvent { - - private final Object removedKey; - private final Element addedElement; - private final long time; - private final int writtenSize; - private final Map writeCount; - private final Map deleteCount; - - WriterEvent(Object key) { - this.removedKey = key; - this.addedElement = null; - time = System.nanoTime(); - writtenSize = TestCacheWriterRetries.this.writerEvents.size(); - writeCount = new HashMap(TestCacheWriterRetries.this.writeCount); - deleteCount = new HashMap(TestCacheWriterRetries.this.deleteCount); - } - - WriterEvent(Element element) { - this.removedKey = null; - this.addedElement = element; - time = System.nanoTime(); - writtenSize = TestCacheWriterRetries.this.writerEvents.size(); - writeCount = new HashMap(TestCacheWriterRetries.this.writeCount); - deleteCount = new HashMap(TestCacheWriterRetries.this.deleteCount); - } - - int getWrittenSize() { - return writtenSize; - } - - int getWriteCount(Object key) { - Integer value = writeCount.get(key); - if (value == null) { - return 0; - } else { - return value; - } - } - - int getDeleteCount(Object key) { - Integer value = deleteCount.get(key); - if (value == null) { - return 0; - } else { - return value; - } - } - - long getTime() { - return time; - } - - Element getAddedElement() { - return addedElement; - } - - Object getRemovedKey() { - return removedKey; - } - - @Override - public String toString() { - if (addedElement != null) { - return "ADDED : " + addedElement.getObjectKey() + " @ " + time; - } else if (removedKey != null) { - return "REMOVED : " + removedKey + " @ " + time; - } else { - return "UNKNOWN : @ " + time; - } - } - } -} Index: rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/system-tests/src/test/java/org/terracotta/ehcache/tests/BasicStandaloneCacheTest.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 org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import com.tc.test.config.model.TestConfig; - -@Category(CheckShorts.class) -public class BasicStandaloneCacheTest extends AbstractCacheTestBase { - - public BasicStandaloneCacheTest(TestConfig testConfig) { - super("basic-cache-test.xml", testConfig); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/web/ShutdownListener.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/web/ShutdownListener.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/constructs/web/ShutdownListener.java (revision 0) @@ -1,78 +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.web; - -import net.sf.ehcache.CacheManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - - - - -import java.util.List; - -/** - * A ServletContextListener that shutsdown CacheManager. Use this when you want to shutdown - * ehcache automatically when the web application is shutdown. - *

- * To receive notification events, this class must be configured in the deployment - * descriptor for the web application. - * - * To do so, add the following to web.xml in your web application: - *

- * <listener>
- *      <listener-class>net.sf.ehcache.constructs.web.ShutdownListener</listener-class>
- * </listener>
- * 
- * - * @author Daniel Wiell - * @author Greg Luck - * @version $Id: ShutdownListener.java 744 2008-08-16 20:10:49Z gregluck $ - */ -public class ShutdownListener implements ServletContextListener { - - private static final Logger LOG = LoggerFactory.getLogger(ShutdownListener.class); - - /** - * Notification that the web application is ready to process requests. - * - * @param servletContextEvent - */ - public void contextInitialized(ServletContextEvent servletContextEvent) { - //nothing required - } - - /** - * Notification that the servlet context is about to be shut down. - *

- * Shuts down all cache managers known to {@link CacheManager#ALL_CACHE_MANAGERS} - * - * @param servletContextEvent - */ - public void contextDestroyed(ServletContextEvent servletContextEvent) { - List knownCacheManagers = CacheManager.ALL_CACHE_MANAGERS; - if (LOG.isDebugEnabled()) { - LOG.debug("Shutting down " + knownCacheManagers.size() + " CacheManagers."); - } - while (!knownCacheManagers.isEmpty()) { - ((CacheManager) CacheManager.ALL_CACHE_MANAGERS.get(0)).shutdown(); - } - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/CircularLossyQueue.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/CircularLossyQueue.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/util/CircularLossyQueue.java (revision 0) @@ -1,126 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.util; - -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; - -/** - * An implementation of a CircularQueue data-structure. - * When the number of items added exceeds the maximum capacity, items that were - * added first are lost. - * - * @param - * Type of the item's to add in this queue - * - * @author Abhishek Sanoujam - * @since 1.7 - */ -public class - -CircularLossyQueue { - private final AtomicReference[] circularArray; - private final int maxSize; - - private final AtomicLong currentIndex = new AtomicLong(-1); - - /** - * Constructs the circular queue with the specified capacity - * - * @param size - */ - public CircularLossyQueue(int size) { - this.circularArray = new AtomicReference[size]; - for (int i = 0; i < size; i++) { - this.circularArray[i] = new AtomicReference(); - } - this.maxSize = size; - } - - /** - * Adds a new item - * - * @param newVal - */ - public void push(T newVal) { - int index = (int) (currentIndex.incrementAndGet() % maxSize); - circularArray[index].set(newVal); - } - - /** - * Returns an array of the current elements in the queue. The order of - * elements is in reverse order of the order items were added. - * - * @param type - * @return An array containing the current elements in the queue. The first - * element of the array is the tail of the queue and the last - * element is the head of the queue - */ - public T[] toArray(T[] type) { - System.getProperties(); - - if (type.length > maxSize) { - throw new IllegalArgumentException("Size of array passed in cannot be greater than " + maxSize); - } - - int curIndex = getCurrentIndex(); - for (int k = 0; k < type.length; k++) { - int index = getIndex(curIndex - k); - type[k] = circularArray[index].get(); - } - return type; - } - - private int getIndex(int index) { - return (index < 0 ? index + maxSize : index); - } - - /** - * Returns value at the tail of the queue - * - * @return Value at the tail of the queue - */ - public T peek() { - if (depth() == 0) { - return null; - } - return circularArray[getIndex(getCurrentIndex())].get(); - } - - /** - * Returns true if the queue is empty, otherwise false - * - * @return true if the queue is empty, false otherwise - */ - public boolean isEmtpy() { - return depth() == 0; - } - - private int getCurrentIndex() { - return (int) (currentIndex.get() % maxSize); - } - - /** - * Returns the number of items currently in the queue - * - * @return the number of items in the queue - */ - public int depth() { - long currInd = currentIndex.get() + 1; - return currInd >= maxSize ? maxSize : (int) currInd; - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/BruteForceSource.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/BruteForceSource.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/BruteForceSource.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.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.config.Searchable; - -/** - * This interface exposes what is required by the {@link BruteForceSearchManager} - * - * @author ljacomet - */ -interface BruteForceSource { - - /** - * An {@link Iterable} over the elements from the source. - * The elements returned are in the form expected by the {@link BruteForceSearchManager}. - * - * @return an Iterable of Element - */ - Iterable elements(); - - /** - * Returns the {@link Searchable} configuration of the source. - * - * @return the Searchable configuration - */ - Searchable getSearchable(); - - /** - * Transform the element so that it can be used for indexing by the {@link BruteForceSearchManager}. - * - * @param element the element to transform - * @return the transformed element - */ - Element transformForIndexing(Element element); -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/OrderedEventListenerForDiskStoreBackendTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/OrderedEventListenerForDiskStoreBackendTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/event/OrderedEventListenerForDiskStoreBackendTest.java (revision 0) @@ -1,165 +0,0 @@ -package net.sf.ehcache.event; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.store.CacheStore; -import net.sf.ehcache.store.DefaultElementValueComparator; -import net.sf.ehcache.store.disk.DiskStorageFactory; -import net.sf.ehcache.store.disk.DiskStore; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.mockito.InOrder; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Field; - -/** - * OrderedEventListenerForDiskStoreBackendTest - */ -@Category(CheckShorts.class) -public class OrderedEventListenerForDiskStoreBackendTest { - - private static CacheManager cacheManager; - private static DiskStore diskStore; - private static Cache diskCache; - private InternalCacheEventListener listener; - - @Before - public void setUp() throws Exception { - cacheManager = CacheManager.create(new Configuration().name("diskStoreTest")); - diskCache = new Cache(new CacheConfiguration().name("disk-event-cache").maxEntriesLocalHeap(10).overflowToDisk(true) - .eternal(false).timeToLiveSeconds(10).timeToIdleSeconds(10).diskPersistent(false).diskExpiryThreadIntervalSeconds(1) - .diskSpoolBufferSizeMB(10)); - cacheManager.addCache(diskCache); - Field compoundStoreField = Cache.class.getDeclaredField("compoundStore"); - compoundStoreField.setAccessible(true); - CacheStore cacheStore = (CacheStore)compoundStoreField.get(diskCache); - Field field = CacheStore.class.getDeclaredField("authoritativeTier"); - field.setAccessible(true); - diskStore = (DiskStore)field.get(cacheStore); - - listener = mock(InternalCacheEventListener.class); - diskCache.getCacheEventNotificationService().registerOrderedListener(listener); - } - - @Test - public void putTest() { - Element element = new Element("putKey", "value", 0); - diskStore.put(element); - verify(listener).notifyElementPut(any(Ehcache.class), eq(element)); - } - - @Test - public void putAndReplaceTest() { - String key = "putReplaceKey"; - Element element = new Element(key, "value", 0); - diskStore.put(element); - Element otherElement = new Element(key, "otherVal", 0); - diskStore.put(otherElement); - - InOrder inOrder = inOrder(listener); - inOrder.verify(listener).notifyElementRemoved(any(Ehcache.class), eq(element)); - inOrder.verify(listener).notifyElementPut(any(Ehcache.class), eq(otherElement)); - } - - @Test - public void putFaultedTest() { - Element element = new Element("faultedKey", "value", 0); - diskStore.putFaulted(element); - verify(listener).notifyElementPut(any(Ehcache.class), eq(element)); - } - - @Test - public void putIfAbsentTest() { - String key = "putIfAbsentKey"; - Element element = new Element(key, "value", 0); - diskStore.putIfAbsent(element); - verify(listener).notifyElementPut(any(Ehcache.class), eq(element)); - reset(listener); - - diskStore.putIfAbsent(new Element(key, "otherVal", 0)); - verifyZeroInteractions(listener); - - } - - @Test - public void replaceTest() { - String key = "replaceKey"; - Element oldElement = new Element(key, "oldValue", 0); - diskStore.put(oldElement); - Element element = new Element(key, "value", 0); - diskStore.replace(element); - - InOrder inOrder = inOrder(listener); - inOrder.verify(listener).notifyElementRemoved(any(Ehcache.class), eq(oldElement)); - inOrder.verify(listener).notifyElementPut(any(Ehcache.class), eq(element)); - } - - @Test - public void compareAndReplaceTest() { - String key = "casKey"; - Element oldElement = new Element(key, "oldValue", 0); - diskStore.put(oldElement); - Element element = new Element(key, "value", 0); - diskStore.replace(oldElement, element, new DefaultElementValueComparator(diskCache.getCacheConfiguration())); - - InOrder inOrder = inOrder(listener); - inOrder.verify(listener).notifyElementRemoved(any(Ehcache.class), eq(oldElement)); - inOrder.verify(listener).notifyElementPut(any(Ehcache.class), eq(element)); - } - - @Test - public void removeTest() { - String key = "removeKey"; - Element element = new Element(key, "value", 0); - diskStore.put(element); - - diskStore.remove(key); - verify(listener).notifyElementRemoved(any(Ehcache.class), eq(element)); - reset(listener); - - diskStore.put(element); - diskStore.removeElement(element, new DefaultElementValueComparator(diskCache.getCacheConfiguration())); - verify(listener).notifyElementRemoved(any(Ehcache.class), eq(element)); - } - - @Test - public void evictTest() { - String key = "evictKey"; - Element element = new Element(key, "value", 0); - diskStore.put(element); - - int maxTries = 100; - int tryCount = 0; - while (tryCount < maxTries) { - if (diskStore.evict(key, (DiskStorageFactory.DiskSubstitute)diskStore.unretrievedGet(key))) { - verify(listener).notifyElementRemoved(any(Ehcache.class), eq(element)); - return; - } else { - tryCount++; - } - } - assertThat(diskStore.containsKey(element.getObjectKey()), is(false)); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/PoolableMemoryStoreTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/store/PoolableMemoryStoreTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/EhCacheRegionFactoryTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/EhCacheRegionFactoryTest.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/test/java/net/sf/ehcache/hibernate/EhCacheRegionFactoryTest.java (revision 0) @@ -1,70 +0,0 @@ -package net.sf.ehcache.hibernate; - -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.lang.reflect.Field; -import java.net.URL; -import java.util.Map; - -import net.sf.ehcache.CacheManager; -import org.hibernate.HibernateException; -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -/** - * @author Alex Snaps - */ -@Category(CheckShorts.class) -public class EhCacheRegionFactoryTest { - - private static Configuration config; - - - @BeforeClass - public static void setUp() throws Exception { - System.setProperty("derby.system.home", "target/derby"); - config = new Configuration().configure("/hibernate-config/hibernate.cfg.xml"); - config.setProperty("hibernate.hbm2ddl.auto", "create"); - } - - @Test - public void testLoadingFromOutsideTheClasspath() { - URL resource = Thread.currentThread().getContextClassLoader().getResource("hibernate-config/ehcache.xml"); - config.setProperty("net.sf.ehcache.configurationResourceName", "file://" + resource.getFile()); - SessionFactory sessionFactory = null; - try { - sessionFactory = config.buildSessionFactory(); - } catch (HibernateException e) { - e.printStackTrace(); - fail("This should have succeeded"); - } - assertNotNull("Session factory should have been successfully created!", sessionFactory); - sessionFactory.close(); - } - - @Test - public void testOverwritesCacheManager() throws NoSuchFieldException, IllegalAccessException { - URL resource = Thread.currentThread().getContextClassLoader().getResource("hibernate-config/ehcache.xml"); - config.setProperty("net.sf.ehcache.configurationResourceName", "file://" + resource.getFile()); - config.setProperty("net.sf.ehcache.cacheManagerName", "overwrittenCacheManagerName"); - SessionFactory sessionFactory = config.buildSessionFactory(); - final Field cache_managers_map = CacheManager.class.getDeclaredField("CACHE_MANAGERS_MAP"); - cache_managers_map.setAccessible(true); - assertThat(((Map)cache_managers_map.get(null)).get("tc"), nullValue()); - assertThat(((Map)cache_managers_map.get(null)).get("overwrittenCacheManagerName"), notNullValue()); - sessionFactory.close(); - } - - @AfterClass - public static void tearDown() throws Exception { - } -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/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.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/CacheException.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/CacheException.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/CacheException.java (revision 0) @@ -1,91 +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; - -/** - * A runtime Cache Exception. - *

- * These exceptions may be handled by a CacheExceptionHandler registered with a Cache. - * The handler provides a key if it is available. A convention that should be followed in exception messages is - * to include in the message "key keyValue" e.g. "key 1234" so that keys can be parsed out of exception messages. - *

- * Updated in version 1.5 to remove getInitialCause which was a left over from the pre-JDK1.4 - * days. It breaks JAXB. - * - * @author Greg Luck - * @version $Id: CacheException.java 10789 2018-04-26 02:08:13Z adahanne $ - * - */ -public class CacheException extends RuntimeException { - - - private static final long serialVersionUID = 142468800110101833L; - - - /** - * Constructor for the CacheException object. - */ - public CacheException() { - super(); - } - - /** - * Constructor for the CacheException object. - * @param message the exception detail message - */ - public CacheException(String message) { - super(message); - } - - - - /** - * Constructs a new CacheException with the specified detail message and - * cause.

Note that the detail message associated with - * cause is not automatically incorporated in - * this runtime exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.2.4 - */ - public CacheException(String message, Throwable cause) { - super(message, cause); - } - - /** Constructs a new CacheException with the specified cause and a - * detail message of (cause==null ? null : cause.toString()) - * (which typically contains the class and detail message of - * cause). This constructor is useful for runtime exceptions - * that are little more than wrappers for other throwables. - * - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.2.4 - */ - public CacheException(Throwable cause) { - super(cause); - } - -} Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CoreStatistics.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CoreStatistics.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/statistics/CoreStatistics.java (revision 0) @@ -1,210 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.statistics; - -import net.sf.ehcache.CacheOperationOutcomes; -import net.sf.ehcache.store.StoreOperationOutcomes; -import net.sf.ehcache.transaction.xa.XaCommitOutcome; -import net.sf.ehcache.transaction.xa.XaRecoveryOutcome; -import net.sf.ehcache.transaction.xa.XaRollbackOutcome; - -/** - * The CoreStatistics interface. - * - * @author cschanck - */ -public interface CoreStatistics { - - /** - * The Interface CountOperation. - * - * @param the generic type - */ - public interface CountOperation { - - /** - * Value. - * - * @param result the result - * @return the long - */ - long value(T result); - - /** - * Value. - * - * @param results the results - * @return the long - */ - long value(T... results); - } - - /** - * Gets the. - * - * @return the count operation - */ - public CountOperation get(); - - /** - * Put. - * - * @return the count operation - */ - public CountOperation put(); - - /** - * Remove operation. - * - * @return the count operation - */ - public CountOperation remove(); - - /** - * The single arg replace operation. - * - * @return the count operation - */ - public CountOperation replaceOneArg(); - - /** - * The two arg replace operation. - * - * @return the count operation - */ - public CountOperation replaceTwoArg(); - - /** - * The put if absent operation. - * - * @return the count operation - */ - public CountOperation putIfAbsent(); - - /** - * The remove element operation. - * - * @return the count operation - */ - public CountOperation removeElement(); - - /** - * Local heap get. - * - * @return the count operation - */ - public CountOperation localHeapGet(); - - /** - * Local heap put. - * - * @return the count operation - */ - public CountOperation localHeapPut(); - - /** - * Local heap remove. - * - * @return the count operation - */ - public CountOperation localHeapRemove(); - - /** - * Local off heap get. - * - * @return the count operation - */ - public CountOperation localOffHeapGet(); - - /** - * Local off heap put. - * - * @return the count operation - */ - public CountOperation localOffHeapPut(); - - /** - * Local off heap remove. - * - * @return the count operation - */ - public CountOperation localOffHeapRemove(); - - /** - * Local disk get. - * - * @return the count operation - */ - public CountOperation localDiskGet(); - - /** - * Local disk put. - * - * @return the count operation - */ - public CountOperation localDiskPut(); - - /** - * Local disk remove. - * - * @return the count operation - */ - public CountOperation localDiskRemove(); - - /** - * Xa commit. - * - * @return the count operation - */ - public CountOperation xaCommit(); - - /** - * Xa recovery. - * - * @return the count operation - */ - public CountOperation xaRecovery(); - - /** - * Xa rollback. - * - * @return the count operation - */ - public CountOperation xaRollback(); - - /** - * Cache eviction. - * - * @return the count operation - */ - public CountOperation cacheEviction(); - - /** - * Cache expiration. - * - * @return the count operation - */ - public CountOperation cacheExpiration(); - - /** - * Cache cluster event. - * - * @return the count operation - */ - public CountOperation cacheClusterEvent(); - -} \ No newline at end of file Index: rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/chm/SelectableConcurrentHashMap.java =================================================================== diff -u -N --- rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/chm/SelectableConcurrentHashMap.java (revision 11494) +++ rctags/ehcache-2.10.9.1.15/ehcache-core/src/main/java/net/sf/ehcache/store/chm/SelectableConcurrentHashMap.java (revision 0) @@ -1,1259 +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.chm; - -import java.util.AbstractCollection; -import java.util.AbstractSet; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NoSuchElementException; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import net.sf.ehcache.CacheOperationOutcomes.EvictionOutcome; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.RegisteredEventListeners; -import net.sf.ehcache.pool.PoolAccessor; -import org.terracotta.statistics.observer.OperationObserver; - -import static net.sf.ehcache.statistics.StatisticBuilder.operation; - -/** - * SelectableConcurrentHashMap subclasses a repackaged version of ConcurrentHashMap - * ito allow efficient random sampling of the map values. - *

- * The random sampling technique involves randomly selecting a map Segment, and then - * selecting a number of random entry chains from that segment. - * - * @author Chris Dennis - */ -@SuppressWarnings("ForLoopReplaceableByForEach") -public class SelectableConcurrentHashMap { - - /** - * The default initial capacity for this table, - * used when not otherwise specified in a constructor. - */ - static final int DEFAULT_INITIAL_CAPACITY = 16; - - /** - * The default load factor for this table, used when not - * otherwise specified in a constructor. - */ - static final float DEFAULT_LOAD_FACTOR = 0.75f; - - /** - * The maximum capacity, used if a higher value is implicitly - * specified by either of the constructors with arguments. MUST - * be a power of two <= 1<<30 to ensure that entries are indexable - * using ints. - */ - private static final int MAXIMUM_CAPACITY = 1 << 30; - - /** - * The maximum number of segments to allow; used to bound - * constructor arguments. - */ - private static final int MAX_SEGMENTS = 1 << 16; // slightly conservative - - /** - * Number of unsynchronized retries in size and containsValue - * methods before resorting to locking. This is used to avoid - * unbounded retries if tables undergo continuous modification - * which would make it impossible to obtain an accurate result. - */ - private static final int RETRIES_BEFORE_LOCK = 2; - - /** - * Mask value for indexing into segments. The upper bits of a - * key's hash code are used to choose the segment. - */ - private final int segmentMask; - - /** - * Shift value for indexing within segments. - */ - private final int segmentShift; - - /** - * The segments, each of which is a specialized hash table - */ - private final Segment[] segments; - - private final Random rndm = new Random(); - private final PoolAccessor poolAccessor; - private volatile long maxSize; - private final RegisteredEventListeners cacheEventNotificationService; - - private Set keySet; - private Set> entrySet; - private Collection values; - - private final OperationObserver evictionObserver = operation(EvictionOutcome.class).named("eviction").of(this).build(); - - public SelectableConcurrentHashMap(PoolAccessor poolAccessor, int concurrency, final long maximumSize, final RegisteredEventListeners cacheEventNotificationService) { - this(poolAccessor, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, concurrency, maximumSize, cacheEventNotificationService); - } - - public SelectableConcurrentHashMap(PoolAccessor poolAccessor, int initialCapacity, float loadFactor, int concurrency, final long maximumSize, final RegisteredEventListeners cacheEventNotificationService) { - if (!(loadFactor > 0) || initialCapacity < 0 || concurrency <= 0) - throw new IllegalArgumentException(); - - if (concurrency > MAX_SEGMENTS) - concurrency = MAX_SEGMENTS; - - // Find power-of-two sizes best matching arguments - int sshift = 0; - int ssize = 1; - while (ssize < concurrency) { - ++sshift; - ssize <<= 1; - } - segmentShift = 32 - sshift; - segmentMask = ssize - 1; - this.segments = new Segment[ssize]; - - if (initialCapacity > MAXIMUM_CAPACITY) - initialCapacity = MAXIMUM_CAPACITY; - int c = initialCapacity / ssize; - if (c * ssize < initialCapacity) - ++c; - int cap = 1; - while (cap < c) - cap <<= 1; - - for (int i = 0; i < this.segments.length; ++i) - this.segments[i] = createSegment(cap, loadFactor); - - this.poolAccessor = poolAccessor; - this.maxSize = maximumSize; - this.cacheEventNotificationService = cacheEventNotificationService; - } - - public void setMaxSize(final long maxSize) { - this.maxSize = maxSize; - } - - public Element[] getRandomValues(final int size, Object keyHint) { - ArrayList sampled = new ArrayList(size * 2); - - // pick a random starting point in the map - int randomHash = rndm.nextInt(); - - final int segmentStart; - if (keyHint == null) { - segmentStart = (randomHash >>> segmentShift) & segmentMask; - } else { - segmentStart = (hash(keyHint.hashCode()) >>> segmentShift) & segmentMask; - } - - int segmentIndex = segmentStart; - do { - final HashEntry[] table = segments[segmentIndex].table; - final int tableStart = randomHash & (table.length - 1); - int tableIndex = tableStart; - do { - for (HashEntry e = table[tableIndex]; e != null; e = e.next) { - Element value = e.value; - if (value != null) { - sampled.add(value); - } - } - - if (sampled.size() >= size) { - return sampled.toArray(new Element[sampled.size()]); - } - - //move to next table slot - tableIndex = (tableIndex + 1) & (table.length - 1); - } while (tableIndex != tableStart); - - //move to next segment - segmentIndex = (segmentIndex + 1) & segmentMask; - } while (segmentIndex != segmentStart); - - return sampled.toArray(new Element[sampled.size()]); - } - - /** - * Return an object of the kind which will be stored when - * the element is going to be inserted - * @param e the element - * @return an object looking-alike the stored one - */ - public Object storedObject(Element e) { - return new HashEntry(null, 0, null, e, 0); - } - - /** - * Returns the number of key-value mappings in this map without locking anything. - * This may not give the exact element count as locking is avoided. - * If the map contains more than Integer.MAX_VALUE elements, returns - * Integer.MAX_VALUE. - * - * @return the number of key-value mappings in this map - */ - public int quickSize() { - final Segment[] segments = this.segments; - long sum = 0; - for (Segment seg : segments) { - sum += seg.count; - } - - if (sum > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } else { - return (int)sum; - } - } - - public boolean isEmpty() { - final Segment[] segments = this.segments; - /* - * We keep track of per-segment modCounts to avoid ABA - * problems in which an element in one segment was added and - * in another removed during traversal, in which case the - * table was never actually empty at any point. Note the - * similar use of modCounts in the size() and containsValue() - * methods, which are the only other methods also susceptible - * to ABA problems. - */ - int[] mc = new int[segments.length]; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - if (segments[i].count != 0) - return false; - else - mcsum += mc[i] = segments[i].modCount; - } - // If mcsum happens to be zero, then we know we got a snapshot - // before any modifications at all were made. This is - // probably common enough to bother tracking. - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - if (segments[i].count != 0 || - mc[i] != segments[i].modCount) - return false; - } - } - return true; - } - - public int size() { - final Segment[] segments = this.segments; - - for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) { - int[] mc = new int[segments.length]; - long check = 0; - long sum = 0; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - sum += segments[i].count; - mcsum += mc[i] = segments[i].modCount; - } - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - check += segments[i].count; - if (mc[i] != segments[i].modCount) { - check = -1; // force retry - break; - } - } - } - if (check == sum) { - if (sum > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } else { - return (int)sum; - } - } - } - - long sum = 0; - for (int i = 0; i < segments.length; ++i) { - segments[i].readLock().lock(); - } - try { - for (int i = 0; i < segments.length; ++i) { - sum += segments[i].count; - } - } finally { - for (int i = 0; i < segments.length; ++i) { - segments[i].readLock().unlock(); - } - } - - if (sum > Integer.MAX_VALUE) { - return Integer.MAX_VALUE; - } else { - return (int)sum; - } - } - - public ReentrantReadWriteLock lockFor(Object key) { - int hash = hash(key.hashCode()); - return segmentFor(hash); - } - - public ReentrantReadWriteLock[] locks() { - return segments; - } - - public Element get(Object key) { - int hash = hash(key.hashCode()); - return segmentFor(hash).get(key, hash); - } - - public boolean containsKey(Object key) { - int hash = hash(key.hashCode()); - return segmentFor(hash).containsKey(key, hash); - } - - public boolean containsValue(Object value) { - if (value == null) - throw new NullPointerException(); - - // See explanation of modCount use above - - final Segment[] segments = this.segments; - int[] mc = new int[segments.length]; - - // Try a few times without locking - for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) { - int sum = 0; - int mcsum = 0; - for (int i = 0; i < segments.length; ++i) { - int c = segments[i].count; - mcsum += mc[i] = segments[i].modCount; - if (segments[i].containsValue(value)) - return true; - } - boolean cleanSweep = true; - if (mcsum != 0) { - for (int i = 0; i < segments.length; ++i) { - int c = segments[i].count; - if (mc[i] != segments[i].modCount) { - cleanSweep = false; - break; - } - } - } - if (cleanSweep) - return false; - } - - // Resort to locking all segments - for (int i = 0; i < segments.length; ++i) - segments[i].readLock().lock(); - try { - for (int i = 0; i < segments.length; ++i) { - if (segments[i].containsValue(value)) { - return true; - } - } - } finally { - for (int i = 0; i < segments.length; ++i) - segments[i].readLock().unlock(); - } - return false; - } - - public Element put(Object key, Element element, long sizeOf) { - int hash = hash(key.hashCode()); - return segmentFor(hash).put(key, hash, element, sizeOf, false, true); - } - - public Element putIfAbsent(Object key, Element element, long sizeOf) { - int hash = hash(key.hashCode()); - return segmentFor(hash).put(key, hash, element, sizeOf, true, true); - } - - public Element remove(Object key) { - int hash = hash(key.hashCode()); - return segmentFor(hash).remove(key, hash, null); - } - - public boolean remove(Object key, Object value) { - int hash = hash(key.hashCode()); - if (value == null) - return false; - return segmentFor(hash).remove(key, hash, value) != null; - } - - public void clear() { - for (int i = 0; i < segments.length; ++i) - segments[i].clear(); - } - - public Set keySet() { - Set ks = keySet; - return (ks != null) ? ks : (keySet = new KeySet()); - } - - public Collection values() { - Collection vs = values; - return (vs != null) ? vs : (values = new Values()); - } - - public Set> entrySet() { - Set> es = entrySet; - return (es != null) ? es : (entrySet = new EntrySet()); - } - - protected Segment createSegment(int initialCapacity, float lf) { - return new Segment(initialCapacity, lf); - } - - public boolean evict() { - return getRandomSegment().evict(); - } - - private Segment getRandomSegment() { - int randomHash = rndm.nextInt(); - return segments[((randomHash >>> segmentShift) & segmentMask)]; - } - - public void recalculateSize(Object key) { - int hash = hash(key.hashCode()); - segmentFor(hash).recalculateSize(key, hash); - } - - /** - * Returns the segment that should be used for key with given hash - * @param hash the hash code for the key - * @return the segment - */ - protected final Segment segmentFor(int hash) { - return segments[(hash >>> segmentShift) & segmentMask]; - } - - protected final List segments() { - return Collections.unmodifiableList(Arrays.asList(segments)); - } - - public class Segment extends ReentrantReadWriteLock { - - private static final int MAX_EVICTION = 5; - - /** - * The number of elements in this segment's region. - */ - protected volatile int count; - - /** - * Number of updates that alter the size of the table. This is - * used during bulk-read methods to make sure they see a - * consistent snapshot: If modCounts change during a traversal - * of segments computing size or checking containsValue, then - * we might have an inconsistent view of state so (usually) - * must retry. - */ - int modCount; - - /** - * The table is rehashed when its size exceeds this threshold. - * (The value of this field is always (int)(capacity * - * loadFactor).) - */ - int threshold; - - /** - * The per-segment table. - */ - protected volatile HashEntry[] table; - - /** - *