Index: rctags/ehcache-2.10.7.0.13/ehcache-core/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/pom.xml (revision 0) @@ -1,617 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - - - 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 - - - org.codehaus.btm - btm - - - net.sf.hibernate - hibernate - - - org.hamcrest - hamcrest-core - - - org.hamcrest - hamcrest-library - - - junit - junit - - - dom4j - dom4j - - - javassist - javassist - - - org.hibernate - hibernate-ehcache - - - - commons-logging - commons-logging - - - 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 - - - build-info - generate-resources - - buildinfo - - - ${basedir}/.. - - - - - - - - - org.terracotta - maven-forge-plugin - - pertest - ${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 - - - - - - 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 - true - true - true - 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.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.codehaus.mojo - xml-maven-plugin - [1.0,) - - transform - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [1.0,) - - copy-dependencies - - - - - - - - - org.codehaus.gmaven - gmaven-plugin - [1.3,) - - execute - - - - - - - - - org.codehaus.mojo - rmic-maven-plugin - [1.1,) - - rmic - - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [2.7,) - - checkstyle - - - - - - - - - - - - - - - - - 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.7.0.13/management-ehcache-impl/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/pom.xml (revision 0) @@ -1,43 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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.7.0.13/README.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/README.txt (revision 10926) +++ rctags/ehcache-2.10.7.0.13/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.7.0.13/ehcache-scheduled-refresh/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-scheduled-refresh/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-scheduled-refresh/pom.xml (revision 0) @@ -1,46 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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 - test - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/pom.xml (revision 0) @@ -1,53 +0,0 @@ - - - 4.0.0 - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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 - test - - - net.sf.ehcache.internal - ehcache-core - test-jar - ${project.version} - test - - - Index: rctags/ehcache-2.10.7.0.13/ehcache/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache/pom.xml (revision 0) @@ -1,443 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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 - 1.4 - 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 - test - - - org.terracotta - product-upgradability-testing-utils - 0.9.2 - test - - - org.codehaus.btm - btm - 2.1.3 - test - - - org.quartz-scheduler - quartz - 2.2.1 - test - - - org.slf4j - slf4j-jdk14 - ${slf4j.version} - test - - - - - - - ${basedir}/src/main/resources - true - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-TIMs - - org.terracotta.modules - ${project.build.outputDirectory}/META-INF/terracotta/TIMs - **/META-INF/maven/**,**/license.txt,**/thirdpartylicenses.txt - - 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} - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [2.6,) - - list - - - - - - - - - - - - - - - - - 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 - 2.9 - - - create-javadoc - prepare-package - - jar - - - - - org.hibernate - hibernate-core - ${hibernate-core.version} - - - ${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 - - - - - - - - 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 - 2.3.7 - - ${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.sax;resolution:=optional, - javax.xml.transform.dom;resolution:=optional, - javax.xml.transform.stream;resolution:=optional, - org.hibernate.*;resolution:=optional, - org.terracotta.toolkit.*;resolution:=optional, - org.quartz.*;resolution:=optional, - org.terracotta.quartz.*;resolution:=optional, - !sun.misc,* - - net.sf.ehcache.* - org.terracotta.* - JavaSE-1.6 - - *;scope=provided|runtime - - - - generate-osgi-headers - package - - manifest - - - - - - org.codehaus.gmaven - gmaven-plugin - ${gmaven-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.7.0.13/management-ehcache-impl/management-ehcache-common/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-common/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-common/pom.xml (revision 0) @@ -1,101 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.7.0.13 - .. - - - management-ehcache-common - management-ehcache-common - A common library shared between different management-ehcache implementation versions - - - false - - - - - org.terracotta - management-core-resources - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - gf-40 - gf.javax.servlet-api - - - org.eclipse.jetty - jetty-servlet - - - junit - junit - test - - - commons-io - commons-io - 2.6 - test - - - org.easymock - easymock - test - - - org.mockito - mockito-core - 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.7.0.13/management-ehcache-impl/ehcache-rest-agent/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/ehcache-rest-agent/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/ehcache-rest-agent/pom.xml (revision 0) @@ -1,249 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.7.0.13 - .. - - - net.sf.ehcache.internal - ehcache-rest-agent - ehcache-rest-agent - - Ehcache REST implementation - - - rest-management-private-classpath - .class_terracotta - true - false - - - - - net.sf.ehcache - management-ehcache-impl-v1 - ${project.version} - - - net.sf.ehcache - management-ehcache-impl-v2 - ${project.version} - - - gf-40 - gf.javax.servlet-api - 3.1.0 - - - org.eclipse.jetty - jetty-servlet - - - javax.xml.bind - jaxb-api - 2.3.0 - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [2.6,) - - list - - - - - - - - - - - - - - - - - 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 - gmaven-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.7.0.13/distribution/colorcache/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/pom.xml (revision 0) @@ -1,178 +0,0 @@ - - 4.0.0 - - org.terracotta.forge - forge-parent - 4.0 - - - net.sf.ehcache.examples - colorcache - 2.10.7.0.13 - colorcache - war - Clustered Ehcache sample with Terracotta - - 2.1.0 - 4.3.7.0.12 - true - - - ${project.name} - - - maven-assembly-plugin - 2.3 - - ${project.name} - - src/assemble/distribution.xml - - gnu - - - - package - - single - - - - - - maven-jetty-plugin - 9.4.11.v20180605 - org.eclipse.jetty - - ${project.name} - STOP - - - - org.terracotta.maven.plugins - tc-maven-plugin - ${tc-maven-plugin.version} - - - org.terracotta - terracotta - ${terracotta.version} - - - - - - - - net.sf.ehcache - ehcache - ${project.version} - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.version} - - - gf-40 - gf.javax.servlet-api - 3.1.0 - - - org.slf4j - slf4j-jdk14 - 1.7.25 - - - - - 9081 - - - - maven-jetty-plugin - 6.1.15 - org.mortbay.jetty - - - - jetty.port - 9081 - - - 9981 - - - - - - - 9082 - - - - maven-jetty-plugin - 6.1.15 - org.mortbay.jetty - - - - jetty.port - 9082 - - - 9982 - - - - - - - sag-deps - - - sag-deps - true - - - - - - - org.terracotta - maven-forge-plugin - - - com.softwareag.ibit.tools.util - finder - 3.0 - compile - - - - - - - - - - - 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.7.0.13/system-tests/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/pom.xml (revision 0) @@ -1,325 +0,0 @@ - - 4.0.0 - - org.terracotta - system-tests-parent - 4.3.7.0.12 - - - net.sf.ehcache.internal - ehcache-terracotta-system-tests - 2.10.7.0.13 - ehcache-terracotta-system-tests - System tests for ehcache-terracotta - - 512m - 1024m - -XX:MaxPermSize=512m - true - true - 10.10.1.1 - 2.2.3 - 1.7.7 - 1.5 - - - - org.terracotta - terracotta - ${terracotta.core.version} - - - gf-40 - gf.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.slf4j - slf4j-simple - ${slf4j.version} - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.core.version} - test - - - asm - asm - 3.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 - - - org.terracotta.test - container-test-framework - - - org.quartz-scheduler - quartz - ${quartz.version} - - - com.jayway.restassured - rest-assured - 1.8.1 - - - org.codehaus.groovy - groovy - - - org.hamcrest - * - - - com.fasterxml.jackson.core - jackson-databind - - - test - - - org.codehaus.groovy - groovy-all - 2.1.2 - test - - - 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 - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - [2.8,) - - checkstyle - - - - - - - - - - - - - - - - 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.7.0.13/terracotta/bootstrap/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/pom.xml (revision 0) @@ -1,82 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache.internal - ehcache-terracotta-root - 2.10.7.0.13 - - - ehcache-terracotta-bootstrap - ehcache-terracotta-bootstrap - jar - - - false - - - - - net.sf.ehcache.internal - ehcache-core - ${project.version} - provided - - - org.terracotta.toolkit - terracotta-toolkit-api-internal - - - com.terracotta - clustered-entity-management - - - org.mockito - mockito-core - test - - - junit - junit - test - - - 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.7.0.13/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/pom.xml (revision 0) @@ -1,509 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-parent - 2.22 - - - - ehcache-root - net.sf.ehcache - ehcache-root - pom - 2.10.7.0.13 - - - scm:svn:https://svn.terracotta.org/repo/ehcache/trunk/ehcache - - - - 1.7.25 - 1.0.1 - 1.4 - 2.15 - 1.17 - 2.1.6 - 0.10.0 - 1.0.2 - 2.2.3 - 9.4.11.v20180605 - 3.5.1-Final - - - - 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 - - - - - - gf-40 - gf.javax.servlet-api - 3.1.0 - - - - - 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 - 1.0.1 - provided - - - - - org.slf4j - slf4j-jdk14 - ${slf4j.version} - test - - - org.codehaus.btm - btm - 2.1.3 - test - - - net.sf.hibernate - hibernate - 2.1.8 - test - - - org.hamcrest - hamcrest-core - 1.3 - test - - - org.hamcrest - hamcrest-library - 1.3 - test - - - junit - junit - 4.11 - test - - - 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 - - - - - commons-logging - commons-logging - 1.1.1 - test - - - org.apache.derby - derby - 10.5.3.0_1 - test - - - org.mockito - mockito-core - 1.9.0 - test - - - com.sun.xsom - xsom - 20100725 - test - - - org.beanshell - bsh - 1.3.0 - test - - - org.quartz-scheduler - quartz - ${quartz.version} - - - org.easymock - easymock - 3.0 - test - - - org.powermock - powermock-api-easymock - 1.4.10 - test - - - org.powermock - powermock-module-junit4 - 1.4.10 - test - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.3.2 - - - - true - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire.version} - - true - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8.1 - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.9.1 - - - org.apache.maven.plugins - maven-dependency-plugin - 2.8 - - - 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 - gmaven-plugin - ${gmaven-plugin.version} - - - org.codehaus.mojo - rmic-maven-plugin - 1.1 - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.codehaus.mojo - javacc-maven-plugin - [2.6,) - - javacc - - - - - - - - - - - - - - - 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.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/pom.xml (revision 0) @@ -1,136 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.7.0.13 - .. - - - 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.5 - provided - - - org.terracotta.toolkit - terracotta-toolkit-api-internal - provided - - - gf-40 - gf.javax.servlet-api - - - 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-all - 1.3 - 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.7.0.13/TestCategories.properties =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/TestCategories.properties (revision 10926) +++ rctags/ehcache-2.10.7.0.13/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.7.0.13/management-ehcache-v2/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-v2/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-v2/pom.xml (revision 0) @@ -1,72 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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.7.0.13/distribution/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/pom.xml (revision 0) @@ -1,298 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - - - 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 - gmaven-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.7.0.13/terracotta/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/pom.xml (revision 0) @@ -1,74 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - - - 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.7.0.13/distribution/events/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/events/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/events/pom.xml (revision 0) @@ -1,299 +0,0 @@ - - 4.0.0 - - org.terracotta.forge - forge-parent - 4.0 - - - net.sf.ehcache.examples - events - 2.10.7.0.13 - events - war - Clustered Ehcache Terracotta as second level cache for Hibernate - - 2.1.0 - 4.3.7.0.12 - 1.1.116 - 9.4.11.v20180605 - 1.1 - true - - - - org.slf4j - slf4j-api - 1.7.25 - - - org.slf4j - slf4j-log4j12 - 1.7.25 - - - javassist - javassist - 3.8.0.GA - - - h2 - ${h2.version} - com.h2database - - - net.sf.ehcache - ehcache - ${project.version} - - - org.terracotta - terracotta-toolkit-runtime - ${terracotta.version} - - - commons-logging - commons-logging - 1.1 - compile - - - log4j - log4j - - - logkit - logkit - - - avalon-framework - avalon-framework - - - javax.servlet - servlet-api - - - - - gf-40 - gf.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 - - - - - - maven-jetty-plugin - ${jetty.version} - org.mortbay.jetty - - ${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 - ${tc-maven-plugin.version} - - - 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 - - - - maven-jetty-plugin - ${jetty.version} - org.mortbay.jetty - - - - jetty.port - 9081 - - - 9981 - - - - - - - 9082 - - - - maven-jetty-plugin - ${jetty.version} - org.mortbay.jetty - - - - jetty.port - 9082 - - - 9982 - - - - - - - sag-deps - - - sag-deps - true - - - - - - - org.terracotta - maven-forge-plugin - - - com.softwareag.ibit.tools.util - finder - 3.0 - compile - - - - - - - - - - - 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.7.0.13/management-ehcache-v1/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-v1/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-v1/pom.xml (revision 0) @@ -1,72 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - ehcache-root - 2.10.7.0.13 - .. - - - 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.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/pom.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/pom.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/pom.xml (revision 0) @@ -1,113 +0,0 @@ - - - 4.0.0 - - - net.sf.ehcache - management-ehcache-impl-parent - 2.10.7.0.13 - .. - - - 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 - - - gf-40 - gf.javax.servlet-api - - - 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-all - 1.3 - 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.7.0.13/third-party.txt =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/third-party.txt (revision 10926) +++ rctags/ehcache-2.10.7.0.13/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.7.0.13/terracotta/.settings/org.eclipse.jdt.ui.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/.settings/org.eclipse.jdt.ui.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/.settings/org.eclipse.jdt.ui.prefs (revision 0) @@ -1,66 +0,0 @@ -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_Terracotta profile -formatter_settings_version=11 -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=org;com;java;javax; -org.eclipse.jdt.ui.javadoc=false -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * \r\n *//**\r\n * \r\n *//*\r\n * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.\r\n */\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}throw ${exception_var};throw new ImplementMe();\r\n${body_statement}${body_statement}return ${field};${field} \= ${param};/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */\r\n\r\n\r\n\r\n/**\r\n * @return the ${bare_field_name}\r\n *//**\r\n * @param ${param} the ${bare_field_name} to set\r\n *//**\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n *//**\r\n * \r\n *//**\r\n * ${tags}\r\n *//* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n *//**\r\n * ${tags}\r\n * ${see_to_target}\r\n */${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}\r\n// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();// ${todo} Auto-generated function stub\r\n${body_statement}${body_statement}\r\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param}; -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=true -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=false -sp_cleanup.remove_trailing_whitespaces_ignore_empty=true -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBeanController.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBeanController.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBeanController.java (revision 0) @@ -1,212 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import org.terracotta.test.util.JMXUtils; - -import java.io.IOException; -import java.util.Map; - -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.remote.JMXConnector; - -/** - * @author Abhishek Sanoujam - */ -public class DSOMBeanController implements DSOMBean { - - private static final ObjectName DSO; - private static final ObjectName DUMPER; - static { - ObjectName dso; - ObjectName dumper = null; - try { - dso = new ObjectName("org.terracotta:type=Terracotta Server,name=DSO"); - dumper = new ObjectName("org.terracotta.internal:type=Terracotta Server,name=L2Dumper"); - } catch (Exception e) { - dso = null; - dumper = null; - } - DSO = dso; - DUMPER = dumper; - } - - private final String host; - private final int jmxPort; - - public DSOMBeanController(String host, int jmxPort) { - this.host = host; - this.jmxPort = jmxPort; - } - - private T performL2MBeanDumper(DSOMBeanAction action) throws IOException { - return performL2ControlBeanAction(action, DUMPER); - } - - private T performL2MBeanTCServerInfo(DSOMBeanAction action) throws IOException { - return performL2ControlBeanAction(action, DSO); - } - - private T performL2ControlBeanAction(DSOMBeanAction action, ObjectName objectName) throws IOException { - if (objectName == null) { throw new RuntimeException(objectName + " object name is null"); } - final JMXConnector jmxConnector = JMXUtils.getJMXConnector(host, jmxPort); - MBeanServerConnection mbs = jmxConnector.getMBeanServerConnection(); - DSOMBean l2ControlBean = DSOMBeanProxy.newL2ControlMBeanProxy(mbs, objectName); - try { - return action.performL2ControlBeanAction(l2ControlBean); - } finally { - try { - jmxConnector.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - public long getGlobalServerMapGetSizeRequestsCount() { - - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction() { - - public Long performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getGlobalServerMapGetSizeRequestsCount(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public long getGlobalServerMapGetSizeRequestsRate() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction() { - - public Long performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getGlobalServerMapGetSizeRequestsRate(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public long getGlobalServerMapGetValueRequestsCount() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction() { - - public Long performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getGlobalServerMapGetValueRequestsCount(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public long getGlobalServerMapGetValueRequestsRate() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction() { - - public Long performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getGlobalServerMapGetValueRequestsRate(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public long getReadOperationRate() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction() { - - public Long performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getReadOperationRate(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getServerMapGetSizeRequestsCount() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction>() { - - public Map performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getServerMapGetSizeRequestsCount(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getServerMapGetSizeRequestsRate() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction>() { - - public Map performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getServerMapGetSizeRequestsRate(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getServerMapGetValueRequestsCount() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction>() { - - public Map performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getServerMapGetValueRequestsCount(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getServerMapGetValueRequestsRate() { - try { - return performL2MBeanTCServerInfo(new DSOMBeanAction>() { - - public Map performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.getServerMapGetValueRequestsRate(); - } - - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private static interface DSOMBeanAction { - T performL2ControlBeanAction(DSOMBean l2ControlBean); - } - - public Void dumpClusterState() { - try { - return performL2MBeanDumper(new DSOMBeanAction() { - - public Void performL2ControlBeanAction(DSOMBean dsoMBean) { - return dsoMBean.dumpClusterState(); - } - }); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/debugEhcacheTxnsState.btm (revision 0) @@ -1,44 +0,0 @@ - - -RULE trace EhcacheTxnsClusteredStateFacadeImpl getXATransactionDecision -CLASS EhcacheTxnsClusteredStateFacadeImpl -METHOD getXATransactionDecision -AT EXIT -IF true -DO traceln("[ehcache txns facade] getXATransactionDecision - key.hashCode(): " + $key.hashCode() + " returning:-> " + $!); -ENDRULE - -RULE trace EhcacheTxnsClusteredStateFacadeImpl updateXATransactionDecision -CLASS EhcacheTxnsClusteredStateFacadeImpl -METHOD updateXATransactionDecision -AT EXIT -IF true -DO traceln("[ehcache txns facade] updateXATransactionDecision - key.hashCode(): " + $key.hashCode() + ", newDecision: " + $newDecision); -ENDRULE - -RULE trace EhcacheTxnsClusteredStateFacadeImpl getSoftLockState -CLASS EhcacheTxnsClusteredStateFacadeImpl -METHOD getSoftLockState -AT EXIT -IF true -DO traceln("[ehcache txns facade] getSoftLockState - key.hashCode(): " + $key.hashCode() + " returning:-> " + $!); -ENDRULE - -RULE trace EhcacheTxnsClusteredStateFacadeImpl updateSoftLockState -CLASS EhcacheTxnsClusteredStateFacadeImpl -METHOD updateSoftLockState -AFTER INVOKE put -IF true -DO traceln("[ehcache txns facade] updateSoftLockState, after put - key.hashCode(): " + $key.hashCode() + ", newSoftLockState: " + $newSoftLockState); -AT EXIT -IF true -DO traceln("[ehcache txns facade] updateSoftLockState, returning for key.hashCode(): " + $key.hashCode() + " returning:-> " + $!); -ENDRULE - -RULE trace EhcacheTxnsClusteredStateFacadeImpl isExpired -CLASS EhcacheTxnsClusteredStateFacadeImpl -METHOD isExpired -AT EXIT -IF true -DO traceln("[ehcache txns facade] isExpired - softLockId.hashCode(): " + serializeToString($softLockId).hashCode() + " returning:-> " + $!); -ENDRULE Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/ehcache-conflict-eternal.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/ehcache-conflict-eternal.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/ehcache-conflict-eternal.xml (revision 0) @@ -1,16 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/search/BasicSearchTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/search/BasicSearchTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/search/BasicSearchTest.java (revision 0) @@ -1,1194 +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; - -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.config.CacheConfiguration; -import net.sf.ehcache.config.SearchAttribute; -import net.sf.ehcache.config.Searchable; -import net.sf.ehcache.search.Person.Gender; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.aggregator.Aggregators; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.impl.GroupedResultImpl; - -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 java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -@Category(CheckShorts.class) -public class BasicSearchTest { - private CacheManager cacheManager; - - @Before - public void setup() { - this.cacheManager = new CacheManager(getClass().getResource("/ehcache-search.xml")); - } - - @After - public void tearDown() { - this.cacheManager.shutdown(); - } - - @Test - public void testInvalidConfiguration() { - try { - new CacheManager(getClass().getResource("/ehcache-search-invalid-key.xml")); - fail(); - } catch (CacheException ce) { - // expected - } - - try { - new CacheManager(getClass().getResource("/ehcache-search-invalid-value.xml")); - fail(); - } catch (CacheException ce) { - // expected - } - } - - @Test - public void testKeysValuesDisabled() { - Cache cache = cacheManager.getCache("searchable-no-keys-values"); - - CacheConfiguration config = cache.getCacheConfiguration(); - - Searchable searchable = config.getSearchable(); - - assertFalse(searchable.keys()); - assertFalse(searchable.values()); - - try { - cache.getSearchAttribute(Query.KEY.getAttributeName()); - fail(); - } catch (CacheException se) { - // expected - System.err.println(se.getMessage()); - } - - try { - cache.getSearchAttribute(Query.VALUE.getAttributeName()); - fail(); - } catch (CacheException se) { - // expected - System.err.println(se.getMessage()); - } - } - - @Test - public void testNonSearchableCache() { - Ehcache cache = cacheManager.getEhcache("not-searchable"); - assertFalse(cache.isSearchable()); - - try { - cache.createQuery(); - fail(); - } catch (CacheException e) { - // expected - } - } - - @Test - public void testDefaultSearchableCache() { - Ehcache cache = cacheManager.getEhcache("default-searchable"); - assertTrue(cache.isSearchable()); - - cache.put(new Element("key", new Object())); - cache.put(new Element(new Object(), "value")); - cache.put(new Element(new Object(), new Object())); - cache.put(new Element(null, null)); - - Query query; - Results results; - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(Query.KEY.eq("key")).end(); - results = query.execute(); - assertEquals(1, results.size()); - assertEquals("key", results.all().iterator().next().getKey()); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(Query.VALUE.eq("value")).end(); - results = query.execute(); - assertEquals(1, results.size()); - Object key = results.all().iterator().next().getKey(); - assertEquals("value", cache.get(key).getObjectValue()); - } - - @Test - public void testQueryBuilder() { - Ehcache cache = cacheManager.getEhcache("cache1"); - - Query query1 = cache.createQuery(); - Query query2 = cache.createQuery(); - - // query instances should be unique - assertFalse(query1 == query2); - - // null checks - try { - query1.addCriteria(null); - fail(); - } catch (NullPointerException npe) { - // expected - } - try { - query1.addOrderBy(null, Direction.ASCENDING); - fail(); - } catch (NullPointerException npe) { - // expected - } - try { - query1.addOrderBy(new Attribute("foo"), null); - fail(); - } catch (NullPointerException npe) { - // expected - } - try { - query1.includeAggregator((Aggregator[]) null); - fail(); - } catch (NullPointerException npe) { - // expected - } - try { - query1.includeAttribute((Attribute[]) null); - fail(); - } catch (NullPointerException npe) { - // expected - } - try { - query1.includeAttribute(new Attribute[] {new Attribute("foo"), null}); - fail(); - } catch (NullPointerException npe) { - // expected - } catch (SearchException e) { - // expected - } - - // freeze query - query1.end(); - - try { - query1.addCriteria(new Attribute("foo").le(35)); - fail(); - } catch (SearchException se) { - // expected - } - try { - query1.addOrderBy(new Attribute("foo"), Direction.ASCENDING); - fail(); - } catch (SearchException se) { - // expected - } - try { - query1.includeAggregator(new Attribute("foo").max()); - fail(); - } catch (SearchException se) { - // expected - } - try { - query1.includeAttribute(new Attribute("foo")); - fail(); - } catch (SearchException se) { - // expected - } - try { - query1.includeKeys(); - fail(); - } catch (SearchException se) { - // expected - } - try { - query1.maxResults(3); - fail(); - } catch (SearchException se) { - // expected - } - } - - @Test - public void testRange() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Query query = cache.createQuery(); - query.includeKeys(); - query.end(); - - Results results = query.execute(); - assertEquals(4, results.all().size()); - - List keys = new ArrayList(); - for (int i = 0; i < 4; i++) { - List range = results.range(i, 1); - assertEquals(1, range.size()); - keys.add((Integer) range.get(0).getKey()); - } - assertEquals(4, keys.size()); - - for (int i = 0; i < 4; i++) { - assertEquals(0, results.range(i, 0).size()); - } - - assertEquals(0, results.range(0, 0).size()); - assertEquals(1, results.range(0, 1).size()); - assertEquals(2, results.range(0, 2).size()); - assertEquals(3, results.range(0, 3).size()); - assertEquals(4, results.range(0, 4).size()); - assertEquals(4, results.range(0, 5).size()); - assertEquals(4, results.range(0, Integer.MAX_VALUE).size()); - - try { - results.range(-1, 1); - fail(); - } catch (IllegalArgumentException iae) { - // expected - } - - try { - results.range(0, -1); - fail(); - } catch (IllegalArgumentException iae) { - // expected - } - } - - @Test - public void testBasic() { - // uses expression attribute extractors - basicQueries(cacheManager.getEhcache("cache1")); - - // uses a "custom" attribute extractor too - basicQueries(cacheManager.getEhcache("cache2")); - - // uses copyOnRead / copyOnWrite - basicQueries(cacheManager.getEhcache("cache3")); - - // uses bean attributes - basicQueries(cacheManager.getEhcache("bean-attributes")); - } - - @Test - public void testCustomAggregator() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute age = cache.getSearchAttribute("age"); - - Query query = cache.createQuery(); - query.includeAggregator(new Aggregator() { - public AggregatorInstance createInstance() { - return new AggregatorInstance() { - - private int doubledSum; - - public void accept(Object input) throws AggregatorException { - if (doubledSum == 0) { - doubledSum = (2 * (Integer) input); - } else { - doubledSum += (2 * (Integer) input); - } - } - - public AggregatorInstance createClone() { - return this; - } - - public Integer aggregateResult() { - return doubledSum; - } - - public Attribute> getAttribute() { - return new Attribute("age"); - } - }; - } - }); - query.end(); - - Results results = query.execute(); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(246, result.getAggregatorResults().get(0)); - } - } - - @Test - public void testBuiltinFunctions() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute age = cache.getSearchAttribute("age"); - - { - Query query = cache.createQuery(); - query.includeAggregator(age.count()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - System.err.println(result); // exercise toString() - assertEquals(4, result.getAggregatorResults().get(0)); - } - } - - { - Query query = cache.createQuery(); - query.includeAggregator(age.max()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(35, result.getAggregatorResults().get(0)); - } - } - - { - Query query = cache.createQuery(); - query.includeAggregator(age.min()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(23, result.getAggregatorResults().get(0)); - } - } - - { - Query query = cache.createQuery(); - query.includeAggregator(age.sum()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(123L, result.getAggregatorResults().get(0)); - } - } - - { - Query query = cache.createQuery(); - query.includeAggregator(age.average()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(30.75F, result.getAggregatorResults().get(0)); - } - } - - { - // multiple aggregators - Query query = cache.createQuery(); - query.includeAggregator(age.min()); - query.includeAggregator(age.max()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(23, result.getAggregatorResults().get(0)); - assertEquals(35, result.getAggregatorResults().get(1)); - } - } - - { - // use criteria with an aggregator - Query query = cache.createQuery(); - query.includeAggregator(age.average()); - query.addCriteria(age.between(0, 32)); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertEquals(1, results.size()); - for (Result result : results.all()) { - assertEquals(26.5F, result.getAggregatorResults().get(0)); - } - } - - { - // includeKeys in addition to an aggregator - Query query = cache.createQuery(); - query.includeKeys(); - query.includeAggregator(age.average()); - query.addCriteria(age.between(0, 32)); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertTrue(results.hasKeys()); - assertEquals(2, results.size()); - for (Result result : results.all()) { - assertEquals(26.5F, result.getAggregatorResults().get(0)); - } - - verify(cache, query, 2, 4); - } - - { - // execute query twice - Query query = cache.createQuery(); - query.includeAggregator(age.count()); - query.end(); - - Results results = query.execute(); - assertTrue(results.hasAggregators()); - assertFalse(results.hasKeys()); - for (Result result : results.all()) { - assertEquals(4, result.getAggregatorResults().get(0)); - } - - results = query.execute(); - assertTrue(results.hasAggregators()); - assertFalse(results.hasKeys()); - for (Result result : results.all()) { - assertEquals(4, result.getAggregatorResults().get(0)); - } - } - - } - - @Test - public void testMaxResults() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute age = cache.getSearchAttribute("age"); - Attribute gender = cache.getSearchAttribute("gender"); - - Query query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.maxResults(1); - query.end(); - - Results results = query.execute(); - assertEquals(1, results.size()); - for (Result result : results.all()) { - switch ((Integer) result.getKey()) { - case 2: - case 4: { - break; - } - default: { - throw new AssertionError(result.getKey()); - } - } - } - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.maxResults(0); - query.end(); - - results = query.execute(); - assertEquals(0, results.size()); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.maxResults(2); - query.end(); - - results = query.execute(); - assertEquals(2, results.size()); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.maxResults(2); - query.end(); - - results = query.execute(); - assertEquals(2, results.size()); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.maxResults(-1); - query.end(); - - results = query.execute(); - assertEquals(2, results.size()); - - } - - @Test - public void testAttributeQuery() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute age = cache.getSearchAttribute("age"); - Attribute gender = cache.getSearchAttribute("gender"); - - Query query = cache.createQuery(); - // not including keys - query.addCriteria(age.ne(35)); - query.includeAttribute(age, gender); - query.end(); - - Results results = query.execute(); - assertFalse(results.hasKeys()); - assertFalse(results.hasAggregators()); - assertTrue(results.hasAttributes()); - - for (Result result : results.all()) { - System.err.println(result.toString()); // exercise toString() - - try { - result.getKey(); - fail(); - } catch (SearchException se) { - // expected - } - - try { - result.getKey(); - fail(); - } catch (SearchException se) { - // expected - } - - int ageAttr = result.getAttribute(age); - if (ageAttr == 23) { - assertEquals(Gender.FEMALE, result.getAttribute(gender)); - } else if (ageAttr == 30) { - assertEquals(Gender.MALE, result.getAttribute(gender)); - } else { - throw new AssertionError("unexpected age: " + ageAttr); - } - - try { - result.getAttribute(new Attribute("does-not-exist")); - fail(); - } catch (SearchException se) { - // expected - } - } - - } - - private void basicQueries(Ehcache cache) { - SearchTestUtil.populateData(cache); - - Query query; - Attribute age = cache.getSearchAttribute("age"); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(age.ne(35)); - query.end(); - verify(cache, query, 2, 4); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").lt(30)); - query.end(); - query.execute(); - verify(cache, query, 2); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").le(30)); - query.end(); - query.execute(); - verify(cache, query, 2, 4); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").in(new HashSet(Arrays.asList(23, 35)))); - query.end(); - query.execute(); - verify(cache, query, 1, 2, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").gt(30)); - query.end(); - query.execute(); - verify(cache, query, 1, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").between(23, 35, true, false)); - query.end(); - query.execute(); - verify(cache, query, 2, 4); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").ge(30)); - query.end(); - query.execute(); - verify(cache, query, 1, 3, 4); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").eq(35).or(cache.getSearchAttribute("gender").eq(Gender.FEMALE))); - query.end(); - verify(cache, query, 1, 2, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").eq(35).and(cache.getSearchAttribute("gender").eq(Gender.MALE))); - query.end(); - verify(cache, query, 1, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").eq(35).and(cache.getSearchAttribute("gender").eq(Gender.FEMALE))); - query.end(); - verify(cache, query); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("age").eq(35)); - query.addCriteria(cache.getSearchAttribute("gender").eq(Gender.FEMALE)); - query.end(); - verify(cache, query); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("gender").eq(Gender.MALE).not()); - query.end(); - verify(cache, query, 2); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("name").eq("Tim Eck")); - query.addCriteria(cache.getSearchAttribute("gender").eq(Gender.MALE)); - query.addCriteria(cache.getSearchAttribute("age").eq(35)); - query.end(); - verify(cache, query, 1); - - query = cache.createQuery(); - query.includeKeys(); - Attribute name = cache.getSearchAttribute("name"); - query.addCriteria(name.eq("Tim Eck").or(name.eq("Ari Zilka")).or(name.eq("Nabib El-Rahman"))); - query.end(); - verify(cache, query, 1, 3, 4); - - try { - cache.getSearchAttribute("DOES_NOT_EXIST_PLEASE_DO_NOT_CREATE_ME"); - fail(); - } catch (CacheException ce) { - // expected - } - } - - @Test - public void testOrdering() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute age = cache.getSearchAttribute("age"); - Attribute name = cache.getSearchAttribute("name"); - - Query query; - - query = cache.createQuery(); - query.includeKeys(); - // no critera -- select all elements - query.addOrderBy(age, Direction.DESCENDING); - query.addOrderBy(name, Direction.ASCENDING); - query.end(); - - verifyOrdered(cache, query, 3, 1, 4, 2); - - query = cache.createQuery(); - query.includeKeys(); - // no critera -- select all elements - query.addOrderBy(age, Direction.DESCENDING); - query.addOrderBy(name, Direction.ASCENDING); - query.maxResults(2); - query.end(); - - verifyOrdered(cache, query, 3, 1); - } - - @Test - public void testILike() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute name = cache.getSearchAttribute("name"); - - Query query; - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(new Or(name.ilike("tim*"), name.ilike("ari*"))); - query.end(); - - verify(cache, query, 3, 1); - - cache.removeAll(); - cache.put(new Element(1, new Person("Test \\ Bob * ?", 35, Gender.MALE))); - cache.put(new Element(2, new Person("(..Test", 35, Gender.MALE))); - cache.put(new Element(3, new Person("lowercase", 35, Gender.MALE))); - cache.put(new Element(4, new Person("UPPERCASE", 35, Gender.MALE))); - cache.put(new Element(5, new Person("MiXeD", 35, Gender.MALE))); - cache.put(new Element(6, new Person("Hello there\nI am on a newline\nMe too\n", 999, Gender.MALE))); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("Test \\\\ Bob \\* \\?")); - query.end(); - - verify(cache, query, 1); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("*Test*")); - query.end(); - - verify(cache, query, 1, 2); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("Test*\\?")); - query.end(); - - verify(cache, query, 1); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("(..*")); - query.end(); - - verify(cache, query, 2); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("Lowercase")); - query.end(); - - verify(cache, query, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("LOWER*")); - query.end(); - - verify(cache, query, 3); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("uppercase")); - query.end(); - - verify(cache, query, 4); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("mixed")); - query.end(); - - verify(cache, query, 5); - - query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(name.ilike("*am on a*")); - query.end(); - - verify(cache, query, 6); - } - - @Test - public void testTypeChecking() { - CacheConfiguration config = new CacheConfiguration("test", 0); - config.setOverflowToDisk(false); - config.diskPersistent(false); - config.setEternal(true); - Searchable searchable = new Searchable().searchAttribute(new SearchAttribute().name("attr").expression("value.getAttr()")); - config.addSearchable(searchable); - - cacheManager.addCache(new Cache(config)); - - class Value { - private final Object attr; - - Value(Object attr) { - this.attr = attr; - } - - Object getAttr() { - return attr; - } - } - - Ehcache cache = cacheManager.getEhcache("test"); - cache.put(new Element(1, new Value("foo"))); - - Query query = cache.createQuery(); - query.includeKeys(); - query.addCriteria(cache.getSearchAttribute("attr").le(4)); - query.end(); - - try { - query.execute(); - fail(); - } catch (SearchException se) { - // expected since the criteria wants INT, but actual attribute value is STRING - } - - // with proper type search will execute - cache.put(new Element(1, new Value(4))); - assertEquals(1, query.execute().all().iterator().next().getKey()); - } - - @Test - public void testEmptyQueries() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - { - Query query = cache.createQuery(); - query.end(); - try { - query.execute(); - fail(); - } catch (SearchException e) { - System.err.println("Expected " + e); - } - } - - { - Attribute age = cache.getSearchAttribute("age"); - Query query = cache.createQuery(); - query.addCriteria(age.ne(35)); - query.end(); - try { - query.execute(); - fail(); - } catch (SearchException e) { - System.err.println("Expected " + e); - } - } - } - - @Test - public void testIncludeValues() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - { - Query query = cache.createQuery(); - query.includeValues(); - query.end(); - Results results = query.execute(); - assertTrue(results.hasValues()); - assertEquals(4, results.size()); - int ageSum = 0; - for (Result result : results.all()) { - System.err.println(result.toString()); // exercise toString() - - Person p = (Person) result.getValue(); - ageSum += p.getAge(); - try { - result.getKey(); - } catch (SearchException se) { - // expected since keys not included - } - } - - assertEquals(123, ageSum); - } - - { - Query query = cache.createQuery(); - query.includeKeys(); - query.end(); - Results results = query.execute(); - assertFalse(results.hasValues()); - assertEquals(4, results.size()); - for (Result result : results.all()) { - try { - result.getValue(); - fail(); - } catch (SearchException se) { - // expected since keys not included - } - } - } - } - - @Test - public void testSearchUnknownAttribute() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute address = new Attribute("address"); - - try { - cache.getSearchAttribute(address.getAttributeName()); - fail(address.getAttributeName() + " not expected in cache search config"); - } - catch (CacheException e) { - // expected - } - - try { - cache.createQuery().includeAttribute(address).execute(); - fail("Expected to fail due to unknown attribute"); - } - catch (SearchException ex) { - // expected - } - - Aggregator[] aggs = new Aggregator[] { Aggregators.average(address), Aggregators.min(address), Aggregators.max(address), - Aggregators.sum(address) } ; - for (Aggregator a: aggs) { - Query q = cache.createQuery().includeAggregator(a); - try { - q.execute(); - fail("Expected to fail due to bad attribute used in aggregator"); - } - catch (SearchException e) { - // expected - } - } - } - - @Test - public void testBadAttributeInCriteria() { - Ehcache cache = cacheManager.getEhcache("cache1"); - SearchTestUtil.populateData(cache); - - Attribute address = new Attribute("address"); - try { - cache.getSearchAttribute(address.getAttributeName()); - fail(address.getAttributeName() + " not expected in cache search config"); - } - catch (CacheException e) { - // expected - } - - Collection expr = new ArrayList(); - expr.add(address.between("aaa", "zzz")); - expr.add(new LessThan("address", "Elm St")); - expr.add(address.eq("ehcache")); - expr.add(address.ge("rocks")); - expr.add(address.gt("FOO")); - expr.add(address.ne("bAr")); - expr.add(address.ilike("likethis*")); - expr.add(address.le("1000")); - expr.add(address.in(Collections.singleton("XYZ"))); - - for (Criteria c: expr) { - Query q = cache.createQuery().addCriteria(c); - - try { - q.execute(); - fail("Expected to fail due to unknown attribute in search criteria"); - } - catch (SearchException e) { - // expected - } - } - - Criteria bool = null; - Random r = new Random(); - for (Criteria c: expr) { - if (bool == null) { - bool = c; - continue; - } - switch (r.nextInt(2)) { - case 0: - bool = bool.and(c); - break; - case 1: - bool = bool.or(c); - break; - case 2: - bool = bool.not(); - break; - default: - throw new AssertionError(); - } - } - - Query q = cache.createQuery().addCriteria(bool); - - try { - q.execute(); - fail("Expected to fail due to unknown attribute in search criteria chain"); - } - catch (SearchException e) { - // expected - } - - - } - - @Test - public void testBasicGroupBy() { - Ehcache cache = cacheManager.getEhcache("cache1"); - assertTrue(cache.isSearchable()); - - int numOfDepts = 10; - int numOfMalesPerDept = 100; - int numOfFemalesPerDept = 100; - - for (int i = 0; i < numOfDepts; i++) { - for (int j = 0; j < numOfMalesPerDept; j++) { - cache.put(new Element("male" + i + "-" + j, new Person("male" + j, j, Gender.MALE, "dept" + i))); - } - - for (int j = 0; j < numOfFemalesPerDept; j++) { - cache.put(new Element("female" + i + "-" + j, new Person("female" + j, j, Gender.FEMALE, "dept" + i))); - } - } - - Query query; - Results results; - - query = cache.createQuery(); - query.includeAttribute(cache.getSearchAttribute("dept")); - query.includeAttribute(cache.getSearchAttribute("gender")); - query.includeAggregator(cache.getSearchAttribute("age").sum()); - query.includeAggregator(cache.getSearchAttribute("age").min()); - query.includeAggregator(cache.getSearchAttribute("age").max()); - query.addGroupBy(cache.getSearchAttribute("dept")); - query.addOrderBy(cache.getSearchAttribute("dept"), Direction.DESCENDING); - query.addOrderBy(cache.getSearchAttribute("gender"), Direction.ASCENDING); - query.addGroupBy(cache.getSearchAttribute("gender")); - query.end(); - - results = query.execute(); - - assertEquals(numOfDepts * 2, results.size()); - - int i = 1; - for (Iterator iter = results.all().iterator(); iter.hasNext();) { - Result maleResult = iter.next(); - System.out.println("XXXXXXXXX: " + maleResult); - assertEquals("dept" + (numOfDepts - i), maleResult.getAttribute(cache.getSearchAttribute("dept"))); - assertEquals(Gender.MALE, maleResult.getAttribute(cache.getSearchAttribute("gender"))); - - assertTrue(maleResult instanceof GroupedResultImpl); - Map groupByValues = ((GroupedResultImpl) maleResult).getGroupByValues(); - assertEquals(2, groupByValues.size()); - assertEquals("dept" + (numOfDepts - i), groupByValues.get("dept")); - assertEquals(Gender.MALE, groupByValues.get("gender")); - - List aggregateResults = maleResult.getAggregatorResults(); - assertEquals(3, aggregateResults.size()); - assertEquals(numOfMalesPerDept * (numOfMalesPerDept - 1) / 2, ((Long) aggregateResults.get(0)).intValue()); - assertEquals(0, ((Integer) aggregateResults.get(1)).intValue()); - assertEquals(numOfMalesPerDept - 1, ((Integer) aggregateResults.get(2)).intValue()); - - Result femaleResult = iter.next(); - System.out.println("XXXXXXXXX: " + femaleResult); - - assertEquals("dept" + (numOfDepts - i), femaleResult.getAttribute(cache.getSearchAttribute("dept"))); - assertEquals(Gender.FEMALE, femaleResult.getAttribute(cache.getSearchAttribute("gender"))); - - assertTrue(femaleResult instanceof GroupedResultImpl); - groupByValues = ((GroupedResultImpl) femaleResult).getGroupByValues(); - assertEquals(2, groupByValues.size()); - assertEquals("dept" + (numOfDepts - i), groupByValues.get("dept")); - assertEquals(Gender.FEMALE, groupByValues.get("gender")); - - aggregateResults = femaleResult.getAggregatorResults(); - assertEquals(3, aggregateResults.size()); - assertEquals(numOfFemalesPerDept * (numOfFemalesPerDept - 1) / 2, ((Long) aggregateResults.get(0)).intValue()); - assertEquals(0, ((Integer) aggregateResults.get(1)).intValue()); - assertEquals(numOfFemalesPerDept - 1, ((Integer) aggregateResults.get(2)).intValue()); - - i++; - } - - } - - private void verify(Ehcache cache, Query query, Integer... expectedKeys) { - Results results = query.execute(); - assertEquals(expectedKeys.length, results.size()); - if (expectedKeys.length == 0) { - assertFalse(results.hasKeys()); - } else { - assertTrue(results.hasKeys()); - } - assertFalse(results.hasAttributes()); - - Set keys = new HashSet(Arrays.asList(expectedKeys)); - - System.err.println(results.toString()); // call toString() just to make sure it doesn't blow up - - for (Result result : results.all()) { - System.err.println(result.toString()); // call toString() just to make sure it doesn't blow up - - int key = (Integer) result.getKey(); - if (!keys.remove(key)) { - throw new AssertionError("unexpected key: " + key); - } - } - } - - private void verifyOrdered(Ehcache cache, Query query, Integer... expectedKeys) { - Results results = query.execute(); - assertEquals(results.size(), expectedKeys.length); - - int pos = 0; - for (Result result : results.all()) { - Object expectedKey = expectedKeys[pos++]; - assertEquals(expectedKey, result.getKey()); - } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/main/java/net/sf/ehcache/search/parser/MOrderBy.java (revision 0) @@ -1,89 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.search.parser; - -public class MOrderBy { - - /** - * The attr. - */ - private final MAttribute attr; - - /** - * The asc. - */ - private final boolean asc; - - /** - * Instantiates a new model order by. - * - * @param attr the attr - * @param asc the asc - */ - public MOrderBy(MAttribute attr, boolean asc) { - this.attr = attr; - this.asc = asc; - } - - /** - * Gets the attribute. - * - * @return the attribute - */ - public MAttribute getAttribute() { - return attr; - } - - /** - * Checks if is order ascending. - * - * @return true, if is order ascending - */ - public boolean isOrderAscending() { - return asc; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "order by " + attr + (asc ? " ascending" : " descending"); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (asc ? 1231 : 1237); - result = prime * result + ((attr == null) ? 0 : attr.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - MOrderBy other = (MOrderBy)obj; - if (asc != other.asc) return false; - if (attr == null) { - if (other.attr != null) return false; - } else if (!attr.equals(other.attr)) return false; - return true; - } - -} Index: rctags/ehcache-2.10.7.0.13/distribution/src/main/assembly/root/README.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/src/main/assembly/root/README.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/src/main/assembly/root/README.html (revision 0) @@ -1,151 +0,0 @@ - - - - README Notes For Ehcache ${project.version} - - The project home page is http://ehcache.org. Please see http://ehcache.org for a full change log, usage, product versions - and comprehensive documentation. - - - Introduction - ============ - Ehcache is a pure Java, in-process cache with the following features: - - 1. Fast and Light Weight - 1.1 Fast - 1.2 Simple - 1.3 Small foot print - 1.4 Minimal dependencies - 2. Scalable - 2.1 Provides Memory and Disk stores for scalabilty into gigabytes - 2.4 Scalable to hundreds of caches - 2.3 Tuned for high concurrent load on large multi-cpu servers - 2.4 Multiple CacheManagers per virtual machine - 3. Flexible - 3.1 Supports Object or Serializable caching - 3.2 Support cache-wide or Element-based expiry policies - 3.3 Provides LRU, LFU and FIFO cache eviction policies - 3.4 Provides Memory and Disk stores - 3.5 Distributed - 3.6 Dynamic, Runtime Configuration of Caches - 4. Standards Based - 4.1 Full implementation of JSR107 JCACHE API - 5. Extensible - 5.1 Listeners may be plugged in - 5.2 Peer Discovery, Replicators and Listeners may be plugged in - 5.3 Cache Extensions may be plugged in - 5.4 Cache Loaders may be plugged in - 5.5 Cache Exception Handlers may be plugged in - 6. Application Persistence - 6.1 Persistent disk store which stores data between VM restarts - 6.2 Flush to disk on demand - 7. Listeners - 7.1 CacheManager listeners - 7.2 Cache event listeners - 8. JMX Enabled - 9. Distributed Caching - 10. Support for replication via RMI or JGroups - 10.1 Peer Discovery - 10.2 Reliable Delivery - 10.3 Synchronous Or Asynchronous Replication - 10.4 Copy Or Invalidate Replication - 10.5 Transparent Replication - 10.6 Extensible - 10.7 Bootstrapping from Peers - 11. Cache Server - 11.1 RESTful cache server - 11.2 SOAP cache server - 11.3 comes as a WAR or as a complete server - 12. Java EE and Applied Caching - 12.1 Blocking Cache to avoid duplicate processing for concurrent operations - 12.2 SelfPopulating Cache for pull through caching of expensive operations - 12.3 Java EE Gzipping Servlet Filter - 12.4 Cacheable Commands - 12.5 Works with Hibernate - 12.6 Works with Google App Engine - 12.7 Transactional support through JTA - 13. High Quality - 13.1 High Test Coverage - 13.2 Automated Load, Limit and Performance System Tests - 13.3 Specific Concurrency Testing - 13.4 Production tested - 13.5 Fully documented - 13.6 Trusted by Popular Frameworks - 13.7 Conservative Commit policy - 13.8 Full public information on the history of every bug - 13.9 Responsiveness to serious bugs - 14. Open Source Licensing - 14.1 Apache 2.0 license - - Java Requirements - ================= - - Ehcache 1.7.2 and above supports Java 1.5 and 1.6 at runtime. Ehcache final releases are compiled with -target 1.5. - - The Ehcache 1.5 branch is being maintained for Java 1.4 users. - - Dependencies - ============ - - SLF4J API and one concrete logging implementation. The API jar and the JDK14 logging jar are included in the distribution. - - Maven POM snippet - ================= - - All Ehcache releases are placed in the central Maven repository. - - The Maven snippet for Ehcache is: - - <dependency> - <groupid>net.sf.ehcache</groupid> - <artifactid>ehcache</artifactid> - <version>${project.version}</version> - </dependency> - - Installation - ============ - Place the ehcache-core.jar, slf4j-api.jar and slf4j-jdk14.jar, or the concrete SLF4J logging implementation library of your choice into your classpath. - - For use with Terracotta, copy the ehcache-terracotta.jar to your classpath. - - Create an ehcache.xml configuration from the one supplied in the distribution and place it in the root of your classpath. - - The Terracotta server is in the terracotta directory. It includes start and stop scripts. - - For Maven based development, there is a tc-maven-plugin which works much like the Jetty plugin. See UsingWithMaven.txt, - which shows how to add the server to your integration test phase and interactive command use. - - For Ant based development, the tc-maven-plugin can be called from Ant. See UsingWithAnt.txt, - which shows how to add the server to your Ant build, and how to use the server interactively from Ant. - - - Samples - ======= - See the samples directory for ready-to-run samples which show to use the full features of Ehcache, including use with Terracotta. - - - - Documentation - ============= - See http://ehcache.org/documentation for full documentation. - - The JavaDoc is in the distribution and also online at http://ehcache.org/apidocs - - Licenses - ======== - This kit contains ehcache code which is governed by the Apache License, version 2.0. The license is in the licenses folder. - - Ehcache 1.7.1 and higher uses SLF4J for logging. The SLF4J license is included in the licenses folder. - - Known Issues - ============ - - 1. There are a number of known issues and workarounds for Tomcat. See the Using Ehcache with Tomcat chapter - in the online documentation. - - 2. See the FAQ online for a current list. - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/XATransactionStore.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/XATransactionStore.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/xa/XATransactionStore.java (revision 0) @@ -1,620 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.xa; - -import net.sf.ehcache.CacheEntry; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.statistics.StatisticBuilder; -import net.sf.ehcache.store.ElementValueComparator; -import net.sf.ehcache.store.Store; -import net.sf.ehcache.transaction.AbstractTransactionStore; -import net.sf.ehcache.transaction.SoftLock; -import net.sf.ehcache.transaction.SoftLockID; -import net.sf.ehcache.transaction.SoftLockManager; -import net.sf.ehcache.transaction.TransactionException; -import net.sf.ehcache.transaction.TransactionIDFactory; -import net.sf.ehcache.transaction.TransactionInterruptedException; -import net.sf.ehcache.transaction.TransactionTimeoutException; -import net.sf.ehcache.transaction.manager.TransactionManagerLookup; -import net.sf.ehcache.transaction.xa.commands.StorePutCommand; -import net.sf.ehcache.transaction.xa.commands.StoreRemoveCommand; -import net.sf.ehcache.util.LargeSet; -import net.sf.ehcache.util.SetAsList; -import net.sf.ehcache.writer.CacheWriterManager; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.statistics.observer.OperationObserver; - -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.TimeUnit; - -import javax.transaction.RollbackException; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.xa.XAException; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; - -/** - * @author Ludovic Orban - */ -public class XATransactionStore extends AbstractTransactionStore { - - private static final Logger LOG = LoggerFactory.getLogger(XATransactionStore.class.getName()); - - private final TransactionManagerLookup transactionManagerLookup; - private final TransactionIDFactory transactionIdFactory; - private final ElementValueComparator comparator; - private final SoftLockManager softLockManager; - private final Ehcache cache; - private final EhcacheXAResourceImpl recoveryResource; - - private final ConcurrentHashMap transactionToXAResourceMap = - new ConcurrentHashMap(); - private final ConcurrentHashMap transactionToTimeoutMap = new ConcurrentHashMap(); - - private final OperationObserver commitObserver = StatisticBuilder.operation(XaCommitOutcome.class) - .of(this).named("xa-commit").tag("xa-transactional").build(); - private final OperationObserver rollbackObserver = StatisticBuilder.operation(XaRollbackOutcome.class) - .of(this).named("xa-rollback").tag("xa-transactional").build(); - private final OperationObserver recoveryObserver = StatisticBuilder.operation(XaRecoveryOutcome.class) - .of(this).named("xa-recovery").tag("xa-transactional").build(); - - /** - * Constructor - * @param transactionManagerLookup the transaction manager lookup implementation - * @param softLockManager the soft lock manager - * @param transactionIdFactory the transaction ID factory - * @param cache the cache - * @param store the underlying store - */ - public XATransactionStore(TransactionManagerLookup transactionManagerLookup, SoftLockManager softLockManager, - TransactionIDFactory transactionIdFactory, Ehcache cache, Store store, ElementValueComparator comparator) { - super(store); - this.transactionManagerLookup = transactionManagerLookup; - this.transactionIdFactory = transactionIdFactory; - this.comparator = comparator; - if (transactionManagerLookup.getTransactionManager() == null) { - throw new TransactionException("no JTA transaction manager could be located, cannot bind twopc cache with JTA"); - } - this.softLockManager = softLockManager; - this.cache = cache; - - // this xaresource is for initial registration and recovery - this.recoveryResource = new EhcacheXAResourceImpl(cache, underlyingStore, transactionManagerLookup, softLockManager, transactionIdFactory, - comparator, commitObserver, rollbackObserver, recoveryObserver); - transactionManagerLookup.register(recoveryResource, true); - } - - @Override - public void dispose() { - super.dispose(); - transactionManagerLookup.unregister(recoveryResource, true); - } - - private Transaction getCurrentTransaction() throws SystemException { - Transaction transaction = transactionManagerLookup.getTransactionManager().getTransaction(); - if (transaction == null) { - throw new TransactionException("JTA transaction not started"); - } - return transaction; - } - - /** - * Get or create the XAResource of this XA store - * @return the EhcacheXAResource of this store - * @throws SystemException when something goes wrong with the transaction manager - */ - public EhcacheXAResourceImpl getOrCreateXAResource() throws SystemException { - Transaction transaction = getCurrentTransaction(); - EhcacheXAResourceImpl xaResource = (EhcacheXAResourceImpl) transactionToXAResourceMap.get(transaction); - if (xaResource == null) { - LOG.debug("creating new XAResource"); - xaResource = new EhcacheXAResourceImpl(cache, underlyingStore, transactionManagerLookup, - softLockManager, transactionIdFactory, comparator, commitObserver, rollbackObserver, - recoveryObserver); - transactionToXAResourceMap.put(transaction, xaResource); - xaResource.addTwoPcExecutionListener(new CleanupXAResource(getCurrentTransaction())); - } - return xaResource; - } - - private XATransactionContext getTransactionContext() { - try { - Transaction transaction = getCurrentTransaction(); - EhcacheXAResourceImpl xaResource = (EhcacheXAResourceImpl) transactionToXAResourceMap.get(transaction); - if (xaResource == null) { - return null; - } - XATransactionContext transactionContext = xaResource.getCurrentTransactionContext(); - - if (transactionContext == null) { - transactionManagerLookup.register(xaResource, false); - LOG.debug("creating new XA context"); - transactionContext = xaResource.createTransactionContext(); - xaResource.addTwoPcExecutionListener(new UnregisterXAResource()); - } else { - transactionContext = xaResource.getCurrentTransactionContext(); - } - - LOG.debug("using XA context {}", transactionContext); - return transactionContext; - } catch (SystemException e) { - throw new TransactionException("cannot get the current transaction", e); - } catch (RollbackException e) { - throw new TransactionException("transaction rolled back", e); - } - } - - private XATransactionContext getOrCreateTransactionContext() { - try { - EhcacheXAResourceImpl xaResource = getOrCreateXAResource(); - XATransactionContext transactionContext = xaResource.getCurrentTransactionContext(); - - if (transactionContext == null) { - transactionManagerLookup.register(xaResource, false); - LOG.debug("creating new XA context"); - transactionContext = xaResource.createTransactionContext(); - xaResource.addTwoPcExecutionListener(new UnregisterXAResource()); - } else { - transactionContext = xaResource.getCurrentTransactionContext(); - } - - LOG.debug("using XA context {}", transactionContext); - return transactionContext; - } catch (SystemException e) { - throw new TransactionException("cannot get the current transaction", e); - } catch (RollbackException e) { - throw new TransactionException("transaction rolled back", e); - } - } - - /** - * This class is used to clean up the transactionToTimeoutMap after a transaction - * committed or rolled back. - */ - private final class CleanupTimeout implements Synchronization { - private final Transaction transaction; - - private CleanupTimeout(final Transaction transaction) { - this.transaction = transaction; - } - - public void beforeCompletion() { - } - - public void afterCompletion(final int status) { - transactionToTimeoutMap.remove(transaction); - } - } - - /** - * This class is used to clean up the transactionToXAResourceMap after a transaction - * committed or rolled back. - */ - private final class CleanupXAResource implements XAExecutionListener { - private final Transaction transaction; - - private CleanupXAResource(Transaction transaction) { - this.transaction = transaction; - } - - public void beforePrepare(EhcacheXAResource xaResource) { - } - - public void afterCommitOrRollback(EhcacheXAResource xaResource) { - transactionToXAResourceMap.remove(transaction); - } - } - - /** - * This class is used to unregister the XAResource after a transaction - * committed or rolled back. - */ - private final class UnregisterXAResource implements XAExecutionListener { - - public void beforePrepare(EhcacheXAResource xaResource) { - } - - public void afterCommitOrRollback(EhcacheXAResource xaResource) { - transactionManagerLookup.unregister(xaResource, false); - } - } - - - /** - * @return milliseconds left before timeout - */ - private long assertNotTimedOut() { - try { - if (Thread.interrupted()) { - throw new TransactionInterruptedException("transaction interrupted"); - } - - Transaction transaction = getCurrentTransaction(); - Long timeoutTimestamp = transactionToTimeoutMap.get(transaction); - long now = MILLISECONDS.convert(System.nanoTime(), TimeUnit.NANOSECONDS); - if (timeoutTimestamp == null) { - long timeout; - EhcacheXAResource xaResource = transactionToXAResourceMap.get(transaction); - if (xaResource != null) { - int xaResourceTimeout = xaResource.getTransactionTimeout(); - timeout = MILLISECONDS.convert(xaResourceTimeout, TimeUnit.SECONDS); - } else { - int defaultTransactionTimeout = cache.getCacheManager().getTransactionController().getDefaultTransactionTimeout(); - timeout = MILLISECONDS.convert(defaultTransactionTimeout, TimeUnit.SECONDS); - } - timeoutTimestamp = now + timeout; - transactionToTimeoutMap.put(transaction, timeoutTimestamp); - try { - transaction.registerSynchronization(new CleanupTimeout(transaction)); - } catch (RollbackException e) { - throw new TransactionException("transaction has been marked as rollback only", e); - } - return timeout; - } else { - long timeToExpiry = timeoutTimestamp - now; - if (timeToExpiry <= 0) { - throw new TransactionTimeoutException("transaction timed out"); - } else { - return timeToExpiry; - } - } - } catch (SystemException e) { - throw new TransactionException("cannot get the current transaction", e); - } catch (XAException e) { - throw new TransactionException("cannot get the XAResource transaction timeout", e); - } - } - - /* transactional methods */ - - /** - * {@inheritDoc} - */ - public Element get(Object key) { - LOG.debug("cache {} get {}", cache.getName(), key); - XATransactionContext context = getTransactionContext(); - Element element; - if (context == null) { - element = getFromUnderlyingStore(key); - } else { - element = context.get(key); - if (element == null && !context.isRemoved(key)) { - element = getFromUnderlyingStore(key); - } - } - return element; - } - - - /** - * {@inheritDoc} - */ - public Element getQuiet(Object key) { - LOG.debug("cache {} getQuiet {}", cache.getName(), key); - XATransactionContext context = getTransactionContext(); - Element element; - if (context == null) { - element = getQuietFromUnderlyingStore(key); - } else { - element = context.get(key); - if (element == null && !context.isRemoved(key)) { - element = getQuietFromUnderlyingStore(key); - } - } - return element; - } - - /** - * {@inheritDoc} - */ - public int getSize() { - LOG.debug("cache {} getSize", cache.getName()); - XATransactionContext context = getOrCreateTransactionContext(); - int size = underlyingStore.getSize(); - return Math.max(0, size + context.getSizeModifier()); - } - - /** - * {@inheritDoc} - */ - public int getTerracottaClusteredSize() { - try { - Transaction transaction = transactionManagerLookup.getTransactionManager().getTransaction(); - if (transaction == null) { - return underlyingStore.getTerracottaClusteredSize(); - } - } catch (SystemException se) { - throw new TransactionException("cannot get the current transaction", se); - } - - LOG.debug("cache {} getTerracottaClusteredSize", cache.getName()); - XATransactionContext context = getOrCreateTransactionContext(); - int size = underlyingStore.getTerracottaClusteredSize(); - return size + context.getSizeModifier(); - } - - /** - * {@inheritDoc} - */ - public boolean containsKey(Object key) { - LOG.debug("cache {} containsKey", cache.getName(), key); - XATransactionContext context = getOrCreateTransactionContext(); - return !context.isRemoved(key) && (context.getAddedKeys().contains(key) || underlyingStore.containsKey(key)); - } - - /** - * {@inheritDoc} - */ - public List getKeys() { - LOG.debug("cache {} getKeys", cache.getName()); - XATransactionContext context = getOrCreateTransactionContext(); - Set keys = new LargeSet() { - - @Override - public int sourceSize() { - return underlyingStore.getSize(); - } - - @Override - public Iterator sourceIterator() { - return underlyingStore.getKeys().iterator(); - } - }; - keys.addAll(context.getAddedKeys()); - keys.removeAll(context.getRemovedKeys()); - return new SetAsList(keys); - } - - - private Element getFromUnderlyingStore(final Object key) { - while (true) { - long timeLeft = assertNotTimedOut(); - LOG.debug("cache {} underlying.get key {} not timed out, time left: " + timeLeft, cache.getName(), key); - - Element element = underlyingStore.get(key); - if (element == null) { - return null; - } - Object value = element.getObjectValue(); - if (value instanceof SoftLockID) { - SoftLockID softLockId = (SoftLockID) value; - SoftLock softLock = softLockManager.findSoftLockById(softLockId); - if (softLock == null) { - LOG.debug("cache {} underlying.get key {} soft lock died, retrying...", cache.getName(), key); - continue; - } else { - try { - LOG.debug("cache {} key {} soft locked, awaiting unlock...", cache.getName(), key); - if (softLock.tryLock(timeLeft)) { - softLock.clearTryLock(); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - } else { - return element; - } - } - } - - private Element getQuietFromUnderlyingStore(final Object key) { - while (true) { - long timeLeft = assertNotTimedOut(); - LOG.debug("cache {} underlying.getQuiet key {} not timed out, time left: " + timeLeft, cache.getName(), key); - - Element element = underlyingStore.getQuiet(key); - if (element == null) { - return null; - } - Object value = element.getObjectValue(); - if (value instanceof SoftLockID) { - SoftLockID softLockId = (SoftLockID) value; - SoftLock softLock = softLockManager.findSoftLockById(softLockId); - if (softLock == null) { - LOG.debug("cache {} underlying.getQuiet key {} soft lock died, retrying...", cache.getName(), key); - continue; - } else { - try { - LOG.debug("cache {} key {} soft locked, awaiting unlock...", cache.getName(), key); - if (softLock.tryLock(timeLeft)) { - softLock.clearTryLock(); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - } else { - return element; - } - } - } - - private Element getCurrentElement(final Object key, final XATransactionContext context) { - Element previous = context.get(key); - if (previous == null && !context.isRemoved(key)) { - previous = getQuietFromUnderlyingStore(key); - } - return previous; - } - - /** - * {@inheritDoc} - */ - public boolean put(Element element) throws CacheException { - LOG.debug("cache {} put {}", cache.getName(), element); - // this forces enlistment so the XA transaction timeout can be propagated to the XA resource - getOrCreateTransactionContext(); - - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - return internalPut(new StorePutCommand(oldElement, element)); - } - - /** - * {@inheritDoc} - */ - public boolean putWithWriter(Element element, CacheWriterManager writerManager) throws CacheException { - LOG.debug("cache {} putWithWriter {}", cache.getName(), element); - // this forces enlistment so the XA transaction timeout can be propagated to the XA resource - getOrCreateTransactionContext(); - - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - if (writerManager != null) { - writerManager.put(element); - } else { - cache.getWriterManager().put(element); - } - return internalPut(new StorePutCommand(oldElement, element)); - } - - private boolean internalPut(final StorePutCommand putCommand) { - final Element element = putCommand.getElement(); - boolean isNull; - if (element == null) { - return true; - } - XATransactionContext context = getOrCreateTransactionContext(); - // In case this key is currently being updated... - isNull = underlyingStore.get(element.getKey()) == null; - if (isNull) { - isNull = context.get(element.getKey()) == null; - } - context.addCommand(putCommand, element); - return isNull; - } - - - /** - * {@inheritDoc} - */ - public Element remove(Object key) { - LOG.debug("cache {} remove {}", cache.getName(), key); - // this forces enlistment so the XA transaction timeout can be propagated to the XA resource - getOrCreateTransactionContext(); - - Element oldElement = getQuietFromUnderlyingStore(key); - return removeInternal(new StoreRemoveCommand(key, oldElement)); - } - - private Element removeInternal(final StoreRemoveCommand command) { - Element element = command.getEntry().getElement(); - getOrCreateTransactionContext().addCommand(command, element); - return element; - } - - /** - * {@inheritDoc} - */ - public Element removeWithWriter(Object key, CacheWriterManager writerManager) throws CacheException { - LOG.debug("cache {} removeWithWriter {}", cache.getName(), key); - // this forces enlistment so the XA transaction timeout can be propagated to the XA resource - getOrCreateTransactionContext(); - - Element oldElement = getQuietFromUnderlyingStore(key); - if (writerManager != null) { - writerManager.remove(new CacheEntry(key, null)); - } else { - cache.getWriterManager().remove(new CacheEntry(key, null)); - } - return removeInternal(new StoreRemoveCommand(key, oldElement)); - } - - /** - * {@inheritDoc} - */ - public void removeAll() throws CacheException { - LOG.debug("cache {} removeAll", cache.getName()); - List keys = getKeys(); - for (Object key : keys) { - remove(key); - } - } - - /** - * {@inheritDoc} - */ - public Element putIfAbsent(Element element) throws NullPointerException { - LOG.debug("cache {} putIfAbsent {}", cache.getName(), element); - XATransactionContext context = getOrCreateTransactionContext(); - Element previous = getCurrentElement(element.getObjectKey(), context); - - if (previous == null) { - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - context.addCommand(new StorePutCommand(oldElement, element), element); - } - - return previous; - } - - /** - * {@inheritDoc} - */ - public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { - LOG.debug("cache {} removeElement {}", cache.getName(), element); - XATransactionContext context = getOrCreateTransactionContext(); - Element previous = getCurrentElement(element.getKey(), context); - - if (previous != null && comparator.equals(previous, element)) { - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - context.addCommand(new StoreRemoveCommand(element.getObjectKey(), oldElement), element); - return previous; - } - return null; - } - - /** - * {@inheritDoc} - */ - public boolean replace(Element old, Element element, ElementValueComparator comparator) - throws NullPointerException, IllegalArgumentException { - LOG.debug("cache {} replace2 {}", cache.getName(), element); - XATransactionContext context = getOrCreateTransactionContext(); - Element previous = getCurrentElement(element.getKey(), context); - - boolean replaced = false; - if (previous != null && comparator.equals(previous, old)) { - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - context.addCommand(new StorePutCommand(oldElement, element), element); - replaced = true; - } - return replaced; - } - - /** - * {@inheritDoc} - */ - public Element replace(Element element) throws NullPointerException { - LOG.debug("cache {} replace1 {}", cache.getName(), element); - XATransactionContext context = getOrCreateTransactionContext(); - Element previous = getCurrentElement(element.getKey(), context); - - if (previous != null) { - Element oldElement = getQuietFromUnderlyingStore(element.getObjectKey()); - context.addCommand(new StorePutCommand(oldElement, element), element); - } - return previous; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/NonstopConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/NonstopConfiguration.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/NonstopConfiguration.java (revision 0) @@ -1,300 +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 net.sf.ehcache.CacheException; - -/** - * Configuration class of nonstop caches - * - * @author Abhishek Sanoujam - * @author Eugene Kononov - * - */ -public class NonstopConfiguration implements Cloneable { - - /** - * System Property name for bulk operations multiply factor - */ - public static final String BULK_OPS_TIMEOUT_MULTIPLY_FACTOR = "net.sf.ehcache.nonstop.bulkOpsTimeoutMultiplyFactor"; - - /** - * Default value of nonstop attribute - */ - public static final boolean DEFAULT_ENABLED = true; - - /** - * Default value of immediateTimeout attribute - */ - public static final boolean DEFAULT_IMMEDIATE_TIMEOUT = false; - - /** - * Default value of timeoutMillis attribute - */ - public static final int DEFAULT_TIMEOUT_MILLIS = 30000; - - /** - * Default value of searchTimeoutMillis attribute - */ - public static final int DEFAULT_SEARCH_TIMEOUT_MILLIS = 30000; - - /** - * Default value of timeout multiplication factor for bulk operations like removeAll or size - */ - public static final int DEFAULT_BULK_OP_TIMEOUT_FACTOR = Integer.getInteger(BULK_OPS_TIMEOUT_MULTIPLY_FACTOR, 10); - - /** - * Default value of timeoutBehavior attribute - */ - public static final TimeoutBehaviorConfiguration DEFAULT_TIMEOUT_BEHAVIOR = new TimeoutBehaviorConfiguration(); - - private volatile boolean enabled = DEFAULT_ENABLED; - private volatile boolean immediateTimeout = DEFAULT_IMMEDIATE_TIMEOUT; - private volatile long timeoutMillis = DEFAULT_TIMEOUT_MILLIS; - private volatile long searchTimeoutMillis = DEFAULT_SEARCH_TIMEOUT_MILLIS; - private volatile int bulkOpsTimeoutMultiplyFactor = DEFAULT_BULK_OP_TIMEOUT_FACTOR; - private TimeoutBehaviorConfiguration timeoutBehavior = new TimeoutBehaviorConfiguration(DEFAULT_TIMEOUT_BEHAVIOR); - private volatile boolean configFrozen; - - /** - * Freeze the config. Once frozen, 'enabled' can't be changed - */ - public void freezeConfig() { - configFrozen = true; - } - - /** - * Returns true if nonstop is enabled in config - * - * @return true if nonstop is enabled in config - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Set the value of nonstop is enabled or not - * - * @param enabled the new value - */ - public void setEnabled(boolean enabled) { - if (configFrozen) { - throw new CacheException("NonstopConfiguration cannot be enabled or disabled after Cache has been initialized."); - } - this.enabled = enabled; - } - - /** - * Set the value of nonstop - * - * @param nonstop - * @return this configuration instance - */ - public NonstopConfiguration enabled(boolean nonstop) { - this.setEnabled(nonstop); - return this; - } - - /** - * Returns true if immediateTimeout is set to true - * - * @return true if immediateTimeout is set to true - */ - public boolean isImmediateTimeout() { - return immediateTimeout; - } - - /** - * Set the value of immediateTimeout - * - * @param immediateTimeout the new value - */ - public void setImmediateTimeout(boolean immediateTimeout) { - this.immediateTimeout = immediateTimeout; - } - - /** - * Set the value of immediateTimeout - * - * @param immediateTimeout - * @return this configuration instance - */ - public NonstopConfiguration immediateTimeout(boolean immediateTimeout) { - this.setImmediateTimeout(immediateTimeout); - return this; - } - - /** - * Returns the value of timeout in milliseconds - * - * @return the value of timeout in milliseconds - */ - public long getTimeoutMillis() { - return timeoutMillis; - } - - /** - * Set the value of timeoutMillis - * - * @param timeoutMillis the new value - */ - public void setTimeoutMillis(long timeoutMillis) { - this.timeoutMillis = timeoutMillis; - } - - /** - * Returns the value of the search timeout in milliseconds - * - * @return the value of the search timeout in milliseconds - */ - public long getSearchTimeoutMillis() { - return searchTimeoutMillis; - } - - /** - * Set the value of the search timeout - * - * @param searchTimeoutMillis the new value - */ - public void setSearchTimeoutMillis(long searchTimeoutMillis) { - this.searchTimeoutMillis = searchTimeoutMillis; - } - - /** - * returns the time out multiplication factor for bulk cache operations - * - * @return the value of factor - */ - public int getBulkOpsTimeoutMultiplyFactor() { - return bulkOpsTimeoutMultiplyFactor; - } - - /** - * Sets the value of the multiplication factor for bulk cache operations - * - * @param bulkOpsTimeoutMultiplyFactor the new value - */ - public void setBulkOpsTimeoutMultiplyFactor(int bulkOpsTimeoutMultiplyFactor) { - this.bulkOpsTimeoutMultiplyFactor = bulkOpsTimeoutMultiplyFactor; - } - - /** - * Set the value of timeoutMillis - * - * @param timeoutMillis the new value - * @return this configuration instance - */ - public NonstopConfiguration timeoutMillis(long timeoutMillis) { - this.setTimeoutMillis(timeoutMillis); - return this; - } - - /** - * Set the value of the search timeout - * - * @param searchTimeoutMillis the new value of the search timeout in milliseconds - * @return this configuration instance - */ - public NonstopConfiguration searchTimeoutMillis(long searchTimeoutMillis) { - this.setSearchTimeoutMillis(searchTimeoutMillis); - return this; - } - - - /** - * Returns value of timeoutBehavior configured - * - * @return value of timeoutBehavior configured - */ - public TimeoutBehaviorConfiguration getTimeoutBehavior() { - return timeoutBehavior; - } - - /** - * Set the value of timeoutBehavior - * - * @param timeoutBehavior - */ - public void addTimeoutBehavior(TimeoutBehaviorConfiguration timeoutBehavior) { - this.timeoutBehavior = timeoutBehavior; - } - - /** - * Set the value of timeoutBehavior - * - * @param timeoutBehavior - * @return this configuration instance - */ - public NonstopConfiguration timeoutBehavior(TimeoutBehaviorConfiguration timeoutBehavior) { - this.addTimeoutBehavior(timeoutBehavior); - return this; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + bulkOpsTimeoutMultiplyFactor; - result = prime * result + (configFrozen ? 1231 : 1237); - result = prime * result + (enabled ? 1231 : 1237); - result = prime * result + (immediateTimeout ? 1231 : 1237); - result = prime * result + ((timeoutBehavior == null) ? 0 : timeoutBehavior.hashCode()); - result = prime * result + (int) (timeoutMillis ^ (timeoutMillis >>> 32)); - result = prime * result + (int) (searchTimeoutMillis ^ (searchTimeoutMillis >>> 32)); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } else if (obj == null || getClass() != obj.getClass()) { - return false; - } - NonstopConfiguration other = (NonstopConfiguration) obj; - if (bulkOpsTimeoutMultiplyFactor != other.bulkOpsTimeoutMultiplyFactor || - configFrozen != other.configFrozen || - enabled != other.enabled || - immediateTimeout != other.immediateTimeout || - searchTimeoutMillis != other.searchTimeoutMillis || - timeoutMillis != other.timeoutMillis) { - return false; - } - if (timeoutBehavior == null) { - if (other.timeoutBehavior != null) { - return false; - } - } else if (!timeoutBehavior.equals(other.timeoutBehavior)) { - return false; - } - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public NonstopConfiguration clone() throws CloneNotSupportedException { - try { - NonstopConfiguration clone = (NonstopConfiguration) super.clone(); - clone.addTimeoutBehavior((TimeoutBehaviorConfiguration) timeoutBehavior.clone()); - return clone; - } catch (CloneNotSupportedException e) { - throw new CacheException(e); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/management/sampled/CacheManagerSampler.java (revision 0) @@ -1,334 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.management.sampled; - -import java.util.Map; - -import net.sf.ehcache.util.ManagementAttribute; - -/** - * An abstraction for sampled cache manager usage statistics. - * - * @author Abhishek Sanoujam - * @author byoukste - */ -public interface CacheManagerSampler { - /** - * Gets the actual name of the cache manager. - */ - @ManagementAttribute - String getName(); - - /** - * Gets the cluster uuid if applicable. - * - * @return the cluster uuid - */ - @ManagementAttribute - String getClusterUUID(); - - /** - * Gets the status attribute of the Ehcache - * - * @return The status value, as a String from the Status enum class - */ - @ManagementAttribute - String getStatus(); - - /** - * Enables/disables each cache contained by this CacheManager - * - * @param enabled - */ - void setEnabled(boolean enabled); - - /** - * Returns if each cache is enabled. - * - * @return boolean indicating that each cache is enabled - */ - @ManagementAttribute - boolean isEnabled(); - - /** - * Shuts down the CacheManager. - * - * If the shutdown occurs on the singleton, then the singleton is removed, so that if a singleton access method is called, a new - * singleton will be created. - */ - void shutdown(); - - /** - * Clears the contents of all caches in the CacheManager, but without - * removing any caches. - * - * This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the - * {@link net.sf.ehcache.Ehcache#removeAll()} mehod on each cache is called. - */ - void clearAll(); - - /** - * Gets the cache names managed by the CacheManager - */ - @ManagementAttribute - String[] getCacheNames() throws IllegalStateException; - - /** - * Get a map of cache name to performance metrics (hits, misses). - * - * @return a map of cache metrics - */ - Map getCacheMetrics(); - - /** - * @return aggregate hit rate - */ - long getCacheHitRate(); - - /** - * @return aggregate in-memory hit rate - */ - long getCacheInMemoryHitRate(); - - /** - * @return aggregate off-heap hit rate - */ - long getCacheOffHeapHitRate(); - - /** - * @return aggregate on-disk hit rate - */ - long getCacheOnDiskHitRate(); - - /** - * @return aggregate miss rate - */ - long getCacheMissRate(); - - /** - * @return aggregate in-memory miss rate - */ - long getCacheInMemoryMissRate(); - - /** - * @return aggregate off-heap miss rate - */ - long getCacheOffHeapMissRate(); - - /** - * @return aggregate on-disk miss rate - */ - long getCacheOnDiskMissRate(); - - /** - * @return aggregate put rate - */ - long getCachePutRate(); - - /** - * @return aggregate update rate - */ - long getCacheUpdateRate(); - - /** - * @return aggregate remove rate - */ - long getCacheRemoveRate(); - - /** - * @return aggregate eviction rate - */ - long getCacheEvictionRate(); - - /** - * @return aggregate expiration rate - */ - long getCacheExpirationRate(); - - /** - * @return aggregate average get time (ms.) - */ - float getCacheAverageGetTime(); - - /** - * @return if any contained caches are configured for search - */ - @ManagementAttribute - boolean getSearchable(); - - /** - * @return aggregate search rate - */ - long getCacheSearchRate(); - - /** - * @return aggregate search time - */ - long getCacheAverageSearchTime(); - - /** - * generateActiveConfigDeclaration - * - * @return CacheManager configuration as String - */ - String generateActiveConfigDeclaration(); - - /** - * generateActiveConfigDeclaration - * - * @param cacheName - * @return Cache configuration as String - */ - String generateActiveConfigDeclaration(String cacheName); - - /** - * Are any of the caches transactional - * - * @see net.sf.ehcache.config.CacheConfiguration.TransactionalMode - */ - @ManagementAttribute - boolean getTransactional(); - - /** - * Get the committed transactions count - * - * @return the committed transactions count - */ - long getTransactionCommittedCount(); - - /** - * @return aggregate Xa commit rate - */ - long getTransactionCommitRate(); - - /** - * Get the rolled back transactions count - * - * @return the rolled back transactions count - */ - long getTransactionRolledBackCount(); - - /** - * @return aggregate Xa rollback rate - */ - long getTransactionRollbackRate(); - - /** - * Get the timed out transactions count. Note that only transactions which failed to - * commit due to a timeout are taken into account - * - * @return the timed out transactions count - */ - long getTransactionTimedOutCount(); - - /** - * Returns whether any caches are configured for write-behind - */ - @ManagementAttribute - boolean getHasWriteBehindWriter(); - - /** - * Returns the total length of all write-behind queues across all caches - * - * @return aggregate writer-behind queue length - */ - long getWriterQueueLength(); - - /** - * Maximum elements that can be queued for processing by the write-behind writer - * - * @return aggregate of the maximum elements that can be waiting to be processed - * by the write-behind writer across all caches - */ - @ManagementAttribute - int getWriterMaxQueueSize(); - - /** - * Maximum number of bytes of entries in the disk stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the disk stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalDisk(); - - /** - * @param maxBytes - */ - void setMaxBytesLocalDisk(long maxBytes); - - /** - * @param maxBytes - */ - void setMaxBytesLocalDiskAsString(String maxBytes); - - /** - * @return Original input for maxBytesLocalDisk - */ - @ManagementAttribute - String getMaxBytesLocalDiskAsString(); - - /** - * Maximum number of bytes of entries in the heap memory stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the heap memory stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalHeap(); - - /** - * @return Original input for maxBytesLocalHeap - */ - @ManagementAttribute - String getMaxBytesLocalHeapAsString(); - - /** - * @param maxBytes - */ - void setMaxBytesLocalHeap(long maxBytes); - - /** - * @param maxBytes - */ - void setMaxBytesLocalHeapAsString(String maxBytes); - - /** - * Maximum number of bytes of entries in the off-heap stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the off-heap stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalOffHeap(); - - /** - * @return Original input for maxBytesLocalOffHeap - */ - @ManagementAttribute - String getMaxBytesLocalOffHeapAsString(); - - /** - * Execute a BMSQL query against the CacheManager and return result grid. - * - * @param queryString - * @return query result grid - */ - Object[][] executeQuery(String queryString); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 0) @@ -1,43 +0,0 @@ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.constructs.EhcacheDecoratorAdapter; - -import java.io.Serializable; - -/** - * This decorator class intercepts cache gets and acts as a cache read through during or before a cache load and acts as a system of record - * after the cache has been loaded. Cache read through: get the object from the cache, if not in cache, get object from database, load in to - * cache and return object. System of Record (SOR): only get the object from the cache. - * - * @author sdalto2 - * - */ -public class NonHibernateCacheDecorator extends EhcacheDecoratorAdapter { - - private Ehcache cache; - public NonHibernateCacheDecorator(Ehcache cache) { - super(cache); - this.cache=cache; - } - - /** - * This get method will always call Element get(Serializable key) So a serializable key is mandatory. - */ - @Override - public Element get(Object key) throws IllegalStateException, CacheException { - return get((Serializable) key); - } - - @Override - public Element get(Serializable key) throws IllegalStateException, CacheException { - return new Element(1,"dummy"); - } - @Override - public void removeAll(boolean doNotNotifyListeners) throws IllegalStateException, CacheException { - cache.removeAll(doNotNotifyListeners); - } - -} \ No newline at end of file Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 0) @@ -1,218 +0,0 @@ -package net.sf.ehcache.util.concurrent; - -import net.sf.ehcache.Element; -import org.junit.Test; - -import java.util.HashSet; -import java.util.Random; -import java.util.UUID; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - -/** - * @author Alex Snaps - */ -public class ConcurrentHashMapTest { - - private static final int ENTRIES = 10000; - - @Test - public void testRandomValuesWithObjects() { - - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final Object o = new Object(); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testRandomValuesWithComparable() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final EvilComparableKey o = new EvilComparableKey(UUID.randomUUID().toString()); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testReplaceWithWeirdBehavior() { - ConcurrentHashMap elementMap = new ConcurrentHashMap(); - final Element initialElement = new Element("key", "foo"); - elementMap.put("key", initialElement); - assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(true)); - assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(false)); - - ConcurrentHashMap stringMap = new ConcurrentHashMap(); - final String initialString = "foo"; - stringMap.put("key", initialString); - assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true)); - assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true)); - } - - @Test - public void testRandomValues() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - final long seed = System.nanoTime(); - System.out.println("SEED: " + seed); - final Random random = new Random(seed); - - for(int i = 0; i < ENTRIES; i++) { - final Object o; - switch(i % 4) { - case 0: - final int hashCode = random.nextInt(); - o = new Object() { - @Override - public int hashCode() { - return hashCode; - } - }; - break; - case 1: - o = new EvilKey(Integer.toString(i)); - break; - default: - o = new EvilComparableKey(Integer.toString(i)); - - } - assertThat(map.put(o, new KeyHolder(o)) == null, is(true)); - } - - for (Object o : map.keySet()) { - assertThat(o.toString(), map.containsKey(o), is(true)); - assertThat(o.toString(), map.get(o), notNullValue()); - } - - assertThings(map); - } - - @Test - public void testRandomValuesWithCollisions() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final EvilKey o = new EvilKey(UUID.randomUUID().toString()); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testUsesObjectIdentityForElementsOnly() { - - final String key = "ourKey"; - - ConcurrentHashMap map = new ConcurrentHashMap(); - - String value = new String("key"); - String valueAgain = new String("key"); - map.put(key, value); - assertThat(map.replace(key, valueAgain, valueAgain), is(true)); - assertThat(map.replace(key, value, valueAgain), is(true)); - - Element elementValue = new Element(key, value); - Element elementValueAgain = new Element(key, value); - map.put(key, elementValue); - assertThat(map.replace(key, elementValueAgain, elementValue), is(false)); - assertThat(map.replace(key, elementValue, elementValueAgain), is(true)); - assertThat(map.replace(key, elementValue, elementValueAgain), is(false)); - assertThat(map.replace(key, elementValueAgain, elementValue), is(true)); - } - - @Test - public void testActuallyWorks() throws InterruptedException { - final long top = 100000000; - final String key = "counter"; - final ConcurrentHashMap map = new ConcurrentHashMap(); - map.put(key, 0L); - - final Runnable runnable = new Runnable() { - @Override - public void run() { - for(Long val = map.get(key); val < top && map.replace(key, val, val + 1); val = map.get(key)); - } - }; - - Thread[] threads = new Thread[Runtime.getRuntime().availableProcessors() * 2]; - for (int i = 0, threadsLength = threads.length; i < threadsLength; ) { - threads[i] = new Thread(runnable); - threads[i].setName("Mutation thread #" + ++i); - threads[i - 1].start(); - } - - for (Thread thread : threads) { - thread.join(); - } - - assertThat(map.get(key), is(top)); - - } - - private void assertThings(final ConcurrentHashMap, ?> map) { - assertThat(map.size(), is(ENTRIES)); - - for(int i = 0; i < 100; i ++) { - final HashSet randomValues = new HashSet(map.getRandomValues(ENTRIES)); - assertThat(randomValues.size(), is(ENTRIES)); - for (Object randomValue : randomValues) { - assertThat(randomValue, instanceOf(KeyHolder.class)); - final Object key = ((KeyHolder)randomValue).key; - assertThat("Missing " + key, map.containsKey(key), is(true)); - } - } - } -} - -class KeyHolder { - final K key; - - KeyHolder(final K key) { - this.key = key; - } -} - -class EvilKey { - final String value; - - EvilKey(final String value) { - this.value = value; - } - - @Override - public int hashCode() { - return this.value.hashCode() & 1; - } - - @Override - public boolean equals(final Object obj) { - return obj != null && obj.getClass() == this.getClass() && ((EvilKey)obj).value.equals(value); - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + " { " + value + " }"; - } -} - -class EvilComparableKey extends EvilKey implements Comparable { - - EvilComparableKey(final String value) { - super(value); - } - - @Override - public int compareTo(final EvilComparableKey o) { - return value.compareTo(o != null ? o.value : null); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 0) @@ -1,36 +0,0 @@ -/* - * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.terracotta.toolkit.Toolkit; - -import com.tc.test.config.model.TestConfig; - -import junit.framework.Assert; - -public class HttpUrlConfigCacheTest extends AbstractCacheTestBase { - - public HttpUrlConfigCacheTest(TestConfig testConfig) { - super("http-url-config-cache-test.xml", testConfig, Client.class); - } - - public static class Client extends ClientBase { - - public Client(String[] args) { - super("test", args); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - cache.put(new Element("key", "value")); - Assert.assertEquals("value", cache.get("key").getObjectValue()); - } - - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 0) @@ -1,242 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof; - -import net.sf.ehcache.config.MemoryUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.instrument.Instrumentation; -import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.List; - -/** - * This will try to load the agent using the Attach API of JDK6. - * If you are on an older JDK (v5) you can still use the agent by adding the -javaagent:[pathTojar] to your VM - * startup script - * - * @author Alex Snaps - */ -final class AgentLoader { - - private static final Logger LOGGER = LoggerFactory.getLogger(AgentLoader.class); - - private static final String INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME = "net.sf.ehcache.sizeof.agent.instrumentation"; - private static final String SIZEOF_AGENT_CLASSNAME = "net.sf.ehcache.pool.sizeof.SizeOfAgent"; - private static final String VIRTUAL_MACHINE_CLASSNAME = "com.sun.tools.attach.VirtualMachine"; - private static final Method VIRTUAL_MACHINE_ATTACH; - private static final Method VIRTUAL_MACHINE_DETACH; - private static final Method VIRTUAL_MACHINE_LOAD_AGENT; - - private static volatile Instrumentation instrumentation; - - static { - Method attach = null; - Method detach = null; - Method loadAgent = null; - try { - Class> virtualMachineClass = getVirtualMachineClass(); - attach = virtualMachineClass.getMethod("attach", String.class); - detach = virtualMachineClass.getMethod("detach"); - loadAgent = virtualMachineClass.getMethod("loadAgent", String.class); - } catch (Throwable e) { - LOGGER.info("Unavailable or unrecognised attach API : {}", e.toString()); - } - VIRTUAL_MACHINE_ATTACH = attach; - VIRTUAL_MACHINE_DETACH = detach; - VIRTUAL_MACHINE_LOAD_AGENT = loadAgent; - } - - private static Class> getVirtualMachineClass() throws ClassNotFoundException { - try { - return AccessController.doPrivileged(new PrivilegedExceptionAction>() { - public Class> run() throws Exception { - try { - return ClassLoader.getSystemClassLoader().loadClass(VIRTUAL_MACHINE_CLASSNAME); - } catch (ClassNotFoundException cnfe) { - for (File jar : getPossibleToolsJars()) { - try { - Class> vmClass = new URLClassLoader(new URL[] {jar.toURL()}).loadClass(VIRTUAL_MACHINE_CLASSNAME); - LOGGER.info("Located valid 'tools.jar' at '{}'", jar); - return vmClass; - } catch (Throwable t) { - LOGGER.info("Exception while loading tools.jar from '{}': {}", jar, t); - } - } - throw new ClassNotFoundException(VIRTUAL_MACHINE_CLASSNAME); - } - } - }); - } catch (PrivilegedActionException pae) { - Throwable actual = pae.getCause(); - if (actual instanceof ClassNotFoundException) { - throw (ClassNotFoundException) actual; - } - throw new AssertionError("Unexpected checked exception : " + actual); - } - } - - private static List getPossibleToolsJars() { - List jars = new ArrayList(); - - File javaHome = new File(System.getProperty("java.home")); - File jreSourced = new File(javaHome, "lib/tools.jar"); - if (jreSourced.exists()) { - jars.add(jreSourced); - } - if ("jre".equals(javaHome.getName())) { - File jdkHome = new File(javaHome, "../"); - File jdkSourced = new File(jdkHome, "lib/tools.jar"); - if (jdkSourced.exists()) { - jars.add(jdkSourced); - } - } - return jars; - } - - /** - * Attempts to load the agent through the Attach API - * @return true if agent was loaded (which could have happened thought the -javaagent switch) - */ - static boolean loadAgent() { - synchronized (AgentLoader.class.getName().intern()) { - if (!agentIsAvailable() && VIRTUAL_MACHINE_LOAD_AGENT != null) { - try { - warnIfOSX(); - String name = ManagementFactory.getRuntimeMXBean().getName(); - Object vm = VIRTUAL_MACHINE_ATTACH.invoke(null, name.substring(0, name.indexOf('@'))); - try { - File agent = getAgentFile(); - LOGGER.info("Trying to load agent @ {}", agent); - if (agent != null) { - VIRTUAL_MACHINE_LOAD_AGENT.invoke(vm, agent.getAbsolutePath()); - } - } finally { - VIRTUAL_MACHINE_DETACH.invoke(vm); - } - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - LOGGER.info("Failed to attach to VM and load the agent: {}: {}", cause.getClass(), cause.getMessage()); - } catch (Throwable t) { - LOGGER.info("Failed to attach to VM and load the agent: {}: {}", t.getClass(), t.getMessage()); - } - } - - return agentIsAvailable(); - } - } - - private static void warnIfOSX() { - if (JvmInformation.isOSX() && System.getProperty("java.io.tmpdir") != null) { - LOGGER.warn("Loading the SizeOfAgent will probably fail, as you are running on Apple OS X and have a value set for java.io.tmpdir\n" + - "They both result in a bug, not yet fixed by Apple, that won't let us attach to the VM and load the agent.\n" + - "Most probably, you'll also get a full thread-dump after this because of the failure... Nothing to worry about!\n" + - "You can bypass trying to load the Agent entirely by setting the System property '" - + net.sf.ehcache.pool.sizeof.AgentSizeOf.BYPASS_LOADING + "' to true"); - } - } - - private static File getAgentFile() throws IOException, URISyntaxException { - URL agent = AgentLoader.class.getResource("sizeof-agent.jar"); - if (agent == null) { - return null; - } else if (agent.getProtocol().equals("file")) { - return new File(agent.toURI()); - } else { - File temp = File.createTempFile("ehcache-sizeof-agent", ".jar"); - try { - FileOutputStream fout = new FileOutputStream(temp); - try { - InputStream in = agent.openStream(); - try { - byte[] buffer = new byte[(int)MemoryUnit.KILOBYTES.toBytes(1)]; - while (true) { - int read = in.read(buffer); - if (read < 0) { - break; - } else { - fout.write(buffer, 0, read); - } - } - } finally { - in.close(); - } - } finally { - fout.close(); - } - } finally { - temp.deleteOnExit(); - } - LOGGER.info("Extracted agent jar to temporary file {}", temp); - return temp; - } - } - - /** - * Checks whether the agent is available - * @return true if available - */ - static boolean agentIsAvailable() { - try { - if (instrumentation == null) { - instrumentation = (Instrumentation)System.getProperties().get(INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME); - } - if (instrumentation == null) { - Class sizeOfAgentClass = ClassLoader.getSystemClassLoader().loadClass(SIZEOF_AGENT_CLASSNAME); - Method getInstrumentationMethod = sizeOfAgentClass.getMethod("getInstrumentation"); - instrumentation = (Instrumentation)getInstrumentationMethod.invoke(sizeOfAgentClass); - } - return instrumentation != null; - } catch (SecurityException e) { - LOGGER.warn("Couldn't access the system classloader because of the security policies applied by " + - "the security manager. You either want to loosen these, so ClassLoader.getSystemClassLoader() and " + - "reflection API calls are permitted or the sizing will be done using some other mechanism.\n" + - "Alternatively, set the system property net.sf.ehcache.sizeof.agent.instrumentationSystemProperty to true " + - "to have the agent put the required instances in the System Properties for the loader to access."); - return false; - } catch (Throwable e) { - return false; - } - } - - /** - * Returns the size of this Java object as calculated by the loaded agent. - * - * @param obj object to be sized - * @return size of the object in bytes - */ - static long agentSizeOf(Object obj) { - if (instrumentation == null) { - throw new UnsupportedOperationException("Sizeof agent is not available"); - } - return instrumentation.getObjectSize(obj); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 0) @@ -1,7 +0,0 @@ - - - - -This package contains the SizeOf filtering interface and implementations for the pooling in Ehcache. - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml (revision 0) @@ -1,451 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 0) @@ -1,73 +0,0 @@ -package net.sf.ehcache; - -import net.sf.ehcache.config.CacheConfiguration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * @author Alex Snaps - */ -public class OverflowCacheTest { - - private static final Logger LOG = LoggerFactory.getLogger(CacheTest.class.getName()); - - private CacheManager manager; - - @Before - public void setUp() throws Exception { - manager = CacheManager.create(); - } - - /** - * teardown - */ - @After - public void tearDown() throws Exception { - if (manager != null) { - manager.shutdown(); - } - } - - - /** - * Shows the effect of jamming large amounts of puts into a cache that overflows to disk. - * The DiskStore should cause puts to back off and avoid an out of memory error. - */ - @Test - public void testBehaviourOnDiskStoreBackUp() throws Exception { - Cache cache = new Cache(new CacheConfiguration().name("testBehaviourOnDiskStoreBackUp") - .maxElementsInMemory(1000) - .overflowToDisk(true) - .eternal(false) - .timeToLiveSeconds(100) - .timeToIdleSeconds(200) - .diskPersistent(false) - .diskExpiryThreadIntervalSeconds(0) - .diskSpoolBufferSizeMB(10)); - manager.addCache(cache); - - assertEquals(0, cache.getStatistics().getLocalHeapSize()); - - Element a; - int i = 0; - try { - for (; i < 150000; i++) { - String key = i + ""; - String value = key; - a = new Element(key, value + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); - cache.put(a); - } - } catch (OutOfMemoryError e) { - LOG.info("OutOfMemoryError: " + e.getMessage() + " " + i); - fail(); - } - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java (revision 0) @@ -1,46 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class UuidItem { - private String id; - private String name; - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java (revision 0) @@ -1,122 +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 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.MemoryUnit; -import net.sf.ehcache.config.PinningConfiguration; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - - -import static org.junit.Assert.assertNotNull; - -/** - * Tests for Cache pinning with pools - * - * @author Ludovic Orban - */ -public class CachePoolPinningTest { - - 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(System.getProperty("java.io.tmpdir"))) - .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES) - .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES) - ); - } - - @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() - .name("memoryOnlyCache_inCache") - .overflowToDisk(false) - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("memoryOnlyCache_inCache"), ELEMENT_COUNT, 0); - } - - @Test - @Ignore - public void testOverflowToDisk() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .name("overflowToDiskCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("overflowToDiskCache_inCache"), 0, ELEMENT_COUNT); - } - - @Test - @Ignore - public void testDiskPersistent() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .diskPersistent(true) - .name("diskPersistentCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("diskPersistentCache_inCache"), 0, ELEMENT_COUNT); - } - - private void doAssertions(Cache cache, long expectedMemoryHits, long expectedDiskHits) { - for (int i = 0; i < ELEMENT_COUNT; i++) { - cache.put(new Element(i, i)); - } - - Assert.assertEquals(ELEMENT_COUNT, cache.getSize()); - - for (int i = 0; i < ELEMENT_COUNT; i++) { - assertNotNull(cache.get(i)); - } - - Assert.assertEquals(expectedMemoryHits, cache.getStatistics().localHeapHitCount()); - Assert.assertEquals(ELEMENT_COUNT - expectedMemoryHits, cache.getStatistics().localHeapMissCount()); - Assert.assertEquals(expectedDiskHits, cache.getStatistics().localDiskHitCount()); - Assert.assertEquals(0, cache.getStatistics().localDiskMissCount()); - } - -} - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java (revision 0) @@ -1,18 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class L1BMOnHeapSanityTest extends AbstractCacheTestBase { - public static final int NODE_COUNT = 2; - - public L1BMOnHeapSanityTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapBasicSanityTestApp.class, L1BMOnHeapBasicSanityTestApp.class); - testConfig.getL2Config().setMaxHeap(1024); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java (revision 0) @@ -1,84 +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.TerracottaClientConfiguration; -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 the {@link TerracottaClientConfiguration} - * - * @author Abhishek Sanoujam - * - */ -public class TerracottaConfigConfigurationElement extends SimpleNodeElement { - - private final TerracottaClientConfiguration tcConfigConfiguration; - - /** - * Constructor accepting the parent and the {@link TerracottaClientConfiguration} - * - * @param parent - * @param tcConfigConfiguration - */ - public TerracottaConfigConfigurationElement(NodeElement parent, TerracottaClientConfiguration tcConfigConfiguration) { - super(parent, "terracottaConfig"); - this.tcConfigConfiguration = tcConfigConfiguration; - init(); - } - - private void init() { - if (tcConfigConfiguration == null) { - return; - } - if (tcConfigConfiguration.getUrl() != null) { - addAttribute(new SimpleNodeAttribute("url", tcConfigConfiguration.getUrl()).optional(true)); - } - addAttribute(new SimpleNodeAttribute("rejoin", tcConfigConfiguration.isRejoin()).optional(true).defaultValue( - TerracottaClientConfiguration.DEFAULT_REJOIN_VALUE)); - - addAttribute(new SimpleNodeAttribute("wanEnabledTSA", tcConfigConfiguration.isWanEnabledTSA()).optional(true).defaultValue( - TerracottaClientConfiguration.DEFAULT_WAN_ENABLED_TSA_VALUE)); - - if (tcConfigConfiguration.getOriginalEmbeddedConfig() != null) { - addChildElement(new TCConfigElement(this, tcConfigConfiguration.getOriginalEmbeddedConfig())); - } - } - - /** - * Element representing the "tc-config" element inside "terracottaConfig" - * - * @author Abhishek Sanoujam - * - */ - private static class TCConfigElement extends SimpleNodeElement { - - /** - * Constructor accepting the {@link TerracottaConfigConfigurationElement} parent and the inner string content - * - * @param parent - * @param content - */ - public TCConfigElement(TerracottaConfigConfigurationElement parent, String content) { - super(parent, "tc-config"); - this.setInnerContent(content); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html (revision 0) @@ -1,11 +0,0 @@ - - - - - Doug Lea in his book Concurrent Programming in Java talks about concurrency support constructs. - One meaning of a construct is "an abstract or general idea inferred or derived from specific instances". - Just like patterns emerge from noting the similarities of problems and gradually finding a solution to - classes of them, so to constructs are general solutions to commond problems. With the constructs package, - concrete, extensible implementations are offered to solve these common problems. - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 0) @@ -1,123 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - - -import java.io.Serializable; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A typesafe enumeration of eviction policies. - * The policy used to evict elements from the {@link net.sf.ehcache.store.MemoryStore}. - * This can be one of: - * - * LRU - least recently used - * LFU - least frequently used - * FIFO - first in first out, the oldest element by creation time - * - * The default value is LRU - * - * @author Greg Luck - * @version $Id: MemoryStoreEvictionPolicy.java 5594 2012-05-07 16:04:31Z cdennis $ - * @since 1.2 - */ -public final class MemoryStoreEvictionPolicy implements Serializable { - - /** - * LRU - least recently used. - */ - public static final MemoryStoreEvictionPolicy LRU = new MemoryStoreEvictionPolicy("LRU"); - - /** - * LFU - least frequently used. - */ - - public static final MemoryStoreEvictionPolicy LFU = new MemoryStoreEvictionPolicy("LFU"); - - /** - * FIFO - first in first out, the oldest element by creation time. - */ - public static final MemoryStoreEvictionPolicy FIFO = new MemoryStoreEvictionPolicy("FIFO"); - - /** - * FIFO - first in first out, the oldest element by creation time. - */ - public static final MemoryStoreEvictionPolicy CLOCK = new MemoryStoreEvictionPolicy("CLOCK"); - - private static final Logger LOG = LoggerFactory.getLogger(MemoryStoreEvictionPolicy.class.getName()); - - private final String myName; - - /** - * This class should not be subclassed or have instances created. - * @param policy - */ - private MemoryStoreEvictionPolicy(String policy) { - myName = policy; - } - - /** - * @return a String representation of the policy - */ - @Override - public String toString() { - return myName; - } - - /** - * Converts a string representation of the policy into a policy. - * - * @param policy either LRU, LFU or FIFO - * @return one of the static instances - */ - public static MemoryStoreEvictionPolicy fromString(String policy) { - if (policy != null) { - if (policy.equalsIgnoreCase("LRU")) { - return LRU; - } else if (policy.equalsIgnoreCase("LFU")) { - return LFU; - } else if (policy.equalsIgnoreCase("FIFO")) { - return FIFO; - } else if (policy.equalsIgnoreCase("CLOCK")) { - return CLOCK; - } - } - LOG.warn("The memoryStoreEvictionPolicy of {} cannot be resolved. The policy will be set to LRU", policy); - return LRU; - } - - /** - * Enum for {@link MemoryStoreEvictionPolicy} - * - */ - public static enum MemoryStoreEvictionPolicyEnum { - /** - * Value for {@link MemoryStoreEvictionPolicy#LFU} - */ - LFU, - /** - * Value for {@link MemoryStoreEvictionPolicy#LRU} - */ - LRU, - /** - * Value for {@link MemoryStoreEvictionPolicy#FIFO} - */ - FIFO; - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs (revision 0) @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs (revision 0) @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java (revision 0) @@ -1,130 +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.Set; -import java.util.concurrent.ScheduledExecutorService; - -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Latency; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Result; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Statistic; - -import org.terracotta.statistics.OperationStatistic; - -/** - * The Class OperationImpl. - * - * @param the generic type - * @author cdennis - */ -class OperationImpl> implements Result { - - /** The source. */ - private final OperationStatistic source; - - /** The count. */ - private final SemiExpiringStatistic count; - - /** The rate. */ - private final RateImpl rate; - - /** The latency. */ - private final LatencyImpl latency; - - /** - * Instantiates a new operation impl. - * - * @param source the source - * @param targets the targets - * @param averageNanos the average nanos - * @param executor the executor - * @param historySize the history size - * @param historyNanos the history nanos - */ - public OperationImpl(OperationStatistic source, Set targets, long averageNanos, - ScheduledExecutorService executor, int historySize, long historyNanos) { - this.source = source; - this.count = new SemiExpiringStatistic(source.statistic(targets), executor, historySize, historyNanos); - this.latency = new LatencyImpl(source, targets, averageNanos, executor, historySize, historyNanos); - this.rate = new RateImpl(source, targets, averageNanos, executor, historySize, historyNanos); - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#rate() - */ - @Override - public Statistic rate() { - return rate; - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#latency() - */ - @Override - public Latency latency() throws UnsupportedOperationException { - return latency; - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#count() - */ - @Override - public Statistic count() { - return count; - } - - /** - * Start. - */ - void start() { - count.start(); - rate.start(); - latency.start(); - } - - /** - * Expire. - * - * @param expiryTime the expiry time - * @return true, if successful - */ - boolean expire(long expiryTime) { - return (count.expire(expiryTime) & rate.expire(expiryTime) & latency.expire(expiryTime)); - } - - /** - * Sets the window. - * - * @param averageNanos the new window - */ - void setWindow(long averageNanos) { - rate.setWindow(averageNanos); - latency.setWindow(averageNanos); - } - - /** - * Sets the history. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void setHistory(int historySize, long historyNanos) { - count.setHistory(historySize, historyNanos); - rate.setHistory(historySize, historyNanos); - latency.setHistory(historySize, historyNanos); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Map; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * Criteria for plain "not equals to" condition - * - * @author teck - */ -public class NotEqualTo extends EqualTo { - - /** - * Constructor - * - * @param attributeName attribute name - * @param value - */ - public NotEqualTo(String attributeName, Object value) { - super(attributeName, value); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean execute(Element e, Map attributeExtractors) { - return !super.execute(e, attributeExtractors); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 0) @@ -1,18 +0,0 @@ -/* - * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import com.tc.test.config.model.TestConfig; - -/** - * @author cdennis - */ -public class ExplicitlyUnclusteredStandaloneCacheTest extends AbstractCacheTestBase { - - public ExplicitlyUnclusteredStandaloneCacheTest(TestConfig testConfig) { - super("explicitly-unclustered-cache-test.xml", testConfig, UnclusteredClient.class, UnclusteredClient.class); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.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.constructs.blocking; - -import net.sf.ehcache.Element; - -import java.util.Random; - -/** - * A cache entry factory that counts the number of entries it has created. - * - * This is useful for writing tests. - * - * @author Greg Luck - * @version $Id: CountingCacheEntryFactory.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public class CountingCacheEntryFactory implements UpdatingCacheEntryFactory { - - private int count; - private final Object value; - private Random random; - - /** - * Creates a new instance - * - * @param value the factory always creates values equal to this value - */ - public CountingCacheEntryFactory(final Object value) { - this.value = value; - random = new Random(); - } - - /** - * Fetches an entry. - */ - public Object createEntry(final Object key) { - count++; - if (random.nextInt(2) == 1) { - return value; - } else { - return new Element(key, value); - } - } - - /** - * @return number of entries the factory has created. - */ - public int getCount() { - return count; - } - - /** - * Perform an incremental update of data within a CacheEntry. - * Based on identification of dirty values within a CacheEntry - * Insert Update or Delete those entries based on the existing value. - * - * This method does not return a modified value, because it modifies the value passed into it, relying - * on the pass by reference feature of Java. - * - * Implementations of this method must be thread safe. - * - * @param key the cache Key - * @param value a value copied from the value that belonged to the Element in the cache. Value must be mutable - * @throws Exception - */ - public void updateEntryValue(Object key, Object value) throws Exception { - count++; - if (key.equals("explode") && count > 1) { - throw new RuntimeException("EXPLODE!"); - } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 0) @@ -1,425 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 0) @@ -1,300 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.junit.Assert; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.ToolkitFactory; -import org.terracotta.toolkit.ToolkitInstantiationException; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; -import org.terracotta.toolkit.concurrent.atomic.ToolkitAtomicLong; - -import com.tc.test.config.model.TestConfig; - -import java.util.Calendar; -import java.util.Properties; -import java.util.concurrent.BrokenBarrierException; - -public class CacheEventualConsistencyTest extends AbstractCacheTestBase { - - - public CacheEventualConsistencyTest(TestConfig testConfig) { - super("eventual-cache-explicit-locking-test.xml", testConfig, TestClient.class, TestClient.class); - testConfig.addTcProperty("seda.receive_invalidate_objects_stage.sleepMs", "60000"); - - } - - public static class TestClient extends ClientBase { - - private static final String QWERTY = "qwerty"; - private static final String INTIAL_VALUE = "init_"; - private static final String PREFIX_COUNTER = "_updated"; - private static final String BARRIER_NAME = "eventual-cache-explicit-locking-barrier"; - private static final int CLIENT_COUNT = 2; - private static final int UPDATE_LIMIT = 6; // Test Case Runs - private static final int NUM_ELEMENTS = 2; // Number of keys updated - - public TestClient(String[] args) { - super("eventualConsistencyCache", args); - } - - @Override - protected Toolkit createToolkit() { - try { - Properties properties = new Properties(); - properties.put("rejoin", true); - properties.put("nonstop-terracotta", false); - return ToolkitFactory.createToolkit(getTerracottaTypeSubType() + getTerracottaUrl(), properties); - } catch (ToolkitInstantiationException e) { - throw new RuntimeException(e); - } - } - - @Override - protected void runTest(Cache cache, Toolkit toolkit) throws Throwable { - try { - Toolkit internaltoolkit = createToolkit(); - ToolkitBarrier barrier = internaltoolkit.getBarrier(BARRIER_NAME, CLIENT_COUNT); - int index = barrier.await(); - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, INTIAL_VALUE); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets"); - doEventualGets(cache); - } - barrier.await(); - passForEventualCache(cache, barrier, index, internaltoolkit); - } finally { - System.err.println("Text Completed"); - } - } - - private void passForEventualCache(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit) - throws InterruptedException, - BrokenBarrierException { - long runCounter = 0; - long runsLimit = UPDATE_LIMIT; - runCounter = runsForEventualPutsNGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 2; - runCounter = runsForStrongPutNEventualGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 3; - // runCounter = runsForEventualPutsNStrongGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - // runsLimit = UPDATE_LIMIT * 4; - runCounter = runsForStrongPutsNStrongGets(cache, barrier, index, runCounter, runsLimit); - } - - private long runsForStrongPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, long runCounter, - long runsLimit) throws InterruptedException, BrokenBarrierException { - while (runCounter < runsLimit) { - testExplicitStrongPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER); - } - return runCounter; - } - - private long runsForEventualPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, - Toolkit internaltoolkit, long runCounter, long runsLimit) - throws InterruptedException, - BrokenBarrierException { - testStrongGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForStrongPutNEventualGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testStrongPuts(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testEventualPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - - private void testExplicitStrongPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - doExplicitStrongGets(cache, prefix); - } - barrier.await(); - } - - private void testStrongPuts(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit toolkitInternal) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - failEventualGets(cache, prefix, toolkitInternal); - } - barrier.await(); - } - - private void testStrongGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - logTimeStart(); - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, prefix); - logTimeEnd(); - } - barrier.await(); - if (index > 0) { - logTimeStart(); - failExplicitStrongGets(cache, prefix, internaltoolkit); - logTimeEnd(); - } - barrier.await(); - } - - private void logTimeStart() { - System.out.println("XS:-" + Calendar.getInstance().getTime()); - } - - private void logTimeEnd() { - System.out.println("XE:-" + Calendar.getInstance().getTime()); - } - - private void testEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..." + prefix); - doEventualPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets..." + prefix); - failEventualGets(cache, prefix, internaltoolkit); - } - barrier.await(); - } - - private void doEventualPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.put(getElement(i, prefix)); - } - } - - private void doEventualGets(Cache cache) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.get(getKey(i)); - } - } - - private void doExplicitStrongPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.acquireWriteLockOnKey(getKey(i)); - try { - cache.put(getElement(i, prefix)); - } finally { - cache.releaseWriteLockOnKey(getKey(i)); - } - } - } - - private void doExplicitStrongGets(Cache cache, final String prefix) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - Assert.assertTrue(result); - } - - // ** Always called by Client with index > 0; - private void failExplicitStrongGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - if (!eq) { - System.out.println("HHHH Failed"); - } - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - // ** Always called by Client with index > 0; - private void failEventualGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - private void assertOnEventualFailures(Toolkit internaltoolkit) { - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - long evenutalRuns = atomicLong.longValue(); - Assert.assertTrue(evenutalRuns > 0); - atomicLong.set(0); - } - - private Element getElement(int i, String valPrefix) { - return new Element(getKey(i), getValue(i, valPrefix)); - } - - private String getValue(int i, String valPrefix) { - return valPrefix + "val_" + i; - } - - private String getKey(int i) { - return "key_" + i; - } - - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 0) @@ -1,98 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import net.sf.ehcache.config.generator.model.NodeAttribute; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueFactory; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueType; - -public class StandaloneEntryBasedConfigAttributesValueFactory implements XSDAttributeValueFactory { - - public String createValueForAttribute(NodeElement element, NodeAttribute attribute, XSDAttributeValueType xsdAttributeValueType) { - if ("terracotta".equals(element.getName())) { - if("coherent".equals(attribute.getName())) { - // returning null will skip this attribute - // can skip "coherent" attribute as its deprecated by consistency attribute - return null; - } - if("clustered".equals(attribute.getName())) { - return "false"; - } - } - if ("pinning".equals(element.getName())) { - if ("storage".equals(attribute.getName())) { - return "inMemory"; - } - } - if ("sizeOfPolicy".equals(element.getName())) { - if ("maxDepth".equals(attribute.getName())) { - return "100"; - } else if ("maxDepthExceededBehavior".equals(attribute.getName())) { - return "continue"; - } - } - // always generate with eternal=false - if ("defaultCache".equals(element.getName()) || "cache".equals(element.getName())) { - if("eternal".equals(attribute.getName())) { - return "false"; - } - if("transactionalMode".equals(attribute.getName())) { - return "off"; - } - // these are deprecated - if ("maxElementsInMemory".equals(attribute.getName()) || - "maxMemoryOffHeap".equals(attribute.getName()) || - "diskPersistent".equals(attribute.getName()) || - "overflowToDisk".equals(attribute.getName())) { - return null; - } - if ("maxElementsOnDisk".equals(attribute.getName()) || - "maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - if("maxEntriesLocalHeap".equals(attribute.getName()) || - "maxEntriesLocalOffHeap".equals(attribute.getName()) || - "maxEntriesLocalDisk".equals(attribute.getName())) { - return "10000"; - } - if("maxEntriesInCache".equals(attribute.getName())) { - return null; - } - } - if ("ehcache".equals(element.getName())) { - if("maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - } - if ("searchAttribute".equals(element.getName())) { - if ("expression".equals(attribute.getName())) { - return "value.toString()"; - } else if ("name".equals(attribute.getName())) { - return "name"; - } else { - return null; - } - } - - return xsdAttributeValueType.getRandomAllowedValue(); - } -} Index: rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 0) @@ -1,11 +0,0 @@ -@echo off - -rem All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - -cd "%~d0%~p0" -for /f "tokens=*" %%a in ('call relative-paths.bat tc_install_dir') do set tc_install_dir=%%a -pushd -cd %tc_install_dir% -set tc_install_dir=%CD% -popd -call "%tc_install_dir%\bin\stop-tc-server.bat" Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 0) @@ -1,52 +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 NoTcConfigStandaloneCacheTest extends AbstractCacheTestBase { - - public NoTcConfigStandaloneCacheTest(TestConfig testConfig) { - super("no-tcconfig-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; - boolean cacheException = false; - boolean tcConfig = false; - try { - fr = new FileReader(output); - BufferedReader reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - if (st.contains("CacheException")) cacheException = true; - if (st.contains("")) tcConfig = true; - } - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - } catch (Exception e) { - // - } - } - - if (!cacheException) { throw new AssertionError("Expected Exception"); } - - if (!tcConfig) { throw new AssertionError("Expected "); } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 0) @@ -1,113 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; -import net.sf.ehcache.config.MemoryUnit; -import net.sf.ehcache.config.PersistenceConfiguration; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.terracotta.test.categories.CheckShorts; - -import java.util.Arrays; -import java.util.Collection; - -@Category(CheckShorts.class) -@RunWith(Parameterized.class) -public class CacheCopyOnRwReplaceRemoveTest { - - public static final String MEMORY_CACHE = "memoryCache"; - public static final String DISK_CACHE = "diskCache"; - - @Parameters(name = "copyOnRead:{0}, copyOnWrite:{1}") - public static Collection data() { - Object[][] data = new Object[][] { { true, false }, { false, true }, { true, true } }; - return Arrays.asList(data); - } - - private final boolean copyOnRead; - private final boolean copyOnWrite; - - private CacheManager cacheManager; - - public CacheCopyOnRwReplaceRemoveTest(boolean copyOnRead, boolean copyOnWrite) { - this.copyOnRead = copyOnRead; - this.copyOnWrite = copyOnWrite; - } - - @Before - public void setUp() throws Exception { - cacheManager = CacheManager.create( new Configuration() - .name("copyOnRWReplaceRemoveManager") - .diskStore(new DiskStoreConfiguration().path(System.getProperty("java.io.tmpdir"))) - .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES) - .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES)); - cacheManager.addCache(new Cache(new CacheConfiguration().name(MEMORY_CACHE) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - cacheManager.addCache(new Cache(new CacheConfiguration().name(DISK_CACHE) - .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - @Test - public void testMemoryCache() throws Exception { - Ehcache cache = cacheManager.getCache(MEMORY_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - @Test - public void testDiskCache() throws Exception { - Ehcache cache = cacheManager.getCache(DISK_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - private void testReplaceElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - String nextValue = value + "1"; - Assert.assertTrue(cache.replace(new Element(new Long(key), new String(value)), new Element(new Long(key), new String(nextValue)))); - } - - private void testRemoveElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - Assert.assertTrue(cache.removeElement(new Element(new Long(key), new String(value)))); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 0) @@ -1,27 +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.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopReadTimeoutBehavior; -import org.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopWriteTimeoutBehavior; - -public class ToolkitNonStopExceptionOnTimeoutConfiguration extends ToolkitNonStopConfiguration { - - public ToolkitNonStopExceptionOnTimeoutConfiguration(NonstopConfiguration ehcacheNonStopConfig) { - super(ehcacheNonStopConfig); - } - - @Override - public NonStopReadTimeoutBehavior getReadOpNonStopTimeoutBehavior() { - return NonStopReadTimeoutBehavior.EXCEPTION; - } - - @Override - public NonStopWriteTimeoutBehavior getWriteOpNonStopTimeoutBehavior() { - return NonStopWriteTimeoutBehavior.EXCEPTION; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 0) @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 0) @@ -1,67 +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.SizeOfPolicyConfiguration; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * Element representing the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @author Ludovic Orban - * - */ -public class SizeOfPolicyConfigurationElement extends SimpleNodeElement { - private final SizeOfPolicyConfiguration sizeOfPolicyConfiguration; - - /** - * Construtor accepting the parent and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param parent - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(ConfigurationElement parent, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(parent, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - /** - * Construtor accepting the element and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param element - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(NodeElement element, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(element, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - private void init() { - if (sizeOfPolicyConfiguration == null) { - return; - } - addAttribute(new SimpleNodeAttribute("maxDepth", sizeOfPolicyConfiguration.getMaxDepth()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH)); - addAttribute(new SimpleNodeAttribute("maxDepthExceededBehavior", sizeOfPolicyConfiguration.getMaxDepthExceededBehavior()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR)); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 0) @@ -1,33 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.txns; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.test.util.TestBaseUtil; - -import bitronix.tm.TransactionManagerServices; - -import com.tc.test.config.model.TestConfig; - -import java.util.ArrayList; -import java.util.List; - -public class TwoResourceBTMXATest extends AbstractCacheTestBase { - - public TwoResourceBTMXATest(TestConfig testConfig) { - super("two-resource-xa-test.xml", testConfig, BTMTwoResourceTx1.class, BTMTwoResourceTx2.class); - testConfig.getClientConfig().setParallelClients(true); - - // DEV-3930 - // disableAllUntil("2010-03-31"); - } - - @Override - protected List getExtraJars() { - List extraJars = new ArrayList(); - extraJars.add(TestBaseUtil.jarFor(TransactionManagerServices.class)); - return extraJars; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 0) @@ -1,35 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.transaction; - -/** - * A factory of soft-locks supporting a specific isolation level. - * - * @author Chris Dennis - */ -public interface SoftLockFactory { - - /** - * Construct a new softlock to be managed by the given manager for a specific key. - * - * @param manager soft lock manager - * @param key key to generate against - * @return a new soft lock - */ - SoftLock newSoftLock(SoftLockManager manager, Object key); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 0) @@ -1,46 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.terracotta.upgradability.serialization; - -import java.io.IOException; -import java.util.Comparator; - -import net.sf.ehcache.Element; -import net.sf.ehcache.NonEternalElementData; -import org.junit.Test; - -import static org.terracotta.upgradability.serialization.SerializationUpgradabilityTesting.validateSerializedForm; - -/** - * - * @author cdennis - */ -public class NonEternalElementDataSerializationTest { - - private static final Comparator COMPARATOR = new Comparator() { - - @Override - public int compare(NonEternalElementData o1, NonEternalElementData o2) { - return ElementSerializationTest.COMPARATOR.compare(o1.createElement("foo"), o2.createElement("foo")); - } - }; - - @Test - public void testBasic() throws IOException, ClassNotFoundException { - validateSerializedForm(new NonEternalElementData(new Element("foo", "bar", 1000L, 2000L, 3000L, 4000L, false, 5000, 6000, 7000L)), COMPARATOR, "serializedforms/NonEternalElementDataSerializationTest.testBasic.ser"); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 0) @@ -1,159 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.lifecycle; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.ConfigurationFactory; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.mockito.Mockito; -import org.objenesis.ObjenesisStd; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.TestBaseUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.test.config.model.TestConfig; -import com.terracotta.entity.ClusteredEntityManager; -import com.terracotta.entity.ehcache.ClusteredCacheManager; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -public class CacheManagerDestroyCrashTest extends AbstractCacheTestBase { - private static final String CACHE_NAME = "cache1"; - - public CacheManagerDestroyCrashTest(TestConfig testConfig) { - super("lifecycle/cache-destroy.xml", testConfig, CacheManagerCreateClient.class, - CacheManagerEntityDestroyCrashClient.class); - } - - @Override - protected String createClassPath(Class client) throws IOException { - String classpath = super.createClassPath(client); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(Mockito.class)); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(ObjenesisStd.class)); - return classpath; - } - - public static class CacheManagerCreateClient extends ClientBase { - - public CacheManagerCreateClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - - CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, 100) - .terracotta(new TerracottaConfiguration()); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - cache.put(new Element("key", "value", true)); - - cacheManager.shutdown(); - - // Notify client to destroy - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 1 - - // Waiting for other client to signal destroy done - getBarrierForAllClients().await(1, TimeUnit.MINUTES); // hit 2 - - // Making sure adding back cache does not resurrect old data structures - setupCacheManager(); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - assertNull(cache.get("key")); - } - - @Override - protected Cache getCache() { - return null; - } - - } - - public static class CacheManagerEntityDestroyCrashClient extends ClientBase { - - public CacheManagerEntityDestroyCrashClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - // Waiting for CM to be created - - waitForAllClients(); // hit 1 - - Toolkit spiedToolkit = spy(getClusteringToolkit()); - - ClusteredEntityManager clusteredEntityManager1 = new ClusteredEntityManager(spiedToolkit); - Configuration configuration = ConfigurationFactory.parseConfiguration(getEhcacheXmlAsStream()); - String cmName = configuration.getName(); - - Map cacheManagers = clusteredEntityManager1 - .getRootEntities(ClusteredCacheManager.class); - - ClusteredCacheManager clusteredCacheManager = cacheManagers.get(cmName); - - while(clusteredCacheManager.isUsed()) { - TimeUnit.MILLISECONDS.sleep(200); - } - - - doThrow(new TestDestroyCrashException("Crashing destroy")) - .when(spiedToolkit) - .getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - try { - clusteredEntityManager1.destroyRootEntity(cmName, ClusteredCacheManager.class, clusteredCacheManager); - fail("Destroy should have thrown an exception"); - } catch(TestDestroyCrashException e) { - // Expected as we want destroy to crash - e.printStackTrace(); - } - reset(spiedToolkit); - - clusteredEntityManager1.getRootEntity(cmName, ClusteredCacheManager.class); - // Shows inline clean up performed - verify(spiedToolkit).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - reset(spiedToolkit); - - ClusteredEntityManager clusteredEntityManager2 = new ClusteredEntityManager(spiedToolkit); - assertNull(clusteredEntityManager2.getRootEntity(cmName, ClusteredCacheManager.class)); - - verify(spiedToolkit, never()).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 2 - } - - @Override - protected void setupCacheManager() { - // Do nothing here - } - - @Override - protected Cache getCache() { - // Do nothing here - return null; - } - } - - public static class TestDestroyCrashException extends RuntimeException { - public TestDestroyCrashException(String msg) { - super(msg); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 0) @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import net.sf.ehcache.management.resource.CacheConfigEntity; -import net.sf.ehcache.management.sampled.CacheManagerSampler; -import org.terracotta.management.resource.AgentEntity; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * @author brandony - */ -final class CacheConfigurationEntityBuilder { - - private final Map samplersByCName = new HashMap(); - - static CacheConfigurationEntityBuilder createWith(CacheManagerSampler sampler, - String cacheName) { - return new CacheConfigurationEntityBuilder(sampler, cacheName); - } - - private CacheConfigurationEntityBuilder(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - } - - CacheConfigurationEntityBuilder add(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - return this; - } - - Collection build() { - Collection cces = new ArrayList(); - - for (Map.Entry entry : samplersByCName.entrySet()) { - CacheConfigEntity cce = new CacheConfigEntity(); - - String cacheName = entry.getKey(); - cce.setCacheName(cacheName); - cce.setAgentId(AgentEntity.EMBEDDED_AGENT_ID); - cce.setVersion(this.getClass().getPackage().getImplementationVersion()); - - CacheManagerSampler sampler = entry.getValue(); - cce.setCacheManagerName(sampler.getName()); - cce.setXml(sampler.generateActiveConfigDeclaration(cacheName)); - - cces.add(cce); - } - - return cces; - } - - private void addSampler(CacheManagerSampler sampler, - String cacheName) { - if (sampler == null) throw new IllegalArgumentException("sampler == null"); - - if (cacheName == null) throw new IllegalArgumentException("cacheName == null"); - - if(!Arrays.asList(sampler.getCacheNames()).contains(cacheName)) { - throw new IllegalArgumentException(String.format("Invalid cache name: %s.", cacheName)); - } - - samplersByCName.put(cacheName, sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 0) @@ -1,45 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.constructs.refreshahead; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.constructs.CacheDecoratorFactory; - -/** - * Cache decorator factory for {@link RefreshAheadCache} instances - * - * @author cschanck - * - */ -public class RefreshAheadCacheFactory extends CacheDecoratorFactory { - - @Override - public Ehcache createDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - - @Override - public Ehcache createDefaultDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 0) @@ -1,50 +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.io.IOException; -import java.io.Serializable; - -/** - * Interface to implement single operations that are performed in the write behind implementation that using an - * AsyncCoordinator underneath - * - * @author Abhishek Maheshwari - */ -public interface SingleAsyncOperation extends Serializable { - /** - * Perform this operation as a single execution with the provided cache writer - * - * @param cacheWriter the cache writer this operation should be performed upon - */ - public void performSingleOperation(CacheWriter cacheWriter) throws ClassNotFoundException, IOException; - - /** - * Retrieves the key for this operation. - * - * @return this operation's key - */ - Object getKey(); - - Element getElement(); - - /** - * Retrieves the moment when the operation was created. - * - * @return the creation time in milliseconds - */ - public long getCreationTime(); - - /** - * This method will be called to throw the item away. - * - * @param cacheWriter - * @param e - */ - void throwAwayElement(CacheWriter cacheWriter, RuntimeException e); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 0) @@ -1,93 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.cluster; - -import java.util.Collection; -import java.util.List; - -/** - * Allows you to explore the Terracotta cluster nodes and register for events about the cluster. - * - * @author Geert Bevin, Abhishek Sanoujam - * @since 2.0 - */ -public interface CacheCluster { - - /** - * Get scheme name for this cluster info. - * - * @return a scheme name for the cluster information. - * Currently TERRACOTTA is the only scheme supported. - */ - ClusterScheme getScheme(); - - /** - * Retrieves the {@code ClusterNode} instance that corresponds to the current node. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode getCurrentNode(); - - /** - * Waits until the current node has successfully joined the cluster. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode waitUntilNodeJoinsCluster(); - - /** - * Get all the nodes in the cluster - * - * @return information on all the nodes in the cluster, including ID, hostname, and IP address. - */ - Collection getNodes(); - - /** - * Find out if the current node is connected to the cluster or not - * - * @return true if cluster is online otherwise false - */ - boolean isClusterOnline(); - - /** - * Add a listener for cluster events - * - * @param listener Listener - * @return True if already listening - */ - boolean addTopologyListener(ClusterTopologyListener listener); - - /** - * Remove a listener for cluster events - * - * @param listener Listener - * @return True if not listening - */ - boolean removeTopologyListener(ClusterTopologyListener listener); - - /** - * Removes all listeners for cluster events - */ - void removeAllListeners(); - - /** - * Get all the topology listeners - * - * @return a list of all the topology listeners - */ - List getTopologyListeners(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 0) @@ -1,77 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.impl; - -import java.util.Map; - -import net.sf.ehcache.store.StoreQuery; - -/** - * Result implementation - * - * @author teck - */ -public class ResultImpl extends BaseResult { - - private final Object key; - private final Object value; - private final Map attributes; - private final Object[] sortAttributes; - - /** - * Constructor - * - * @param key - * @param value - * @param query - * @param attributes - * @param sortAttributes - */ - public ResultImpl(Object key, Object value, StoreQuery query, Map attributes, Object[] sortAttributes) { - super(query); - this.key = key; - this.value = value; - this.attributes = attributes; - this.sortAttributes = sortAttributes; - } - - /** - * Get attribute value for use in sorting - * - * @param pos - * @return - */ - Object getSortAttribute(int pos) { - return sortAttributes[pos]; - } - - @Override - protected Object basicGetKey() { - return key; - } - - @Override - protected Object basicGetValue() { - return value; - } - - @Override - protected Object basicGetAttribute(String name) { - return attributes.get(name); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 0) @@ -1,151 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.FeaturesManager; -import net.sf.ehcache.terracotta.ClusteredInstanceFactory; -import net.sf.ehcache.terracotta.TerracottaClient; -import net.sf.ehcache.transaction.xa.XidTransactionID; - -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -import javax.transaction.xa.Xid; - -/** - * A TransactionIDFactory implementation with delegates calls to either a clustered - * or non-clustered factory - * - * @author Ludovic Orban - */ -public class DelegatingTransactionIDFactory implements TransactionIDFactory { - - private final FeaturesManager featuresManager; - private final TerracottaClient terracottaClient; - private final String cacheManagerName; - private volatile ClusteredInstanceFactory clusteredInstanceFactory; - private volatile AtomicReference transactionIDFactory = new AtomicReference(); - - /** - * Create a new DelegatingTransactionIDFactory - * - * @param terracottaClient a terracotta client - * @param cacheManagerName the name of the cache manager which creates this. - */ - public DelegatingTransactionIDFactory(FeaturesManager featuresManager, TerracottaClient terracottaClient, String cacheManagerName) { - this.featuresManager = featuresManager; - this.terracottaClient = terracottaClient; - this.cacheManagerName = cacheManagerName; - } - - private TransactionIDFactory get() { - ClusteredInstanceFactory cif = terracottaClient.getClusteredInstanceFactory(); - if (cif != null && cif != this.clusteredInstanceFactory) { - this.transactionIDFactory.set(cif.createTransactionIDFactory(UUID.randomUUID().toString(), cacheManagerName)); - this.clusteredInstanceFactory = cif; - } - - if (transactionIDFactory.get() == null) { - TransactionIDFactory constructed; - if (featuresManager == null) { - constructed = new TransactionIDFactoryImpl(); - } else { - constructed = featuresManager.createTransactionIDFactory(); - } - if (transactionIDFactory.compareAndSet(null, constructed)) { - return constructed; - } else { - return transactionIDFactory.get(); - } - } else { - return transactionIDFactory.get(); - } - } - - /** - * {@inheritDoc} - */ - public TransactionID createTransactionID() { - return get().createTransactionID(); - } - - /** - * {@inheritDoc} - */ - public TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm) { - return get().restoreTransactionID(serializedForm); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID createXidTransactionID(Xid xid, Ehcache cache) { - return get().createXidTransactionID(xid, cache); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm) { - return get().restoreXidTransactionID(serializedForm); - } - - @Override - public void markForCommit(TransactionID transactionID) { - get().markForCommit(transactionID); - } - - @Override - public void markForRollback(XidTransactionID transactionID) { - get().markForRollback(transactionID); - } - - @Override - public boolean isDecisionCommit(TransactionID transactionID) { - return get().isDecisionCommit(transactionID); - } - - @Override - public void clear(TransactionID transactionID) { - get().clear(transactionID); - } - - @Override - public Set getAllXidTransactionIDsFor(Ehcache cache) { - return get().getAllXidTransactionIDsFor(cache); - } - - @Override - public Set getAllTransactionIDs() { - return get().getAllTransactionIDs(); - } - - @Override - public boolean isExpired(TransactionID transactionID) { - return get().isExpired(transactionID); - } - - @Override - public Boolean isPersistent() { - if (transactionIDFactory.get() == null) { - return null; - } else { - return get().isPersistent(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 0) @@ -1,55 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; - -public class ConfigurationGeneratedParsesTest { - - private static final String[] TEST_CONFIGS = new String[] { - "ehcache.xml", - "ehcache-big.xml", - "ehcache-cacheextension.xml", - "ehcache-comparator.xml", - "ehcache-countinglisteners.xml", - "ehcache-search.xml", - "ehcache-tx-local.xml", - "ehcache-tx-twopc.xml", - "ehcache-writer.xml", - "ehcacheUTF8.xml", - }; - - @Test - public void testGeneratedConfigIsValid() throws CacheException, UnsupportedEncodingException { - for (String config : TEST_CONFIGS) { - String generatedConfig; - CacheManager manager = new CacheManager(ConfigurationGeneratedParsesTest.class.getClassLoader().getResource(config)); - try { - generatedConfig = manager.getActiveConfigurationText(); - } finally { - manager.shutdown(); - } - new CacheManager(new ByteArrayInputStream(generatedConfig.getBytes("UTF-8"))).shutdown(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 0) @@ -1,31 +0,0 @@ -package net.sf.ehcache.store; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.MemoryStorePerfTester; -import org.junit.Test; - -/** - * @author Alex Snaps - */ -public class LruMemoryStorePerfTest extends MemoryStorePerfTester { - - @Override - protected Cache createCache() throws CacheException { - return new Cache("LruMemoryStorePerfTest", 12000, MemoryStoreEvictionPolicy.FIFO, false, System.getProperty("java.io.tmpdir"), - true, 60, 30, false, 60, null); - } - - /** - * Benchmark to test speed. This uses both memory and disk and tries to be realistic - * v 1.38 DiskStore 7355 - * v 1.41 DiskStore 1609 - * Adjusted for change to laptop - */ - @Test - public void testBenchmarkPutGetSurya() throws Exception { - benchmarkPutGetSuryaTest(2500); - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 0) @@ -1,364 +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.cachingtier; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.AbstractCacheConfigurationListener; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.pool.Pool; -import net.sf.ehcache.pool.Size; -import net.sf.ehcache.pool.SizeOfEngine; -import net.sf.ehcache.pool.SizeOfEngineLoader; -import net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf; -import net.sf.ehcache.store.CachingTier; -import net.sf.ehcache.store.FifoPolicy; -import net.sf.ehcache.store.LfuPolicy; -import net.sf.ehcache.store.LruPolicy; -import net.sf.ehcache.store.MemoryStoreEvictionPolicy; -import net.sf.ehcache.store.Policy; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CopyOnWriteArrayList; -import net.sf.ehcache.store.StoreOperationOutcomes.GetOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.PutOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.RemoveOutcome; -import org.terracotta.context.annotations.ContextChild; -import org.terracotta.statistics.Statistic; -import org.terracotta.statistics.observer.OperationObserver; - -import static net.sf.ehcache.statistics.StatisticBuilder.operation; - -/** - * An instance of this class will delegate the storage to the backing HeapCacheBackEnd. - * Adding : - * - * making sure only a single thread populates the cache for a given key at a time - * translate calls to the eviction listeners - * Add all the crap about sizing and stuff - * - * - * @param The key type - * @param the value type - * @author Alex Snaps - */ -public class OnHeapCachingTier implements CachingTier { - - @ContextChild - private final HeapCacheBackEnd backEnd; - - private final OperationObserver getObserver = operation(GetOutcome.class).named("get").of(this).tag("local-heap").build(); - private final OperationObserver putObserver = operation(PutOutcome.class).named("put").of(this).tag("local-heap").build(); - private final OperationObserver removeObserver = operation(RemoveOutcome.class).named("remove").of(this).tag("local-heap").build(); - - - private volatile List> listeners = new CopyOnWriteArrayList>(); - - /** - * A Constructor - * - * @param backEnd the HeapCacheBackEnd that will back this CachingTier - */ - public OnHeapCachingTier(final HeapCacheBackEnd backEnd) { - this.backEnd = backEnd; - this.backEnd.registerEvictionCallback(new HeapCacheBackEnd.EvictionCallback() { - @Override - public void evicted(final K key, final Object value) { - final V v = getValue(value); - if (v != null) { - for (Listener listener : listeners) { - listener.evicted(key, v); - } - } - } - }); - } - - /** - * Factory method - * @param cache the cache we're planning to back - * @param onHeapPool the pool, if any, to use - * @return the OnHeapCachingTier properly configured for this cache - */ - public static OnHeapCachingTier createOnHeapCache(final Ehcache cache, final Pool onHeapPool) { - final HeapCacheBackEnd memCacheBackEnd; - final Policy memoryEvictionPolicy = determineEvictionPolicy(cache); - if (cache.getCacheConfiguration().isCountBasedTuned()) { - final long maxEntriesLocalHeap = getCachingTierMaxEntryCount(cache); - final CountBasedBackEnd countBasedBackEnd = - new CountBasedBackEnd(maxEntriesLocalHeap, memoryEvictionPolicy); - memCacheBackEnd = countBasedBackEnd; - cache.getCacheConfiguration().addConfigurationListener(new AbstractCacheConfigurationListener() { - @Override - public void memoryCapacityChanged(final int oldCapacity, final int newCapacity) { - countBasedBackEnd.setMaxEntriesLocalHeap(newCapacity); - } - }); - } else { - final PooledBasedBackEnd pooledBasedBackEnd = new PooledBasedBackEnd(memoryEvictionPolicy); - - pooledBasedBackEnd.registerAccessor( - onHeapPool.createPoolAccessor(new PooledBasedBackEnd.PoolParticipant(pooledBasedBackEnd), - SizeOfPolicyConfiguration.resolveMaxDepth(cache), - SizeOfPolicyConfiguration.resolveBehavior(cache) - .equals(SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT))); - - memCacheBackEnd = pooledBasedBackEnd; - } - - return new OnHeapCachingTier( - memCacheBackEnd); - } - - /** - * Chooses the Policy from the cache configuration - * - * @param cache the cache - * @return the chosen eviction policy - */ - static Policy determineEvictionPolicy(Ehcache cache) { - MemoryStoreEvictionPolicy policySelection = cache.getCacheConfiguration().getMemoryStoreEvictionPolicy(); - - if (policySelection.equals(MemoryStoreEvictionPolicy.LRU)) { - return new LruPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.FIFO)) { - return new FifoPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.LFU)) { - return new LfuPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.CLOCK)) { - return new LruPolicy(); - } - - throw new IllegalArgumentException(policySelection + " isn't a valid eviction policy"); - } - - - private static long getCachingTierMaxEntryCount(final Ehcache cache) { - final PinningConfiguration pinningConfiguration = cache.getCacheConfiguration().getPinningConfiguration(); - if (pinningConfiguration != null && pinningConfiguration.getStore() != PinningConfiguration.Store.INCACHE) { - return 0; - } - return cache.getCacheConfiguration().getMaxEntriesLocalHeap(); - } - - @Override - public boolean loadOnPut() { - return backEnd.hasSpace(); - } - - @Override - public V get(final K key, final Callable source, final boolean updateStats) { - if (updateStats) { getObserver.begin(); } - Object cachedValue = backEnd.get(key); - if (cachedValue == null) { - if (updateStats) { getObserver.end(GetOutcome.MISS); } - Fault f = new Fault(source); - cachedValue = backEnd.putIfAbsent(key, f); - if (cachedValue == null) { - try { - V value = f.get(); - putObserver.begin(); - if (value == null) { - backEnd.remove(key, f); - } else if (backEnd.replace(key, f, value)) { - putObserver.end(PutOutcome.ADDED); - } else { - V p = getValue(backEnd.remove(key)); - return p == null ? value : p; - } - return value; - } catch (Throwable e) { - backEnd.remove(key, f); - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } else { - throw new CacheException(e); - } - } - } - } else { - if (updateStats) { getObserver.end(GetOutcome.HIT); } - } - - return getValue(cachedValue); - } - - @Override - public V remove(final K key) { - removeObserver.begin(); - try { - return getValue(backEnd.remove(key)); - } finally { - removeObserver.end(RemoveOutcome.SUCCESS); - } - } - - @Override - public void clear() { - backEnd.clear(false); - } - - @Override - public void clearAndNotify() { - backEnd.clear(true); - } - - @Override - public void addListener(final Listener listener) { - if (listener == null) { - throw new NullPointerException("Listener can't be null!"); - } - listeners.add(listener); - } - - @Statistic(name = "size", tags = "local-heap") - @Override - public int getInMemorySize() { - return backEnd.size(); - } - - @Override - public int getOffHeapSize() { - return 0; - } - - @Override - public boolean contains(final K key) { - return backEnd.get(key) != null; - } - - @Statistic(name = "size-in-bytes", tags = "local-heap") - @Override - public long getInMemorySizeInBytes() { - long sizeInBytes; - if (backEnd instanceof PooledBasedBackEnd, ?>) { - sizeInBytes = ((PooledBasedBackEnd)backEnd).getSizeInBytes(); - } else { - SizeOfEngine defaultSizeOfEngine = SizeOfEngineLoader.newSizeOfEngine( - SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH, - SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR == SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT, - true - ); - sizeInBytes = 0; - for (Map.Entry entry : backEnd.entrySet()) { - // This could leak Fault values... We ignore these entirely - if (entry.getValue() != null && entry.getValue() instanceof Element) { - Element element = (Element)entry.getValue(); - // TODO this is a lie here! Should we add a dedicated method to BackEnd to return a container ? - Size size = defaultSizeOfEngine.sizeOf(element.getObjectKey(), element, null); - sizeInBytes += size.getCalculated(); - } - } - } - return sizeInBytes; - } - - @Override - public long getOffHeapSizeInBytes() { - return 0; - } - - @Override - public long getOnDiskSizeInBytes() { - return 0; - } - - @Override - public void recalculateSize(final K key) { - backEnd.recalculateSize(key); - } - - @Override - public Policy getEvictionPolicy() { - return backEnd.getPolicy(); - } - - @Override - public void setEvictionPolicy(final Policy policy) { - backEnd.setPolicy(policy); - } - - private V getValue(final Object cachedValue) { - if (cachedValue instanceof Fault) { - return ((Fault)cachedValue).get(); - } else { - return (V)cachedValue; - } - } - - /** - * Document me - * - * @param - */ - @IgnoreSizeOf - private static class Fault { - - private final Callable source; - private V value; - private Throwable throwable; - private boolean complete; - - public Fault(final Callable source) { - this.source = source; - } - - private void complete(V value) { - synchronized (this) { - this.value = value; - this.complete = true; - notifyAll(); - } - } - - private V get() { - synchronized (this) { - if (!complete) { - try { - complete(source.call()); - } catch (Throwable e) { - fail(e); - } - } - } - - return throwOrReturn(); - } - - private V throwOrReturn() { - if (throwable != null) { - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; - } - throw new CacheException("Faulting from repository failed", throwable); - } - return value; - } - - private void fail(final Throwable t) { - synchronized (this) { - this.throwable = t; - this.complete = true; - notifyAll(); - } - throwOrReturn(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - - -import org.terracotta.toolkit.concurrent.locks.ToolkitLock; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -public class LockHolder { - private static final int PARTIES = 2; - private final Map holdings = new HashMap(); - - public synchronized void hold(final ToolkitLock lock) { - if (lock == null || holdings.containsKey(lock)) { return; } - final CyclicBarrier barrier = new CyclicBarrier(PARTIES); - Thread lockThread = new Thread(new Runnable() { - @Override - public void run() { - lock.lock(); - try { - await(barrier); // hit 1 - await(barrier); // hit 2 - } finally { - try { - lock.unlock(); - } catch (Throwable th) { - // ignore any exception in unlock so that thread calling release() is not stuck at barrier.await() - } - await(barrier); // hit 3 - } - } - }); - holdings.put(lock.getName(), barrier); - lockThread.start(); - await(barrier); // hit 1 - } - - public synchronized void release(ToolkitLock lock) { - CyclicBarrier barrier = holdings.get(lock.getName()); - if (barrier != null) { - releaseLock(barrier); - holdings.remove(lock); - } - } - - private void releaseLock(CyclicBarrier barrier) { - await(barrier); // hit 2 - await(barrier); // hit 3 - } - - public synchronized void reset() { - for (CyclicBarrier barrier : holdings.values()) { - releaseLock(barrier); - } - holdings.clear(); - } - - private void await(CyclicBarrier barrier) { - try { - barrier.await(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (BrokenBarrierException e) { - // ignore - } - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 0) @@ -1,14 +0,0 @@ - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.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.pool.sizeof; - -import net.sf.ehcache.util.FindBugsSuppressWarnings; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.net.Proxy; -import java.nio.charset.CodingErrorAction; -import java.util.Collections; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -import javax.xml.datatype.DatatypeConstants; -import javax.xml.namespace.QName; - -/** - * Enum with all the flyweight types that we check for sizeOf measurements - * - * @author Alex Snaps - */ -@FindBugsSuppressWarnings("RC_REF_COMPARISON") -enum FlyweightType { - - /** - * java.lang.Enum - */ - ENUM(Enum.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * java.lang.Class - */ - CLASS(Class.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - // XXX There is no nullipotent way of determining the interned status of a string - // There are numerous String constants within the JDK (see list at http://docs.oracle.com/javase/7/docs/api/constant-values.html), - // but enumerating all of them would lead to lots of == tests. - /** - * java.lang.String - */ - //STRING(String.class) { - // @Override - // boolean isShared(final Object obj) { return obj == ((String)obj).intern(); } - //}, - /** - * java.lang.Boolean - */ - BOOLEAN(Boolean.class) { - @Override - boolean isShared(final Object obj) { return obj == Boolean.TRUE || obj == Boolean.FALSE; } - }, - /** - * java.lang.Integer - */ - INTEGER(Integer.class) { - @Override - boolean isShared(final Object obj) { - int value = ((Integer)obj).intValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Integer.valueOf(value); - } - }, - /** - * java.lang.Short - */ - SHORT(Short.class) { - @Override - boolean isShared(final Object obj) { - short value = ((Short)obj).shortValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Short.valueOf(value); - } - }, - /** - * java.lang.Byte - */ - BYTE(Byte.class) { - @Override - boolean isShared(final Object obj) { return obj == Byte.valueOf((Byte)obj); } - }, - /** - * java.lang.Long - */ - LONG(Long.class) { - @Override - boolean isShared(final Object obj) { - long value = ((Long)obj).longValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Long.valueOf(value); - } - }, - /** - * java.math.BigInteger - */ - BIGINTEGER(BigInteger.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigInteger.ZERO || obj == BigInteger.ONE || obj == BigInteger.TEN; - } - }, - /** - * java.math.BigDecimal - */ - BIGDECIMAL(BigDecimal.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigDecimal.ZERO || obj == BigDecimal.ONE || obj == BigDecimal.TEN; - } - }, - /** - * java.math.MathContext - */ - MATHCONTEXT(MathContext.class) { - @Override - boolean isShared(final Object obj) { - return obj == MathContext.UNLIMITED || obj == MathContext.DECIMAL32 || obj == MathContext.DECIMAL64 || obj == MathContext.DECIMAL128; - } - }, - /** - * java.lang.Character - */ - CHARACTER(Character.class) { - @Override - boolean isShared(final Object obj) { return ((Character)obj).charValue() <= Byte.MAX_VALUE && obj == Character.valueOf((Character)obj); } - }, - /** - * java.lang.Locale - */ - LOCALE(Locale.class) { - @Override - boolean isShared(final Object obj) { - return GLOBAL_LOCALES.contains(obj); - } - }, - /** - * java.util.Logger - */ - LOGGER(Logger.class) { - @Override - @SuppressWarnings("deprecation") - boolean isShared(final Object obj) { return obj == Logger.global; } - }, - /** - * java.net.Proxy - */ - PROXY(Proxy.class) { - @Override - boolean isShared(final Object obj) { return obj == Proxy.NO_PROXY; } - }, - /** - * java.nio.charset.CodingErrorAction - */ - CODINGERRORACTION(CodingErrorAction.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.datatype.DatatypeConstants.Field - */ - DATATYPECONSTANTS_FIELD(DatatypeConstants.Field.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.namespace.QName - */ - QNAME(QName.class) { - @Override - boolean isShared(final Object obj) { - return obj == DatatypeConstants.DATETIME - || obj == DatatypeConstants.TIME - || obj == DatatypeConstants.DATE - || obj == DatatypeConstants.GYEARMONTH - || obj == DatatypeConstants.GMONTHDAY - || obj == DatatypeConstants.GYEAR - || obj == DatatypeConstants.GMONTH - || obj == DatatypeConstants.GDAY - || obj == DatatypeConstants.DURATION - || obj == DatatypeConstants.DURATION_DAYTIME - || obj == DatatypeConstants.DURATION_YEARMONTH; - } - }, - /** - * misc comparisons that can not rely on the object's class. - */ - MISC(Void.class) { - @Override - boolean isShared(final Object obj) { - boolean emptyCollection = obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP; - boolean systemStream = obj == System.in || obj == System.out || obj == System.err; - return emptyCollection || systemStream || obj == String.CASE_INSENSITIVE_ORDER; - } - }; - - private static final Map, FlyweightType> TYPE_MAPPINGS = new HashMap, FlyweightType>(); - static { - for (FlyweightType type : FlyweightType.values()) { - TYPE_MAPPINGS.put(type.clazz, type); - } - } - - private static final Set GLOBAL_LOCALES; - static { - Map locales = new IdentityHashMap(); - for (Field f : Locale.class.getFields()) { - int modifiers = f.getModifiers(); - if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Locale.class.equals(f.getType())) { - try { - locales.put((Locale) f.get(null), null); - } catch (IllegalArgumentException e) { - continue; - } catch (IllegalAccessException e) { - continue; - } - } - } - GLOBAL_LOCALES = locales.keySet(); - } - - private final Class> clazz; - - private FlyweightType(final Class> clazz) { - this.clazz = clazz; - } - - /** - * Whether this is a shared object - * @param obj the object to check for - * @return true, if shared - */ - abstract boolean isShared(Object obj); - - /** - * Will return the Flyweight enum instance for the flyweight Class, or null if type isn't flyweight - * @param aClazz the class we need the FlyweightType instance for - * @return the FlyweightType, or null - */ - static FlyweightType getFlyweightType(final Class> aClazz) { - if (aClazz.isEnum() || (aClazz.getSuperclass() != null && aClazz.getSuperclass().isEnum())) { - return ENUM; - } else { - FlyweightType flyweightType = TYPE_MAPPINGS.get(aClazz); - return flyweightType != null ? flyweightType : MISC; - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 0) @@ -1,38 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to ignore a field, type or entire package while doing a SizeOf measurement - * @see net.sf.ehcache.pool.sizeof.SizeOf - * @author Chris Dennis - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE }) -public @interface IgnoreSizeOf { - - /** - * Controls whether the annotation, when applied to a {@link ElementType#TYPE type} is to be applied to all its subclasses - * as well or solely on that type only. true if inherited by subtypes, false otherwise - */ - boolean inherited() default false; -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 0) @@ -1,125 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.ccs; - -import java.util.Comparator; - -import org.hibernate.cache.CacheException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.hibernate.cache.access.SoftLock; - -/** - * Ehcache specific read-only cache concurrency strategy. - * - * This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache. - * - * @author Chris Dennis - */ -@Deprecated -public class EhcacheReadOnlyCache extends AbstractEhcacheConcurrencyStrategy { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheReadOnlyCache.class); - - /** - * {@inheritDoc} - */ - public Object get(Object key, long timestamp) throws CacheException { - return cache.get(key); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public SoftLock lock(Object key, Object version) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - public boolean put(Object key, Object value, long timestamp, Object version, - Comparator versionComparator, boolean minimalPut) throws CacheException { - if (minimalPut && cache.get(key) != null) { - return false; - } else { - cache.put(key, value); - return true; - } - } - - /** - * Logs an error since items in a read-only cache should not be mutated. - */ - public void release(Object key, SoftLock lock) { - LOG.error("Application attempted to edit read only item: " + key); - //throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Inserts the specified item into the cache. - */ - public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - cache.update(key, value); - return true; - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public void evict(Object key) throws CacheException { - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public boolean insert(Object key, Object value, Object currentVersion) { - return false; - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return cache + "(read-only)"; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 0) @@ -1,163 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * A regular expression criteria that matches attribute string values. For non java.lang.String attributes, - * the toString() form is used in the comparison. - * - * Expressions are always case insensitive - * - * The following special characters are supported: - * - * '?' - match any one single character - * '*' - match any multiple character(s) (including zero) - * - * The supported wildcard characters can be escaped with a backslash '\', and a literal backslash can be included with '\\' - * - * WARN: Expressions starting with a leading wildcard character are potentially very expensive (ie. full scan) for indexed caches - * - * - * @author teck - */ -public class ILike extends BaseCriteria { - - private final String attributeName; - private final String regex; - private final Pattern pattern; - - /** - * Construct a "like" criteria for the given expression - * - * @param attributeName attribute name - * @param regex expression - */ - public ILike(String attributeName, String regex) { - if ((attributeName == null) || (regex == null)) { - throw new SearchException("Both the attribute name and regex must be non null."); - } - - this.attributeName = attributeName; - this.regex = regex; - this.pattern = convertRegex(regex.trim()); - } - - /** - * Return attribute name. - * - * @return String attribute name - */ - public String getAttributeName() { - return attributeName; - } - - /** - * Return regex string. - * - * @return String regex. - */ - public String getRegex() { - return regex; - } - - private static Pattern convertRegex(final String expr) { - if (expr.length() == 0) { - throw new SearchException("Zero length regex"); - } - - StringBuilder javaRegex = new StringBuilder("^"); - - boolean escape = false; - for (int i = 0; i < expr.length(); i++) { - char ch = expr.charAt(i); - - if (escape) { - switch (ch) { - case '\\': - case '?': - case '*': { - javaRegex.append(Pattern.quote(lowerCase(ch))); - break; - } - - default: { - throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr); - } - } - - escape = false; - } else { - switch (ch) { - case '\\': { - escape = true; - break; - } - case '?': { - javaRegex.append("."); - break; - } - case '*': { - javaRegex.append(".*"); - break; - } - default: { - javaRegex.append(Pattern.quote(lowerCase(ch))); - } - } - } - } - - javaRegex.append("$"); - - return Pattern.compile(javaRegex.toString(), Pattern.DOTALL); - } - - private static String lowerCase(char ch) { - // heeding the advice in Character.toLowerCase() and using String.toLowerCase() instead here - return Character.toString(ch).toLowerCase(); - } - - /** - * {@inheritDoc} - */ - public boolean execute(Element e, Map attributeExtractors) { - Object value = getExtractor(attributeName, attributeExtractors).attributeFor(e, attributeName); - if (value == null) { - return false; - } - - String asString = value.toString().toLowerCase(); - - return pattern.matcher(asString).matches(); - } - - @Override - public Set> getAttributes() { - return Collections.>singleton(new Attribute(attributeName)); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 0) @@ -1,24 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; - -public class KeyBasedOperationWrapper implements KeyBasedOperation { - private final Object key; - private final long creationTime; - - public KeyBasedOperationWrapper(Object key, long creationTime) { - this.key = key; - this.creationTime = creationTime; - } - - public Object getKey() { - return key; - } - - public long getCreationTime() { - return creationTime; - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 0) @@ -1,108 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.hibernate.domain; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class Person { - - private Long id; - private int age; - private String firstname; - private String lastname; - private List events = new ArrayList(); // list semantics, e.g., indexed - private Set emailAddresses = new HashSet(); - private Set phoneNumbers = new HashSet(); - private List talismans = new ArrayList(); // a Bag of good-luck charms. - - public Person() { - // - } - - public List getEvents() { - return events; - } - - protected void setEvents(List events) { - this.events = events; - } - - public void addToEvent(Event event) { - this.getEvents().add(event); - event.getParticipants().add(this); - } - - public void removeFromEvent(Event event) { - this.getEvents().remove(event); - event.getParticipants().remove(this); - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public Set getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Set emailAddresses) { - this.emailAddresses = emailAddresses; - } - - public Set getPhoneNumbers() { - return phoneNumbers; - } - - public void setPhoneNumbers(Set phoneNumbers) { - this.phoneNumbers = phoneNumbers; - } - - public void addTalisman(String name) { - talismans.add(name); - } - - public List getTalismans() { - return talismans; - } - - public void setTalismans(List talismans) { - this.talismans = talismans; - } - - public String toString() { - return getFirstname() + " " + getLastname(); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 0) @@ -1,61 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.regions; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory; - -import org.hibernate.cache.CacheDataDescription; -import org.hibernate.cache.CacheException; -import org.hibernate.cache.EntityRegion; -import org.hibernate.cache.access.AccessType; -import org.hibernate.cache.access.EntityRegionAccessStrategy; -import org.hibernate.cfg.Settings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * An entity region specific wrapper around an Ehcache instance. - * - * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access - * is not supported. - * - * @author Chris Dennis - * @author Abhishek Sanoujam - */ -public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class); - - /** - * Constructs an EhcacheEntityRegion around the given underlying cache. - * - * @param accessStrategyFactory - */ - public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings, - CacheDataDescription metadata, Properties properties) { - super(accessStrategyFactory, underlyingCache, settings, metadata, properties); - } - - /** - * {@inheritDoc} - */ - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType); - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0) @@ -1,162 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2; -import net.sf.ehcache.management.sampled.CacheSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntityV2; - -/** - * A builder for {@link CacheStatisticSampleEntityV2} resource objects. - * - * @author brandony - */ -final class CacheStatisticSampleEntityBuilderV2 { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class); - - private static final String SAMPLE_SUFFIX = "Sample"; - - private final Set sampleNames; - - private final Map> samplersByCMName = new HashMap>(); - - static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) { - return new CacheStatisticSampleEntityBuilderV2(statisticSampleName); - } - - private CacheStatisticSampleEntityBuilderV2(Set sampleNames) { - this.sampleNames = sampleNames; - } - - CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler, - String cacheManagerName) { - addSampler(sampler, cacheManagerName); - return this; - } - - Collection build() { - Collection csses = new ArrayList(); - - for (Map.Entry> entry : samplersByCMName.entrySet()) { - for (CacheSampler sampler : entry.getValue()) { - if (sampleNames == null) { - for (Method m : CacheSampler.class.getMethods()) { - if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } else { - for (String sampleName : sampleNames) { - Method sampleMethod; - try { - sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX); - } catch (NoSuchMethodException e) { - LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName); - continue; - } - - if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } - } - } - - return csses; - } - - private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod, - CacheSampler sampler, - String cmName) { - SampledCounter sCntr; - try { - sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler)); - } catch (IllegalAccessException e) { - LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.", - sampleMethod.getName()); - sCntr = null; - } catch (InvocationTargetException e) { - LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e); - sCntr = null; - } - - if (sCntr != null) { - CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2(); - csse.setCacheManagerName(cmName); - csse.setName(sampler.getCacheName()); - csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID); - // csse.setVersion(this.getClass().getPackage().getImplementationVersion()); - csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, "")); - - TimeStampedCounterValue[] tscvs; - if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) { - tscvs = new TimeStampedCounterValue[0]; - } else { - tscvs = sCntr.getAllSampleValues(); - } - - Map statValueByTime = new TreeMap(); - csse.setStatValueByTimeMillis(statValueByTime); - - for (TimeStampedCounterValue tscv : tscvs) { - statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue()); - } - return csse; - } - - return null; - } - - private Set getExcludedMethodNames(CacheSampler sampler) { - if (sampler.isLocalHeapCountBased()) { - return Collections.singleton("getLocalHeapSizeInBytesSample"); - } - return Collections.emptySet(); - } - - private void addSampler(CacheSampler sampler, - String cacheManagerName) { - if (sampler == null) { - throw new IllegalArgumentException("sampler == null"); - } - - if (cacheManagerName == null) { - throw new IllegalArgumentException("cacheManagerName == null"); - } - - Set samplers = samplersByCMName.get(cacheManagerName); - - if (samplers == null) { - samplers = new HashSet(); - samplersByCMName.put(cacheManagerName, samplers); - } - - samplers.add(sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0) @@ -1,60 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -@Category(CheckShorts.class) -public class DecoratedCacheConfigTest { - - private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache", - "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"}); - - @Test - public void testDecoratedCacheConfig() { - CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource( - "ehcache-decorator-noname-test.xml")); - try { - List names = new ArrayList(Arrays.asList(cm.getCacheNames())); - names.removeAll(ALL_CACHE_NAMES); - Assert.assertEquals("This list should be empty - " + names, 0, names.size()); - // System.out.println("Original config: " + cm.getOriginalConfigurationText()); - String text = cm.getActiveConfigurationText(); - // System.out.println("Cache manager config: " + text); - for (String name : ALL_CACHE_NAMES) { - Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\"")); - String cacheConfigTest = cm.getActiveConfigurationText(name); - // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest); - Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ", - cacheConfigTest.contains("name=\"" + name + "\"")); - } - - } finally { - cm.shutdown(); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/resources/serializedforms/SerializationCopyStrategySerializationTest.testBasic.ser =================================================================== diff -u -N -r10926 -r10963 Binary files differ Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0) @@ -1,149 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.util.Random; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - private static final int NUM_OF_ELEMENTS = 1000; - private static final int NUM_OF_THREADS = 10; - private static final int WRITE_PERCENTAGE = 5; - - public L1BMOnHeapReadWriteTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class); - } - - public static class L1BMOnHeapReadWriteTestApp extends ClientBase { - private final ToolkitBarrier barrier; - - public L1BMOnHeapReadWriteTestApp(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new L1BMOnHeapReadWriteTestApp(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - boolean shouldWait = true; - Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true); - testL1BigMemorySanity(eventualWithStatsCache, shouldWait); - eventualWithStatsCache.removeAll(); - - Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false); - testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait); - eventualWithoutStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true); - testL1BigMemorySanity(strongWithStatsCache, shouldWait); - strongWithStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false); - testL1BigMemorySanity(strongWithoutStatsCache, shouldWait); - strongWithoutStatsCache.removeAll(); - } - - private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException, - BrokenBarrierException { - int index = barrier.await(); - if (index == 0) { - System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache"); - for (int i = 0; i < NUM_OF_ELEMENTS; i++) { - cache.put(new Element("key" + i, "val" + i)); - } - System.out.println("XXXXX done with putting " + cache.getSize() + " entries"); - } - barrier.await(); - if (shouldWait) { - while (cache.getSize() != NUM_OF_ELEMENTS) { - Thread.sleep(1000); - } - } - Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize()); - System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: " - + cache.getStatistics().getLocalHeapSize()); - if (index == 0) { - Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0); - } else { - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize()); - } - - System.out.println("XXXXX starting test threads...."); - Thread ths[] = new Thread[NUM_OF_THREADS]; - for (int i = 0; i < NUM_OF_THREADS; i++) { - ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i); - ths[i].start(); - } - - for (Thread th : ths) { - th.join(); - } - barrier.await(); - System.out.println("XXXXXX done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxBytesLocalHeap(10485760L); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - return cache; - } - - private static class TestThread implements Runnable { - private final long TIME_TO_RUN = 1 * 60 * 1000; - private final Cache cache; - private final int threadIndex; - private final int clientIndex; - - public TestThread(Cache cache, int threadIndex, int clientIndex) { - this.cache = cache; - this.threadIndex = threadIndex; - this.clientIndex = clientIndex; - } - - @Override - public void run() { - System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex); - long start = System.currentTimeMillis(); - Random rand = new Random(start); - while (System.currentTimeMillis() - start < TIME_TO_RUN) { - if (rand.nextInt(100) < WRITE_PERCENTAGE) { - this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS))); - } else { - String key = "key" + rand.nextInt(NUM_OF_ELEMENTS); - Assert.assertNotNull("value for " + key + " is null", this.cache.get(key)); - } - } - } - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0) @@ -1,32 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.wan; - -/** - * @author Eugene Shelestovich - */ -public interface Watchable { - - /** - * - */ - void goLive(); - - void die(); - - /** - * Checks whether or not a given Watchable is alive. - * - * @return {@code true} if a given Watchable is alive, {@code false} otherwise - */ - boolean probeLiveness(); - - /** - * Returns a name which uniquely identifies the Watchable. - * - * @return unique name - */ - String name(); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0) @@ -1,147 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs.blocking; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - - -/** - * Test cases for the {@link UpdatingSelfPopulatingCache}. - * - * @author Greg Luck - * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $ - */ -public class UpdatingSelfPopulatingCacheTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private CacheManager cacheManager; - private Cache cache; - - @Before - public void setUp() throws Exception { - Configuration configuration = new Configuration(); - configuration.name("upSelfPopCM") - .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath())) - .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2) - .timeToLiveSeconds(5) - .overflowToDisk(true) - .diskPersistent(true)); - cacheManager = CacheManager.newInstance(configuration); - cache = cacheManager.getCache("cache"); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - /** - * Tests fetching an entry, and then an update. - */ - @Test - public void testFetchAndUpdate() throws Exception { - final Object value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - - //test null - Element element = selfPopulatingCache.get(null); - - // Lookup - element = selfPopulatingCache.get("key"); - assertThat(element.getObjectValue(), sameInstance(value)); - assertThat(factory.getCount(), is(2)); - - Object actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(3)); - - actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(4)); - } - - /** - * Tests when fetch fails. - */ - @Test - public void testFetchFail() throws Exception { - final Exception exception = new Exception("Failed."); - final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() { - public Object createEntry(final Object key) - throws Exception { - throw exception; - } - - public void updateEntryValue(Object key, Object value) - throws Exception { - throw exception; - } - }; - - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Lookup - try { - selfPopulatingCache.get("key"); - fail(); - } catch (final Exception e) { - // Check the error - assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage()); - } - } - - /** - * Tests refreshing the entries. - */ - @Test - public void testRefresh() throws Exception { - final String value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Refresh - try { - selfPopulatingCache.refresh(); - fail(); - } catch (CacheException e) { - //expected. - assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 0) @@ -1,34 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import java.util.Map; - -import javax.management.ObjectName; - -/** - * @author Abhishek Sanoujam - */ -public interface DSOMBean { - - long getGlobalServerMapGetSizeRequestsCount(); - - long getGlobalServerMapGetValueRequestsCount(); - - long getGlobalServerMapGetSizeRequestsRate(); - - long getGlobalServerMapGetValueRequestsRate(); - - long getReadOperationRate(); - - Map getServerMapGetSizeRequestsCount(); - - Map getServerMapGetValueRequestsCount(); - - Map getServerMapGetSizeRequestsRate(); - - Map getServerMapGetValueRequestsRate(); - - Void dumpClusterState(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0) @@ -1,87 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.statistics.extended; - -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.StatisticArchive; -import org.terracotta.statistics.archive.StatisticSampler; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class SampledStatistic. - * - * @param the generic type - * @author cdennis - */ -class SampledStatistic { - - /** The sampler. */ - private final StatisticSampler sampler; - - /** The history. */ - private final StatisticArchive history; - - /** - * Instantiates a new sampled statistic. - * - * @param statistic the statistic - * @param executor the executor - * @param historySize the history size - * @param periodNanos the period nanos - */ - public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) { - this.history = new StatisticArchive(historySize); - this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history); - } - - /** - * Start sampling. - */ - public void startSampling() { - sampler.start(); - } - - /** - * Stop sampling. - */ - public void stopSampling() { - sampler.stop(); - history.clear(); - } - - /** - * History. - * - * @return the list - */ - public List> history() { - return history.getArchive(); - } - - /** - * Adjust. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void adjust(int historySize, long historyNanos) { - history.setCapacity(historySize); - sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.transaction.SoftLockID; - -/** - * @author Alex Snaps - */ -public class TxCopyStrategyHandler extends CopyStrategyHandler { - - /** - * Creates a TxCopyStrategyHandler based on the copy configuration - * - * @param copyOnRead copy on read flag - * @param copyOnWrite copy on write flag - * @param copyStrategy the copy strategy to use - * @param loader - */ - public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) { - super(copyOnRead, copyOnWrite, copyStrategy, loader); - } - - @Override - public Element copyElementForReadIfNeeded(final Element element) { - final Object objectValue = element.getObjectValue(); - if (objectValue instanceof SoftLockID) { - return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement()); - } - return super.copyElementForReadIfNeeded(element); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0) @@ -1,40 +0,0 @@ -RULE trace RemoteTransactionManagerImpl commitWithoutThrottling -CLASS RemoteTransactionManagerImpl -METHOD commitWithoutThrottling -AT ENTRY -IF true -DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterEntry -CLASS ClusteredStore -METHOD putWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterExit -CLASS ClusteredStore -METHOD putWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterEntry -CLASS ClusteredStore -METHOD removeWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterExit -CLASS ClusteredStore -METHOD removeWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 0) @@ -1,48 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.bootstrap; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; - -/** - * @author Greg Luck - * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public interface BootstrapCacheLoader { - - /** - * Instructs the loader to load the given cache - * @param cache cache to load - */ - void load(Ehcache cache) throws CacheException; - - /** - * - * @return true if this bootstrap loader is asynchronous - */ - boolean isAsynchronous(); - - /** - * Clones the loader - * - * @return clone of this instance - * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface. - */ - Object clone() throws CloneNotSupportedException; - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0) @@ -1,90 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.local; - -import net.sf.ehcache.transaction.TransactionID; -import net.sf.ehcache.transaction.TransactionIDFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * The local transactions mode recovery manager which is used to trigger full recovery of all - * caches configured with local transaction mode. - * - * @author Ludovic Orban - */ -public class LocalRecoveryManager { - - private final TransactionIDFactory transactionIdFactory; - private final List localTransactionStores = new CopyOnWriteArrayList(); - private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet(); - - /** - * Create a LocalRecoveryManager instance - * @param transactionIdFactory the TransactionIDFactory - */ - public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) { - this.transactionIdFactory = transactionIdFactory; - } - - /** - * Register a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void register(LocalTransactionStore localTransactionStore) { - localTransactionStores.add(localTransactionStore); - } - - /** - * Unregister a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void unregister(LocalTransactionStore localTransactionStore) { - localTransactionStores.remove(localTransactionStore); - } - - /** - * Run recovery on all registered local transaction stores. The latter - * are used internally by caches when they're configured with local transaction mode. - * @return the set of recovered TransactionIDs - */ - public Set recover() { - Set recovered = new HashSet(); - // first ask all stores to cleanup their soft locks - for (LocalTransactionStore localTransactionStore : localTransactionStores) { - recovered.addAll(localTransactionStore.recover()); - } - // then clear the transaction ID - for (TransactionID transactionId : recovered) { - transactionIdFactory.clear(transactionId); - } - - previouslyRecoveredTransactionIDs = recovered; - return recovered; - } - - /** - * Get the set of transaction IDs collected by the previous recover() call - * @return the set of previously recovered TransactionIDs - */ - public Set getPreviouslyRecoveredTransactionIDs() { - return previouslyRecoveredTransactionIDs; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 0) @@ -1,54 +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; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentBLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentBLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentBLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderB"; - } - - /** - * @param arg0 - * @return - * @throws CacheException - */ - public Object load(Object arg0) throws CacheException { - LOG.info("Loading Component B..."); - String key = (String) arg0; - return new ComponentB(key); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0) @@ -1,233 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.bulkops; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; - -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.TimeUnit; - -public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) { - super(testConfig, App.class, App.class); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG); - testBulkOpsSanity(dcv2StrongSerialization); - barrier.await(); - - Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL); - testBulkOpsSanity(dcv2EventualSerialization); - barrier.await(); - - barrier.await(); - - } - - private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException { - int index = barrier.await(); - int numOfElements = 100; - Set elements = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i))); - } - if (index == 0) { - cache.putAll(elements); - } - - barrier.await(); - while (cache.getSize() != numOfElements) { - Thread.sleep(1000); - } - Assert.assertEquals(numOfElements, cache.getSize()); - - Set keySet1 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - keySet1.add(new Key("key" + i, i)); - } - - Map rv = cache.getAll(keySet1); - Assert.assertEquals(numOfElements, rv.size()); - - Collection values = new HashSet(); - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - values.add(entry.getValue()); - } - - for (Element element : elements) { - Assert.assertTrue(values.contains(element)); - } - - Set keySet2 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - if (i % 2 == 0) { - keySet2.add(new Key("key" + i, i)); - } - } - - rv = cache.getAll(keySet2); - Assert.assertEquals(keySet2.size(), rv.size()); - - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.removeAll(keySet2); - System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - // sleep for 60 seconds for eventual caches - if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) { - Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS)); - } - } - index = barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client"); - for (Object key : keySet2) { - Assert.assertNull(cache.get(key)); - } - System.out.println("client " + index + " done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxElementsInMemory(100000); - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(100000); - cacheConfiguration.setTimeToIdleSeconds(200000); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency); - return cache; - } - } - - private static class Key implements Serializable { - private final String stringKey; - private final int intKey; - - public Key(String stringKey, int intKey) { - super(); - this.stringKey = stringKey; - this.intKey = intKey; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intKey; - result = prime * result + ((stringKey == null) ? 0 : stringKey.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Key other = (Key) obj; - if (intKey != other.intKey) return false; - if (stringKey == null) { - if (other.stringKey != null) return false; - } else if (!stringKey.equals(other.stringKey)) return false; - return true; - } - - @Override - public String toString() { - return stringKey; - } - - } - - private static class Value implements Serializable { - private final String keyVal; - private final int intVal; - - public Value(String keyVal, int intVal) { - this.keyVal = keyVal; - this.intVal = intVal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intVal; - result = prime * result + ((keyVal == null) ? 0 : keyVal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Value other = (Value) obj; - if (intVal != other.intVal) return false; - if (keyVal == null) { - if (other.keyVal != null) return false; - } else if (!keyVal.equals(other.keyVal)) return false; - return true; - } - - @Override - public String toString() { - return keyVal; - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0) @@ -1,21 +0,0 @@ -package org.terracotta.ehcache.tests.servermap; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase { - - public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) { - super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig, - ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class); - testConfig.setDgcEnabled(true); - testConfig.setDgcIntervalInSec(60); - testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true"); - - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000"); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 0) @@ -1,368 +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.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.properties.TCPropertiesConsts; -import com.tc.test.config.model.TestConfig; - -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.SECONDS; - -/** - * @author cdennis - */ -public class DynamicCacheConfigurationTest extends AbstractCacheTestBase { - public DynamicCacheConfigurationTest(TestConfig testConfig) { - super(testConfig, App.class); - testConfig.addTcProperty(TCPropertiesConsts.L2_SERVERMAP_EVICTION_CLIENTOBJECT_REFERENCES_REFRESH_INTERVAL, "5000"); - testConfig.addTcProperty(TCPropertiesConsts.EHCACHE_EVICTOR_LOGGING_ENABLED, "true"); - } - - public static class App extends ClientBase { - private static final double TOLERANCE = 0.1; - - 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 { - testTTIChange(cacheManager); - testTTLChange(cacheManager); - testDiskCapacityChange(cacheManager); - testMemoryCapacityChange(cacheManager); - testTTIChangeWithCustomElements(cacheManager); - testTTLChangeWithCustomElements(cacheManager); - } - - private Cache createCache(String cacheName, int maxMemory, boolean eternal, long ttl, long tti) { - return new Cache(new CacheConfiguration(cacheName, maxMemory) - .eternal(eternal) - .timeToLiveSeconds(ttl) - .timeToIdleSeconds(tti) - .clearOnFlush(true) - .terracotta(new TerracottaConfiguration().clustered(true).consistency(Consistency.STRONG) - .coherentReads(true).orphanEviction(true).orphanEvictionPeriod(4).localKeyCache(false) - .localKeyCacheSize(0).copyOnRead(false)).logging(true)); - } - - private void testTTIChange(CacheManager manager) throws InterruptedException { - Cache cache = createCache("testTTIChange", 10, false, 0, 10); - manager.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - cache.get("key2"); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - long currentTime = System.currentTimeMillis(); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("key1")); - if (System.currentTimeMillis() - currentTime < 20000 ) { - Assert.assertNotNull(cache.get("key2")); - } else { - Assert.assertNull(cache.get("key2")); - } - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - private void testTTLChange(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChange", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("key1")); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("key1")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - public void testTTIChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTIChangeWithCustomElements", 10, false, 0, 10); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("short")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - public void testTTLChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChangeWithCustomElements", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - private void testMemoryCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testMemoryCapacityChange", 100, true, 0, 0); - cache.getCacheConfiguration().getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG); - cm.addCache(cache); - - int i = 0; - for (; i < 150; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(200); - - for (; i < 250; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100, 200); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(50); - - for (; i < 350; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 50); - - cache.removeAll(); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int lowerBound, final int upperBound) - throws Exception { - final int min = (int) ((1 - TOLERANCE) * lowerBound); - final int max = (int) ((1 + TOLERANCE) * upperBound); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - if (cache.getStatistics().getLocalHeapSize() <= max && cache.getStatistics().getLocalHeapSize() >= min) { - return true; - } - System.out.println("Still waiting for memory store size to fall in bounds [" + lowerBound + ", " + upperBound - + "] current=" + cache.getStatistics().getLocalHeapSize()); - return false; - } - }); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int upperBound) throws Exception { - waitForCacheMemoryStoreSize(cache, 0, upperBound); - } - - public void testDiskCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testDiskCapacityChange", 10, true, 0, 0); - cache.getCacheConfiguration().maxEntriesLocalHeap(1).maxEntriesInCache(100).getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG).concurrency(16); - cm.addCache(cache); - - testCacheDiskCapacity(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesInCache(200); - - testCacheDiskCapacity(cache, 200); - - cache.getCacheConfiguration().setMaxEntriesInCache(50); - - testCacheDiskCapacity(cache, 50); - - cache.removeAll(); - } - - private void testCacheDiskCapacity(final Cache cache, final int capacity) throws Exception { - for (int i = 0; i < 1000; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - System.out.println("Waiting on capacoty of " + capacity); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - System.out.println("Current cache size " + cache.getSize()); - Assert.assertTrue(cache.getSize() > capacity * .85); - return cache.getSize() >= capacity * 0.9 && cache.getSize() <= capacity * 1.1; - } - }); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0) @@ -1,161 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.parser; - -import net.sf.ehcache.search.expression.And; -import net.sf.ehcache.search.expression.EqualTo; -import net.sf.ehcache.search.expression.GreaterThan; -import net.sf.ehcache.search.expression.GreaterThanOrEqual; -import net.sf.ehcache.search.expression.ILike; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.LessThanOrEqual; -import net.sf.ehcache.search.expression.Not; -import net.sf.ehcache.search.expression.NotEqualTo; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.parser.MCriteria.Between; -import net.sf.ehcache.search.parser.MCriteria.Simple; -import net.sf.ehcache.search.parser.MValue.MInt; - -import org.junit.Assert; -import org.junit.Test; - -public class MCriteriaTest { - - private final ClassLoader loader = getClass().getClassLoader(); - - @Test - public void testSimpleModelCriteria() throws CustomParseException { - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj); - EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj); - NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj); - GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj); - GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj); - LessThan crit = (LessThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj); - LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - } - - void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) { - Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max); - net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), name); - Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader)); - Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader)); - Assert.assertEquals(crit.isMinInclusive(), min); - Assert.assertEquals(crit.isMaxInclusive(), max); - } - - @Test - public void testBetween() throws CustomParseException { - MInt obj1 = new MValue.MInt(null, "0"); - MInt obj2 = new MValue.MInt(null, "110"); - checkBetween("foo", obj1, false, obj2, false); - checkBetween("foo", obj1, true, obj2, false); - checkBetween("foo", obj1, false, obj2, true); - checkBetween("foo", obj1, true, obj2, true); - } - - @Test - public void testIlike() { - MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo"); - ILike crit = (ILike)ilike.asEhcacheObject(loader); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testLike() { - MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo"); - ILike crit = (ILike)like.asEhcacheObject(loader); - Assert.assertEquals(like.getLikeRegex(), "foo.%foo"); - Assert.assertEquals(like.getILikeRegex(), "foo.*foo"); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testNot() throws CustomParseException { - MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1")); - MCriteria.Not not = new MCriteria.Not(simple); - Not crit = (Not)not.asEhcacheObject(loader); - @SuppressWarnings("unused") - EqualTo inner = (EqualTo)crit.getCriteria(); - Assert.assertTrue(true); // the casts are sufficient for the test. - } - - @Test - public void testAnd() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5")); - - MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3); - And crit = (And)and.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof And); - And crit2 = (And)crit.getCriterion()[1]; - Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan); - Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo); - - } - - @Test - public void testOr() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2); - - Or crit = (Or)or.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - -import net.sf.ehcache.Ehcache; - -public interface AsyncCoordinatorFactory { - AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config); - - boolean destroy(String cacheManagerName, String cacheName); -} Index: rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,342 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error -org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 0) @@ -1,194 +0,0 @@ -/** - * All content copyright 2010 (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package net.sf.ehcache.servermaplocalcache; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListenerAdapter; - -public class ServerMapLocalCache { - - private final static int CONCURRENCY = 256; - private volatile TCObjectSelfStore tcoSelfStore; - private volatile Cache ehcache; - private final ReentrantReadWriteLock[] locks = new ReentrantReadWriteLock[CONCURRENCY]; - private final Object localSync = new Object(); - private static final ExecutorService evictionHandlerStage = Executors.newFixedThreadPool(4, new ThreadFactory() { - private final AtomicInteger count = new AtomicInteger(); - - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "eviction_handler_stage_thread_" + count.incrementAndGet()); - t.setDaemon(true); - return t; - } - }); - - public ServerMapLocalCache(TCObjectSelfStore tcoSelfStore, Cache ehcache) { - this.tcoSelfStore = tcoSelfStore; - this.ehcache = ehcache; - ehcache.getCacheEventNotificationService().registerListener(new EvictionListener(this)); - for (int i = 0; i < CONCURRENCY; i++) { - locks[i] = new ReentrantReadWriteLock(); - } - } - - private ReentrantReadWriteLock getLock(Object key) { - return locks[Math.abs(key.hashCode() % CONCURRENCY)]; - } - - public void put(TCObjectSelf tcoSelf) { - synchronized (localSync) { - tcoSelfStore.addTCObjectSelf(tcoSelf); - addToCache(tcoSelf); - } - } - - public TCObjectSelf getFromTCObjectSelfStore(Long oid) { - synchronized (localSync) { - return tcoSelfStore.getById(oid); - } - } - - // public void remove(String key) { - // synchronized (localSync) { - // removeFromCache(key); - // } - // } - // - // private void removeFromCache(String key) { - // WriteLock writeLock = getLock(key).writeLock(); - // writeLock.lock(); - // try { - // // remove key-value mapping: key->value - // Element element = ehcache.removeAndReturnElement(key); - // if (element != null) { - // TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - // if (tcoSelf != null) { - // handleKeyValueMappingRemoved(key, tcoSelf); - // } - // } - // - // } finally { - // writeLock.unlock(); - // } - // } - - private void handleKeyValueMappingRemoved(String key, TCObjectSelf tcoSelf) { - // remote remove - tcoSelfStore.removeTCObjectSelf(tcoSelf); - if (tcoSelf != null) { - // clean up meta-mapping: id->key - ehcache.remove(tcoSelf.getOid()); - } - } - - private void addToCache(TCObjectSelf tcoSelf) { - ReentrantReadWriteLock lock = getLock(tcoSelf.getKey()); - lock.writeLock().lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Add to cache: " + tcoSelf); - } - - // add meta mapping: oid->key - ehcache.put(new Element(tcoSelf.getOid(), tcoSelf.getKey())); - - // add the key->value mapping - ehcache.put(new Element(tcoSelf.getKey(), tcoSelf)); - - } finally { - lock.writeLock().unlock(); - } - } - - public void entryEvicted(Object objectKey, Object objectValue) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Entry evicted; evictedKey: " + objectKey + ", evictedValue: " + objectValue); - } - if (objectValue instanceof TCObjectSelf) { - // key-value mapping evicted - keyValueMappingEvicted((String) objectKey, (TCObjectSelf) objectValue); - } else { - // oid-> key mapping removed - objectIdMappingEvicted((Long) objectKey, (String) objectValue); - } - } - - private void objectIdMappingEvicted(Long oid, String key) { - WriteLock writeLock = getLock(key).writeLock(); - writeLock.lock(); - Element element = null; - try { - element = ehcache.get(key); - if (element != null) { - TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - if (tcoSelf != null && tcoSelf.getOid() == oid) { - // clean up key-value mapping - ehcache.remove(key); - tcoSelfStore.removeTCObjectSelf(tcoSelf); - } - } - } finally { - writeLock.unlock(); - } - if (DebugUtil.DEBUG) { - DebugUtil.debug("[objectIdEvicted] oid: " + oid + ", key: " + key + ", was mapped to value: " - + (element == null ? "null" : element.getObjectValue())); - } - } - - private void keyValueMappingEvicted(String objectKey, TCObjectSelf objectValue) { - WriteLock writeLock = getLock(objectKey).writeLock(); - writeLock.lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[keyValueMappingEvicted] key: " + objectKey + ", value: " + objectValue); - } - handleKeyValueMappingRemoved(objectKey, objectValue); - } finally { - writeLock.unlock(); - } - } - - private static class EvictionListener extends CacheEventListenerAdapter { - private final ServerMapLocalCache serverMapLocalCache; - - public EvictionListener(ServerMapLocalCache serverMapLocalCache) { - this.serverMapLocalCache = serverMapLocalCache; - } - - @Override - public void notifyElementExpired(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementExpired] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - - @Override - public void notifyElementEvicted(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementEvicted] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to LiveCacheStatistics and its implementation. - - - Index: rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 0) @@ -1,45 +0,0 @@ - - distribution - - tar.gz - - - - - - - - - - - - ${basedir}/src - /src - - - ${project.build.directory}/${project.name} - - **/ehcache*.jar - **/terracotta-toolkit*-runtime*.jar - - /webapps/${project.name} - - - ${basedir}/src/assemble - - README.* - - / - - - ${basedir}/src/assemble/jetty6.1 - /jetty6.1 - - - ${basedir}/src/assemble/bin - /bin - 0755 - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 0) @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 0) @@ -1,28 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class VersionedItem extends Item { - private Long version; - - public Long getVersion() { - return version; - } - - public void setVersion(Long version) { - this.version = version; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0) @@ -1,309 +0,0 @@ -package net.sf.ehcache.constructs.eventual; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * StronglyConsistentCacheAccessorTest - */ -@Category(CheckShorts.class) -public class StronglyConsistentCacheAccessorTest { - - @Test - public void refusesStandaloneCache() { - try { - new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600)); - fail("Underlying cache not clustered and eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void refusesClusteredButNoEventualCache() { - TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG); - - try { - new StronglyConsistentCacheAccessor(underlyingCache); - fail("Underlying cache clustered but not eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void acceptClusteredAndEventualUnderlyingCache() { - Ehcache underlyingCache = buildMockCache(); - - new StronglyConsistentCacheAccessor(underlyingCache); - } - - @Test - public void testPutIfAbsent() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.putIfAbsent(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.putIfAbsent(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.putIfAbsent(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testSingleArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.replace(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.replace(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.replace(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testTwoArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false)); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true)); - - try { - cacheAccessor.replace(new Element(null, null), new Element("key", "other")); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - - try { - cacheAccessor.replace(new Element("key", "other"), new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testRemoveElement() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element); - when(underlyingCache.remove((Object)"key")).thenReturn(true); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.removeElement(element), is(false)); - assertThat(cacheAccessor.removeElement(element), is(true)); - - try { - cacheAccessor.removeElement(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void putMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - String put = "put"; - Set putMethods = getMethodsMatching(put); - for (Method putMethod : putMethods) { - int paramLength = putMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + putMethod.getName()); - putMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void replaceMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - Set replaceMethods = getMethodsMatching("replace"); - for (Method replaceMethod : replaceMethods) { - int paramLength = replaceMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) { - params[1] = element; - } - System.out.println("Invoking " + replaceMethod.getName()); - replaceMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void removeMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "someValue"); - - String remove = "remove"; - Set removeMethods = getMethodsMatching(remove, "Property"); - for (Method removeMethod : removeMethods) { - System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")"); - int paramLength = removeMethod.getParameterTypes().length; - if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) { - continue; - } - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = element; - } else { - params[0] = key; - } - if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params)); - removeMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void getMethodsDoReadLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "key"; - String get = "get"; - Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid"); - for (Method getMethod : getMethods) { - System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")"); - int paramLength = getMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else { - params[0] = key; - } - - System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params)); - getMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireReadLockOnKey(key); - verify(ehcache).releaseReadLockOnKey(key); - reset(ehcache); - } - } - - private Set getMethodsMatching(String put, String... excludes) { - Set results = new HashSet(); - Method[] methods = Ehcache.class.getMethods(); - for (Method method : methods) { - if (method.getName().contains(put)) { - boolean exclude = false; - for (String exclusion : excludes) { - if (method.getName().contains(exclusion)) { - exclude = true; - } - } - if (!exclude) { - results.add(method); - } - } - } - return results; - } - - private Ehcache buildMockCache() {TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(cacheConfiguration.getElementValueComparatorConfiguration()).thenReturn(new ElementValueComparatorConfiguration()); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.EVENTUAL); - return underlyingCache; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0) @@ -1,440 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Direction; -import net.sf.ehcache.search.ExecutionHints; -import net.sf.ehcache.search.Query; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.expression.AlwaysMatch; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.store.StoreQuery; - -/** - * Query builder implementation. Instances are bound to a specific cache - * - * @author teck - */ -class CacheQuery implements Query, StoreQuery { - - private volatile boolean frozen; - private volatile boolean includeKeys; - private volatile boolean includeValues; - private volatile int maxResults = -1; - private String[] targets; - - private final List orderings = Collections.synchronizedList(new ArrayList()); - private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>()); - private final List criteria = Collections.synchronizedList(new ArrayList()); - private final List aggregators = Collections.synchronizedList(new ArrayList()); - private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>()); - - private final Cache cache; - private volatile ExecutionHints hints; - - /** - * Create a new builder instance - * - * @param cache - */ - public CacheQuery(Cache cache) { - this.cache = cache; - } - - /** - * {@inheritDoc} - */ - public Query includeKeys() { - checkFrozen(); - this.includeKeys = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeValues() { - checkFrozen(); - this.includeValues = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAttribute(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - - this.includedAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException { - checkFrozen(); - - if (aggregators == null) { - throw new NullPointerException(); - } - - for (Aggregator aggregator : aggregators) { - if (aggregator == null) { - throw new NullPointerException("null aggregator"); - } - - this.aggregators.add(aggregator); - } - - return this; - } - - /** - * {@inheritDoc} - */ - public Query addOrderBy(Attribute> attribute, Direction direction) { - checkFrozen(); - this.orderings.add(new OrderingImpl(attribute, direction)); - return this; - } - - /** - * {@inheritDoc} - */ - public Query addGroupBy(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - groupByAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query maxResults(int maxResults) { - checkFrozen(); - this.maxResults = maxResults; - return this; - } - - /** - * {@inheritDoc} - */ - public Query addCriteria(Criteria criteria) { - checkFrozen(); - - if (criteria == null) { - throw new NullPointerException("null criteria"); - } - - this.criteria.add(criteria); - return this; - } - - /** - * {@inheritDoc} - */ - public Results execute() throws SearchException { - return cache.executeQuery(snapshot()); - } - - /** - * {@inheritDoc} - */ - public Results execute(ExecutionHints params) throws SearchException { - this.hints = params; - return cache.executeQuery(snapshot()); - } - - - /** - * {@inheritDoc} - */ - public Query end() { - frozen = true; - return this; - } - - /** - * {@inheritDoc} - */ - public List getOrdering() { - assertFrozen(); - return Collections.unmodifiableList(orderings); - } - - /** - * {@inheritDoc} - */ - public Criteria getCriteria() { - assertFrozen(); - return getEffectiveCriteriaCopy(); - } - - /** - * {@inheritDoc} - */ - public boolean requestsKeys() { - assertFrozen(); - return includeKeys; - } - - /** - * {@inheritDoc} - */ - public boolean requestsValues() { - assertFrozen(); - return includeValues; - } - - /** - * {@inheritDoc} - */ - public Cache getCache() { - assertFrozen(); - return cache; - } - - /** - * {@inheritDoc} - */ - public Set> requestedAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.includedAttributes); - } - - /** - * {@inheritDoc} - */ - public Set> groupByAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.groupByAttributes); - } - - /** - * {@inheritDoc} - */ - public int maxResults() { - assertFrozen(); - return maxResults; - } - - - /** - * {@inheritDoc} - */ - @Override - public ExecutionHints getExecutionHints() { - assertFrozen(); - return hints; - } - - /** - * {@inheritDoc} - */ - public List getAggregators() { - return Collections.unmodifiableList(this.aggregators); - } - - /** - * {@inheritDoc} - */ - public List> getAggregatorInstances() { - assertFrozen(); - return Collections.unmodifiableList(createAggregatorInstances(aggregators)); - } - - private static List> createAggregatorInstances(List aggregators) { - List> rv = new ArrayList>(aggregators.size()); - for (Aggregator aggregator : aggregators) { - rv.add(aggregator.createInstance()); - } - - return rv; - } - - private Criteria getEffectiveCriteriaCopy() { - Criteria result = new AlwaysMatch(); - for (Criteria c : criteria) { - result = result.and(c); - } - return result; - } - - private void assertFrozen() { - if (!frozen) { - throw new AssertionError("not frozen"); - } - } - - private StoreQuery snapshot() { - if (frozen) { - return this; - } - - return new StoreQueryImpl(); - } - - private void checkFrozen() { - if (frozen) { - throw new SearchException("Query is frozen and cannot be mutated"); - } - } - - /** - * {@inheritDoc} - */ - public String[] getTargets() { - return this.targets; - } - - /** - * {@inheritDoc} - */ - @Override - public void targets(final String[] targets) { - this.targets = targets; - } - - /** - * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder - */ - private class StoreQueryImpl implements StoreQuery { - private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy(); - private final boolean copiedIncludeKeys = includeKeys; - private final boolean copiedIncludeValues = includeValues; - private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes)); - private final int copiedMaxResults = maxResults; - private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings)); - private final List copiedAggregators = Collections.unmodifiableList(aggregators); - private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators)); - private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes)); - private final ExecutionHints execHints = hints; - - public Criteria getCriteria() { - return copiedCriteria; - } - - public boolean requestsKeys() { - return copiedIncludeKeys; - } - - public boolean requestsValues() { - return copiedIncludeValues; - } - - public Cache getCache() { - return cache; - } - - public Set
README Notes For Ehcache ${project.version} - - The project home page is http://ehcache.org. Please see http://ehcache.org for a full change log, usage, product versions - and comprehensive documentation. - - - Introduction - ============ - Ehcache is a pure Java, in-process cache with the following features: - - 1. Fast and Light Weight - 1.1 Fast - 1.2 Simple - 1.3 Small foot print - 1.4 Minimal dependencies - 2. Scalable - 2.1 Provides Memory and Disk stores for scalabilty into gigabytes - 2.4 Scalable to hundreds of caches - 2.3 Tuned for high concurrent load on large multi-cpu servers - 2.4 Multiple CacheManagers per virtual machine - 3. Flexible - 3.1 Supports Object or Serializable caching - 3.2 Support cache-wide or Element-based expiry policies - 3.3 Provides LRU, LFU and FIFO cache eviction policies - 3.4 Provides Memory and Disk stores - 3.5 Distributed - 3.6 Dynamic, Runtime Configuration of Caches - 4. Standards Based - 4.1 Full implementation of JSR107 JCACHE API - 5. Extensible - 5.1 Listeners may be plugged in - 5.2 Peer Discovery, Replicators and Listeners may be plugged in - 5.3 Cache Extensions may be plugged in - 5.4 Cache Loaders may be plugged in - 5.5 Cache Exception Handlers may be plugged in - 6. Application Persistence - 6.1 Persistent disk store which stores data between VM restarts - 6.2 Flush to disk on demand - 7. Listeners - 7.1 CacheManager listeners - 7.2 Cache event listeners - 8. JMX Enabled - 9. Distributed Caching - 10. Support for replication via RMI or JGroups - 10.1 Peer Discovery - 10.2 Reliable Delivery - 10.3 Synchronous Or Asynchronous Replication - 10.4 Copy Or Invalidate Replication - 10.5 Transparent Replication - 10.6 Extensible - 10.7 Bootstrapping from Peers - 11. Cache Server - 11.1 RESTful cache server - 11.2 SOAP cache server - 11.3 comes as a WAR or as a complete server - 12. Java EE and Applied Caching - 12.1 Blocking Cache to avoid duplicate processing for concurrent operations - 12.2 SelfPopulating Cache for pull through caching of expensive operations - 12.3 Java EE Gzipping Servlet Filter - 12.4 Cacheable Commands - 12.5 Works with Hibernate - 12.6 Works with Google App Engine - 12.7 Transactional support through JTA - 13. High Quality - 13.1 High Test Coverage - 13.2 Automated Load, Limit and Performance System Tests - 13.3 Specific Concurrency Testing - 13.4 Production tested - 13.5 Fully documented - 13.6 Trusted by Popular Frameworks - 13.7 Conservative Commit policy - 13.8 Full public information on the history of every bug - 13.9 Responsiveness to serious bugs - 14. Open Source Licensing - 14.1 Apache 2.0 license - - Java Requirements - ================= - - Ehcache 1.7.2 and above supports Java 1.5 and 1.6 at runtime. Ehcache final releases are compiled with -target 1.5. - - The Ehcache 1.5 branch is being maintained for Java 1.4 users. - - Dependencies - ============ - - SLF4J API and one concrete logging implementation. The API jar and the JDK14 logging jar are included in the distribution. - - Maven POM snippet - ================= - - All Ehcache releases are placed in the central Maven repository. - - The Maven snippet for Ehcache is: - - <dependency> - <groupid>net.sf.ehcache</groupid> - <artifactid>ehcache</artifactid> - <version>${project.version}</version> - </dependency> - - Installation - ============ - Place the ehcache-core.jar, slf4j-api.jar and slf4j-jdk14.jar, or the concrete SLF4J logging implementation library of your choice into your classpath. - - For use with Terracotta, copy the ehcache-terracotta.jar to your classpath. - - Create an ehcache.xml configuration from the one supplied in the distribution and place it in the root of your classpath. - - The Terracotta server is in the terracotta directory. It includes start and stop scripts. - - For Maven based development, there is a tc-maven-plugin which works much like the Jetty plugin. See UsingWithMaven.txt, - which shows how to add the server to your integration test phase and interactive command use. - - For Ant based development, the tc-maven-plugin can be called from Ant. See UsingWithAnt.txt, - which shows how to add the server to your Ant build, and how to use the server interactively from Ant. - - - Samples - ======= - See the samples directory for ready-to-run samples which show to use the full features of Ehcache, including use with Terracotta. - - - - Documentation - ============= - See http://ehcache.org/documentation for full documentation. - - The JavaDoc is in the distribution and also online at http://ehcache.org/apidocs - - Licenses - ======== - This kit contains ehcache code which is governed by the Apache License, version 2.0. The license is in the licenses folder. - - Ehcache 1.7.1 and higher uses SLF4J for logging. The SLF4J license is included in the licenses folder. - - Known Issues - ============ - - 1. There are a number of known issues and workarounds for Tomcat. See the Using Ehcache with Tomcat chapter - in the online documentation. - - 2. See the FAQ online for a current list. - -
- * If the shutdown occurs on the singleton, then the singleton is removed, so that if a singleton access method is called, a new - * singleton will be created. - */ - void shutdown(); - - /** - * Clears the contents of all caches in the CacheManager, but without - * removing any caches. - *
- * This method is not synchronized. It only guarantees to clear those elements in a cache at the time that the - * {@link net.sf.ehcache.Ehcache#removeAll()} mehod on each cache is called. - */ - void clearAll(); - - /** - * Gets the cache names managed by the CacheManager - */ - @ManagementAttribute - String[] getCacheNames() throws IllegalStateException; - - /** - * Get a map of cache name to performance metrics (hits, misses). - * - * @return a map of cache metrics - */ - Map getCacheMetrics(); - - /** - * @return aggregate hit rate - */ - long getCacheHitRate(); - - /** - * @return aggregate in-memory hit rate - */ - long getCacheInMemoryHitRate(); - - /** - * @return aggregate off-heap hit rate - */ - long getCacheOffHeapHitRate(); - - /** - * @return aggregate on-disk hit rate - */ - long getCacheOnDiskHitRate(); - - /** - * @return aggregate miss rate - */ - long getCacheMissRate(); - - /** - * @return aggregate in-memory miss rate - */ - long getCacheInMemoryMissRate(); - - /** - * @return aggregate off-heap miss rate - */ - long getCacheOffHeapMissRate(); - - /** - * @return aggregate on-disk miss rate - */ - long getCacheOnDiskMissRate(); - - /** - * @return aggregate put rate - */ - long getCachePutRate(); - - /** - * @return aggregate update rate - */ - long getCacheUpdateRate(); - - /** - * @return aggregate remove rate - */ - long getCacheRemoveRate(); - - /** - * @return aggregate eviction rate - */ - long getCacheEvictionRate(); - - /** - * @return aggregate expiration rate - */ - long getCacheExpirationRate(); - - /** - * @return aggregate average get time (ms.) - */ - float getCacheAverageGetTime(); - - /** - * @return if any contained caches are configured for search - */ - @ManagementAttribute - boolean getSearchable(); - - /** - * @return aggregate search rate - */ - long getCacheSearchRate(); - - /** - * @return aggregate search time - */ - long getCacheAverageSearchTime(); - - /** - * generateActiveConfigDeclaration - * - * @return CacheManager configuration as String - */ - String generateActiveConfigDeclaration(); - - /** - * generateActiveConfigDeclaration - * - * @param cacheName - * @return Cache configuration as String - */ - String generateActiveConfigDeclaration(String cacheName); - - /** - * Are any of the caches transactional - * - * @see net.sf.ehcache.config.CacheConfiguration.TransactionalMode - */ - @ManagementAttribute - boolean getTransactional(); - - /** - * Get the committed transactions count - * - * @return the committed transactions count - */ - long getTransactionCommittedCount(); - - /** - * @return aggregate Xa commit rate - */ - long getTransactionCommitRate(); - - /** - * Get the rolled back transactions count - * - * @return the rolled back transactions count - */ - long getTransactionRolledBackCount(); - - /** - * @return aggregate Xa rollback rate - */ - long getTransactionRollbackRate(); - - /** - * Get the timed out transactions count. Note that only transactions which failed to - * commit due to a timeout are taken into account - * - * @return the timed out transactions count - */ - long getTransactionTimedOutCount(); - - /** - * Returns whether any caches are configured for write-behind - */ - @ManagementAttribute - boolean getHasWriteBehindWriter(); - - /** - * Returns the total length of all write-behind queues across all caches - * - * @return aggregate writer-behind queue length - */ - long getWriterQueueLength(); - - /** - * Maximum elements that can be queued for processing by the write-behind writer - * - * @return aggregate of the maximum elements that can be waiting to be processed - * by the write-behind writer across all caches - */ - @ManagementAttribute - int getWriterMaxQueueSize(); - - /** - * Maximum number of bytes of entries in the disk stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the disk stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalDisk(); - - /** - * @param maxBytes - */ - void setMaxBytesLocalDisk(long maxBytes); - - /** - * @param maxBytes - */ - void setMaxBytesLocalDiskAsString(String maxBytes); - - /** - * @return Original input for maxBytesLocalDisk - */ - @ManagementAttribute - String getMaxBytesLocalDiskAsString(); - - /** - * Maximum number of bytes of entries in the heap memory stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the heap memory stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalHeap(); - - /** - * @return Original input for maxBytesLocalHeap - */ - @ManagementAttribute - String getMaxBytesLocalHeapAsString(); - - /** - * @param maxBytes - */ - void setMaxBytesLocalHeap(long maxBytes); - - /** - * @param maxBytes - */ - void setMaxBytesLocalHeapAsString(String maxBytes); - - /** - * Maximum number of bytes of entries in the off-heap stores of all caches that - * did not declare their own max size. - * - * @return maximum number of bytes in the off-heap stores of all caches that - * did not declare their own max size. - */ - @ManagementAttribute - long getMaxBytesLocalOffHeap(); - - /** - * @return Original input for maxBytesLocalOffHeap - */ - @ManagementAttribute - String getMaxBytesLocalOffHeapAsString(); - - /** - * Execute a BMSQL query against the CacheManager and return result grid. - * - * @param queryString - * @return query result grid - */ - Object[][] executeQuery(String queryString); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NonHibernateCacheDecorator.java (revision 0) @@ -1,43 +0,0 @@ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.constructs.EhcacheDecoratorAdapter; - -import java.io.Serializable; - -/** - * This decorator class intercepts cache gets and acts as a cache read through during or before a cache load and acts as a system of record - * after the cache has been loaded. Cache read through: get the object from the cache, if not in cache, get object from database, load in to - * cache and return object. System of Record (SOR): only get the object from the cache. - * - * @author sdalto2 - * - */ -public class NonHibernateCacheDecorator extends EhcacheDecoratorAdapter { - - private Ehcache cache; - public NonHibernateCacheDecorator(Ehcache cache) { - super(cache); - this.cache=cache; - } - - /** - * This get method will always call Element get(Serializable key) So a serializable key is mandatory. - */ - @Override - public Element get(Object key) throws IllegalStateException, CacheException { - return get((Serializable) key); - } - - @Override - public Element get(Serializable key) throws IllegalStateException, CacheException { - return new Element(1,"dummy"); - } - @Override - public void removeAll(boolean doNotNotifyListeners) throws IllegalStateException, CacheException { - cache.removeAll(doNotNotifyListeners); - } - -} \ No newline at end of file Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/util/concurrent/ConcurrentHashMapTest.java (revision 0) @@ -1,218 +0,0 @@ -package net.sf.ehcache.util.concurrent; - -import net.sf.ehcache.Element; -import org.junit.Test; - -import java.util.HashSet; -import java.util.Random; -import java.util.UUID; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - -/** - * @author Alex Snaps - */ -public class ConcurrentHashMapTest { - - private static final int ENTRIES = 10000; - - @Test - public void testRandomValuesWithObjects() { - - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final Object o = new Object(); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testRandomValuesWithComparable() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final EvilComparableKey o = new EvilComparableKey(UUID.randomUUID().toString()); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testReplaceWithWeirdBehavior() { - ConcurrentHashMap elementMap = new ConcurrentHashMap(); - final Element initialElement = new Element("key", "foo"); - elementMap.put("key", initialElement); - assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(true)); - assertThat(elementMap.replace("key", initialElement, new Element("key", "foo")), is(false)); - - ConcurrentHashMap stringMap = new ConcurrentHashMap(); - final String initialString = "foo"; - stringMap.put("key", initialString); - assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true)); - assertThat(stringMap.replace("key", initialString, new String(initialString)), is(true)); - } - - @Test - public void testRandomValues() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - final long seed = System.nanoTime(); - System.out.println("SEED: " + seed); - final Random random = new Random(seed); - - for(int i = 0; i < ENTRIES; i++) { - final Object o; - switch(i % 4) { - case 0: - final int hashCode = random.nextInt(); - o = new Object() { - @Override - public int hashCode() { - return hashCode; - } - }; - break; - case 1: - o = new EvilKey(Integer.toString(i)); - break; - default: - o = new EvilComparableKey(Integer.toString(i)); - - } - assertThat(map.put(o, new KeyHolder(o)) == null, is(true)); - } - - for (Object o : map.keySet()) { - assertThat(o.toString(), map.containsKey(o), is(true)); - assertThat(o.toString(), map.get(o), notNullValue()); - } - - assertThings(map); - } - - @Test - public void testRandomValuesWithCollisions() { - ConcurrentHashMap> map = new ConcurrentHashMap>(); - - for(int i = 0; i < ENTRIES; i++) { - final EvilKey o = new EvilKey(UUID.randomUUID().toString()); - map.put(o, new KeyHolder(o)); - } - - assertThings(map); - } - - @Test - public void testUsesObjectIdentityForElementsOnly() { - - final String key = "ourKey"; - - ConcurrentHashMap map = new ConcurrentHashMap(); - - String value = new String("key"); - String valueAgain = new String("key"); - map.put(key, value); - assertThat(map.replace(key, valueAgain, valueAgain), is(true)); - assertThat(map.replace(key, value, valueAgain), is(true)); - - Element elementValue = new Element(key, value); - Element elementValueAgain = new Element(key, value); - map.put(key, elementValue); - assertThat(map.replace(key, elementValueAgain, elementValue), is(false)); - assertThat(map.replace(key, elementValue, elementValueAgain), is(true)); - assertThat(map.replace(key, elementValue, elementValueAgain), is(false)); - assertThat(map.replace(key, elementValueAgain, elementValue), is(true)); - } - - @Test - public void testActuallyWorks() throws InterruptedException { - final long top = 100000000; - final String key = "counter"; - final ConcurrentHashMap map = new ConcurrentHashMap(); - map.put(key, 0L); - - final Runnable runnable = new Runnable() { - @Override - public void run() { - for(Long val = map.get(key); val < top && map.replace(key, val, val + 1); val = map.get(key)); - } - }; - - Thread[] threads = new Thread[Runtime.getRuntime().availableProcessors() * 2]; - for (int i = 0, threadsLength = threads.length; i < threadsLength; ) { - threads[i] = new Thread(runnable); - threads[i].setName("Mutation thread #" + ++i); - threads[i - 1].start(); - } - - for (Thread thread : threads) { - thread.join(); - } - - assertThat(map.get(key), is(top)); - - } - - private void assertThings(final ConcurrentHashMap, ?> map) { - assertThat(map.size(), is(ENTRIES)); - - for(int i = 0; i < 100; i ++) { - final HashSet randomValues = new HashSet(map.getRandomValues(ENTRIES)); - assertThat(randomValues.size(), is(ENTRIES)); - for (Object randomValue : randomValues) { - assertThat(randomValue, instanceOf(KeyHolder.class)); - final Object key = ((KeyHolder)randomValue).key; - assertThat("Missing " + key, map.containsKey(key), is(true)); - } - } - } -} - -class KeyHolder { - final K key; - - KeyHolder(final K key) { - this.key = key; - } -} - -class EvilKey { - final String value; - - EvilKey(final String value) { - this.value = value; - } - - @Override - public int hashCode() { - return this.value.hashCode() & 1; - } - - @Override - public boolean equals(final Object obj) { - return obj != null && obj.getClass() == this.getClass() && ((EvilKey)obj).value.equals(value); - } - - @Override - public String toString() { - return this.getClass().getSimpleName() + " { " + value + " }"; - } -} - -class EvilComparableKey extends EvilKey implements Comparable { - - EvilComparableKey(final String value) { - super(value); - } - - @Override - public int compareTo(final EvilComparableKey o) { - return value.compareTo(o != null ? o.value : null); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/HttpUrlConfigCacheTest.java (revision 0) @@ -1,36 +0,0 @@ -/* - * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.terracotta.toolkit.Toolkit; - -import com.tc.test.config.model.TestConfig; - -import junit.framework.Assert; - -public class HttpUrlConfigCacheTest extends AbstractCacheTestBase { - - public HttpUrlConfigCacheTest(TestConfig testConfig) { - super("http-url-config-cache-test.xml", testConfig, Client.class); - } - - public static class Client extends ClientBase { - - public Client(String[] args) { - super("test", args); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - cache.put(new Element("key", "value")); - Assert.assertEquals("value", cache.get("key").getObjectValue()); - } - - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/AgentLoader.java (revision 0) @@ -1,242 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof; - -import net.sf.ehcache.config.MemoryUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.lang.instrument.Instrumentation; -import java.lang.management.ManagementFactory; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.ArrayList; -import java.util.List; - -/** - * This will try to load the agent using the Attach API of JDK6. - * If you are on an older JDK (v5) you can still use the agent by adding the -javaagent:[pathTojar] to your VM - * startup script - * - * @author Alex Snaps - */ -final class AgentLoader { - - private static final Logger LOGGER = LoggerFactory.getLogger(AgentLoader.class); - - private static final String INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME = "net.sf.ehcache.sizeof.agent.instrumentation"; - private static final String SIZEOF_AGENT_CLASSNAME = "net.sf.ehcache.pool.sizeof.SizeOfAgent"; - private static final String VIRTUAL_MACHINE_CLASSNAME = "com.sun.tools.attach.VirtualMachine"; - private static final Method VIRTUAL_MACHINE_ATTACH; - private static final Method VIRTUAL_MACHINE_DETACH; - private static final Method VIRTUAL_MACHINE_LOAD_AGENT; - - private static volatile Instrumentation instrumentation; - - static { - Method attach = null; - Method detach = null; - Method loadAgent = null; - try { - Class> virtualMachineClass = getVirtualMachineClass(); - attach = virtualMachineClass.getMethod("attach", String.class); - detach = virtualMachineClass.getMethod("detach"); - loadAgent = virtualMachineClass.getMethod("loadAgent", String.class); - } catch (Throwable e) { - LOGGER.info("Unavailable or unrecognised attach API : {}", e.toString()); - } - VIRTUAL_MACHINE_ATTACH = attach; - VIRTUAL_MACHINE_DETACH = detach; - VIRTUAL_MACHINE_LOAD_AGENT = loadAgent; - } - - private static Class> getVirtualMachineClass() throws ClassNotFoundException { - try { - return AccessController.doPrivileged(new PrivilegedExceptionAction>() { - public Class> run() throws Exception { - try { - return ClassLoader.getSystemClassLoader().loadClass(VIRTUAL_MACHINE_CLASSNAME); - } catch (ClassNotFoundException cnfe) { - for (File jar : getPossibleToolsJars()) { - try { - Class> vmClass = new URLClassLoader(new URL[] {jar.toURL()}).loadClass(VIRTUAL_MACHINE_CLASSNAME); - LOGGER.info("Located valid 'tools.jar' at '{}'", jar); - return vmClass; - } catch (Throwable t) { - LOGGER.info("Exception while loading tools.jar from '{}': {}", jar, t); - } - } - throw new ClassNotFoundException(VIRTUAL_MACHINE_CLASSNAME); - } - } - }); - } catch (PrivilegedActionException pae) { - Throwable actual = pae.getCause(); - if (actual instanceof ClassNotFoundException) { - throw (ClassNotFoundException) actual; - } - throw new AssertionError("Unexpected checked exception : " + actual); - } - } - - private static List getPossibleToolsJars() { - List jars = new ArrayList(); - - File javaHome = new File(System.getProperty("java.home")); - File jreSourced = new File(javaHome, "lib/tools.jar"); - if (jreSourced.exists()) { - jars.add(jreSourced); - } - if ("jre".equals(javaHome.getName())) { - File jdkHome = new File(javaHome, "../"); - File jdkSourced = new File(jdkHome, "lib/tools.jar"); - if (jdkSourced.exists()) { - jars.add(jdkSourced); - } - } - return jars; - } - - /** - * Attempts to load the agent through the Attach API - * @return true if agent was loaded (which could have happened thought the -javaagent switch) - */ - static boolean loadAgent() { - synchronized (AgentLoader.class.getName().intern()) { - if (!agentIsAvailable() && VIRTUAL_MACHINE_LOAD_AGENT != null) { - try { - warnIfOSX(); - String name = ManagementFactory.getRuntimeMXBean().getName(); - Object vm = VIRTUAL_MACHINE_ATTACH.invoke(null, name.substring(0, name.indexOf('@'))); - try { - File agent = getAgentFile(); - LOGGER.info("Trying to load agent @ {}", agent); - if (agent != null) { - VIRTUAL_MACHINE_LOAD_AGENT.invoke(vm, agent.getAbsolutePath()); - } - } finally { - VIRTUAL_MACHINE_DETACH.invoke(vm); - } - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - LOGGER.info("Failed to attach to VM and load the agent: {}: {}", cause.getClass(), cause.getMessage()); - } catch (Throwable t) { - LOGGER.info("Failed to attach to VM and load the agent: {}: {}", t.getClass(), t.getMessage()); - } - } - - return agentIsAvailable(); - } - } - - private static void warnIfOSX() { - if (JvmInformation.isOSX() && System.getProperty("java.io.tmpdir") != null) { - LOGGER.warn("Loading the SizeOfAgent will probably fail, as you are running on Apple OS X and have a value set for java.io.tmpdir\n" + - "They both result in a bug, not yet fixed by Apple, that won't let us attach to the VM and load the agent.\n" + - "Most probably, you'll also get a full thread-dump after this because of the failure... Nothing to worry about!\n" + - "You can bypass trying to load the Agent entirely by setting the System property '" - + net.sf.ehcache.pool.sizeof.AgentSizeOf.BYPASS_LOADING + "' to true"); - } - } - - private static File getAgentFile() throws IOException, URISyntaxException { - URL agent = AgentLoader.class.getResource("sizeof-agent.jar"); - if (agent == null) { - return null; - } else if (agent.getProtocol().equals("file")) { - return new File(agent.toURI()); - } else { - File temp = File.createTempFile("ehcache-sizeof-agent", ".jar"); - try { - FileOutputStream fout = new FileOutputStream(temp); - try { - InputStream in = agent.openStream(); - try { - byte[] buffer = new byte[(int)MemoryUnit.KILOBYTES.toBytes(1)]; - while (true) { - int read = in.read(buffer); - if (read < 0) { - break; - } else { - fout.write(buffer, 0, read); - } - } - } finally { - in.close(); - } - } finally { - fout.close(); - } - } finally { - temp.deleteOnExit(); - } - LOGGER.info("Extracted agent jar to temporary file {}", temp); - return temp; - } - } - - /** - * Checks whether the agent is available - * @return true if available - */ - static boolean agentIsAvailable() { - try { - if (instrumentation == null) { - instrumentation = (Instrumentation)System.getProperties().get(INSTRUMENTATION_INSTANCE_SYSTEM_PROPERTY_NAME); - } - if (instrumentation == null) { - Class sizeOfAgentClass = ClassLoader.getSystemClassLoader().loadClass(SIZEOF_AGENT_CLASSNAME); - Method getInstrumentationMethod = sizeOfAgentClass.getMethod("getInstrumentation"); - instrumentation = (Instrumentation)getInstrumentationMethod.invoke(sizeOfAgentClass); - } - return instrumentation != null; - } catch (SecurityException e) { - LOGGER.warn("Couldn't access the system classloader because of the security policies applied by " + - "the security manager. You either want to loosen these, so ClassLoader.getSystemClassLoader() and " + - "reflection API calls are permitted or the sizing will be done using some other mechanism.\n" + - "Alternatively, set the system property net.sf.ehcache.sizeof.agent.instrumentationSystemProperty to true " + - "to have the agent put the required instances in the System Properties for the loader to access."); - return false; - } catch (Throwable e) { - return false; - } - } - - /** - * Returns the size of this Java object as calculated by the loaded agent. - * - * @param obj object to be sized - * @return size of the object in bytes - */ - static long agentSizeOf(Object obj) { - if (instrumentation == null) { - throw new UnsupportedOperationException("Sizeof agent is not available"); - } - return instrumentation.getObjectSize(obj); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/filter/package.html (revision 0) @@ -1,7 +0,0 @@ - - - - -This package contains the SizeOf filtering interface and implementations for the pooling in Ehcache. - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/checkstyle/suppressions.xml (revision 0) @@ -1,451 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/OverflowCacheTest.java (revision 0) @@ -1,73 +0,0 @@ -package net.sf.ehcache; - -import net.sf.ehcache.config.CacheConfiguration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * @author Alex Snaps - */ -public class OverflowCacheTest { - - private static final Logger LOG = LoggerFactory.getLogger(CacheTest.class.getName()); - - private CacheManager manager; - - @Before - public void setUp() throws Exception { - manager = CacheManager.create(); - } - - /** - * teardown - */ - @After - public void tearDown() throws Exception { - if (manager != null) { - manager.shutdown(); - } - } - - - /** - * Shows the effect of jamming large amounts of puts into a cache that overflows to disk. - * The DiskStore should cause puts to back off and avoid an out of memory error. - */ - @Test - public void testBehaviourOnDiskStoreBackUp() throws Exception { - Cache cache = new Cache(new CacheConfiguration().name("testBehaviourOnDiskStoreBackUp") - .maxElementsInMemory(1000) - .overflowToDisk(true) - .eternal(false) - .timeToLiveSeconds(100) - .timeToIdleSeconds(200) - .diskPersistent(false) - .diskExpiryThreadIntervalSeconds(0) - .diskSpoolBufferSizeMB(10)); - manager.addCache(cache); - - assertEquals(0, cache.getStatistics().getLocalHeapSize()); - - Element a; - int i = 0; - try { - for (; i < 150000; i++) { - String key = i + ""; - String value = key; - a = new Element(key, value + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); - cache.put(a); - } - } catch (OutOfMemoryError e) { - LOG.info("OutOfMemoryError: " + e.getMessage() + " " + i); - fail(); - } - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/UuidItem.java (revision 0) @@ -1,46 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class UuidItem { - private String id; - private String name; - private String description; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CachePoolPinningTest.java (revision 0) @@ -1,122 +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 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.MemoryUnit; -import net.sf.ehcache.config.PinningConfiguration; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; - - -import static org.junit.Assert.assertNotNull; - -/** - * Tests for Cache pinning with pools - * - * @author Ludovic Orban - */ -public class CachePoolPinningTest { - - 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(System.getProperty("java.io.tmpdir"))) - .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES) - .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES) - ); - } - - @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() - .name("memoryOnlyCache_inCache") - .overflowToDisk(false) - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("memoryOnlyCache_inCache"), ELEMENT_COUNT, 0); - } - - @Test - @Ignore - public void testOverflowToDisk() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .name("overflowToDiskCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("overflowToDiskCache_inCache"), 0, ELEMENT_COUNT); - } - - @Test - @Ignore - public void testDiskPersistent() throws Exception { - cacheManager.addCache(new Cache( - new CacheConfiguration() - .diskPersistent(true) - .name("diskPersistentCache_inCache") - .pinning(new PinningConfiguration().store(PinningConfiguration.Store.INCACHE)) - )); - doAssertions(cacheManager.getCache("diskPersistentCache_inCache"), 0, ELEMENT_COUNT); - } - - private void doAssertions(Cache cache, long expectedMemoryHits, long expectedDiskHits) { - for (int i = 0; i < ELEMENT_COUNT; i++) { - cache.put(new Element(i, i)); - } - - Assert.assertEquals(ELEMENT_COUNT, cache.getSize()); - - for (int i = 0; i < ELEMENT_COUNT; i++) { - assertNotNull(cache.get(i)); - } - - Assert.assertEquals(expectedMemoryHits, cache.getStatistics().localHeapHitCount()); - Assert.assertEquals(ELEMENT_COUNT - expectedMemoryHits, cache.getStatistics().localHeapMissCount()); - Assert.assertEquals(expectedDiskHits, cache.getStatistics().localDiskHitCount()); - Assert.assertEquals(0, cache.getStatistics().localDiskMissCount()); - } - -} - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapSanityTest.java (revision 0) @@ -1,18 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class L1BMOnHeapSanityTest extends AbstractCacheTestBase { - public static final int NODE_COUNT = 2; - - public L1BMOnHeapSanityTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapBasicSanityTestApp.class, L1BMOnHeapBasicSanityTestApp.class); - testConfig.getL2Config().setMaxHeap(1024); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/TerracottaConfigConfigurationElement.java (revision 0) @@ -1,84 +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.TerracottaClientConfiguration; -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 the {@link TerracottaClientConfiguration} - * - * @author Abhishek Sanoujam - * - */ -public class TerracottaConfigConfigurationElement extends SimpleNodeElement { - - private final TerracottaClientConfiguration tcConfigConfiguration; - - /** - * Constructor accepting the parent and the {@link TerracottaClientConfiguration} - * - * @param parent - * @param tcConfigConfiguration - */ - public TerracottaConfigConfigurationElement(NodeElement parent, TerracottaClientConfiguration tcConfigConfiguration) { - super(parent, "terracottaConfig"); - this.tcConfigConfiguration = tcConfigConfiguration; - init(); - } - - private void init() { - if (tcConfigConfiguration == null) { - return; - } - if (tcConfigConfiguration.getUrl() != null) { - addAttribute(new SimpleNodeAttribute("url", tcConfigConfiguration.getUrl()).optional(true)); - } - addAttribute(new SimpleNodeAttribute("rejoin", tcConfigConfiguration.isRejoin()).optional(true).defaultValue( - TerracottaClientConfiguration.DEFAULT_REJOIN_VALUE)); - - addAttribute(new SimpleNodeAttribute("wanEnabledTSA", tcConfigConfiguration.isWanEnabledTSA()).optional(true).defaultValue( - TerracottaClientConfiguration.DEFAULT_WAN_ENABLED_TSA_VALUE)); - - if (tcConfigConfiguration.getOriginalEmbeddedConfig() != null) { - addChildElement(new TCConfigElement(this, tcConfigConfiguration.getOriginalEmbeddedConfig())); - } - } - - /** - * Element representing the "tc-config" element inside "terracottaConfig" - * - * @author Abhishek Sanoujam - * - */ - private static class TCConfigElement extends SimpleNodeElement { - - /** - * Constructor accepting the {@link TerracottaConfigConfigurationElement} parent and the inner string content - * - * @param parent - * @param content - */ - public TCConfigElement(TerracottaConfigConfigurationElement parent, String content) { - super(parent, "tc-config"); - this.setInnerContent(content); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-xa-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/blocking/package.html (revision 0) @@ -1,11 +0,0 @@ - - - - - Doug Lea in his book Concurrent Programming in Java talks about concurrency support constructs. - One meaning of a construct is "an abstract or general idea inferred or derived from specific instances". - Just like patterns emerge from noting the similarities of problems and gradually finding a solution to - classes of them, so to constructs are general solutions to commond problems. With the constructs package, - concrete, extensible implementations are offered to solve these common problems. - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/MemoryStoreEvictionPolicy.java (revision 0) @@ -1,123 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - - -import java.io.Serializable; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * A typesafe enumeration of eviction policies. - * The policy used to evict elements from the {@link net.sf.ehcache.store.MemoryStore}. - * This can be one of: - * - * LRU - least recently used - * LFU - least frequently used - * FIFO - first in first out, the oldest element by creation time - * - * The default value is LRU - * - * @author Greg Luck - * @version $Id: MemoryStoreEvictionPolicy.java 5594 2012-05-07 16:04:31Z cdennis $ - * @since 1.2 - */ -public final class MemoryStoreEvictionPolicy implements Serializable { - - /** - * LRU - least recently used. - */ - public static final MemoryStoreEvictionPolicy LRU = new MemoryStoreEvictionPolicy("LRU"); - - /** - * LFU - least frequently used. - */ - - public static final MemoryStoreEvictionPolicy LFU = new MemoryStoreEvictionPolicy("LFU"); - - /** - * FIFO - first in first out, the oldest element by creation time. - */ - public static final MemoryStoreEvictionPolicy FIFO = new MemoryStoreEvictionPolicy("FIFO"); - - /** - * FIFO - first in first out, the oldest element by creation time. - */ - public static final MemoryStoreEvictionPolicy CLOCK = new MemoryStoreEvictionPolicy("CLOCK"); - - private static final Logger LOG = LoggerFactory.getLogger(MemoryStoreEvictionPolicy.class.getName()); - - private final String myName; - - /** - * This class should not be subclassed or have instances created. - * @param policy - */ - private MemoryStoreEvictionPolicy(String policy) { - myName = policy; - } - - /** - * @return a String representation of the policy - */ - @Override - public String toString() { - return myName; - } - - /** - * Converts a string representation of the policy into a policy. - * - * @param policy either LRU, LFU or FIFO - * @return one of the static instances - */ - public static MemoryStoreEvictionPolicy fromString(String policy) { - if (policy != null) { - if (policy.equalsIgnoreCase("LRU")) { - return LRU; - } else if (policy.equalsIgnoreCase("LFU")) { - return LFU; - } else if (policy.equalsIgnoreCase("FIFO")) { - return FIFO; - } else if (policy.equalsIgnoreCase("CLOCK")) { - return CLOCK; - } - } - LOG.warn("The memoryStoreEvictionPolicy of {} cannot be resolved. The policy will be set to LRU", policy); - return LRU; - } - - /** - * Enum for {@link MemoryStoreEvictionPolicy} - * - */ - public static enum MemoryStoreEvictionPolicyEnum { - /** - * Value for {@link MemoryStoreEvictionPolicy#LFU} - */ - LFU, - /** - * Value for {@link MemoryStoreEvictionPolicy#LRU} - */ - LRU, - /** - * Value for {@link MemoryStoreEvictionPolicy#FIFO} - */ - FIFO; - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/.settings/org.eclipse.core.resources.prefs (revision 0) @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/.settings/org.eclipse.core.resources.prefs (revision 0) @@ -1,6 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding//src/test/java=UTF-8 -encoding//src/test/resources=UTF-8 -encoding/=UTF-8 Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/OperationImpl.java (revision 0) @@ -1,130 +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.Set; -import java.util.concurrent.ScheduledExecutorService; - -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Latency; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Result; -import net.sf.ehcache.statistics.extended.ExtendedStatistics.Statistic; - -import org.terracotta.statistics.OperationStatistic; - -/** - * The Class OperationImpl. - * - * @param the generic type - * @author cdennis - */ -class OperationImpl> implements Result { - - /** The source. */ - private final OperationStatistic source; - - /** The count. */ - private final SemiExpiringStatistic count; - - /** The rate. */ - private final RateImpl rate; - - /** The latency. */ - private final LatencyImpl latency; - - /** - * Instantiates a new operation impl. - * - * @param source the source - * @param targets the targets - * @param averageNanos the average nanos - * @param executor the executor - * @param historySize the history size - * @param historyNanos the history nanos - */ - public OperationImpl(OperationStatistic source, Set targets, long averageNanos, - ScheduledExecutorService executor, int historySize, long historyNanos) { - this.source = source; - this.count = new SemiExpiringStatistic(source.statistic(targets), executor, historySize, historyNanos); - this.latency = new LatencyImpl(source, targets, averageNanos, executor, historySize, historyNanos); - this.rate = new RateImpl(source, targets, averageNanos, executor, historySize, historyNanos); - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#rate() - */ - @Override - public Statistic rate() { - return rate; - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#latency() - */ - @Override - public Latency latency() throws UnsupportedOperationException { - return latency; - } - - /* (non-Javadoc) - * @see net.sf.ehcache.statisticsV2.extended.ExtendedStatistics.Result#count() - */ - @Override - public Statistic count() { - return count; - } - - /** - * Start. - */ - void start() { - count.start(); - rate.start(); - latency.start(); - } - - /** - * Expire. - * - * @param expiryTime the expiry time - * @return true, if successful - */ - boolean expire(long expiryTime) { - return (count.expire(expiryTime) & rate.expire(expiryTime) & latency.expire(expiryTime)); - } - - /** - * Sets the window. - * - * @param averageNanos the new window - */ - void setWindow(long averageNanos) { - rate.setWindow(averageNanos); - latency.setWindow(averageNanos); - } - - /** - * Sets the history. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void setHistory(int historySize, long historyNanos) { - count.setHistory(historySize, historyNanos); - rate.setHistory(historySize, historyNanos); - latency.setHistory(historySize, historyNanos); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/NotEqualTo.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Map; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * Criteria for plain "not equals to" condition - * - * @author teck - */ -public class NotEqualTo extends EqualTo { - - /** - * Constructor - * - * @param attributeName attribute name - * @param value - */ - public NotEqualTo(String attributeName, Object value) { - super(attributeName, value); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean execute(Element e, Map attributeExtractors) { - return !super.execute(e, attributeExtractors); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/ExplicitlyUnclusteredStandaloneCacheTest.java (revision 0) @@ -1,18 +0,0 @@ -/* - * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import com.tc.test.config.model.TestConfig; - -/** - * @author cdennis - */ -public class ExplicitlyUnclusteredStandaloneCacheTest extends AbstractCacheTestBase { - - public ExplicitlyUnclusteredStandaloneCacheTest(TestConfig testConfig) { - super("explicitly-unclustered-cache-test.xml", testConfig, UnclusteredClient.class, UnclusteredClient.class); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/CountingCacheEntryFactory.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.constructs.blocking; - -import net.sf.ehcache.Element; - -import java.util.Random; - -/** - * A cache entry factory that counts the number of entries it has created. - * - * This is useful for writing tests. - * - * @author Greg Luck - * @version $Id: CountingCacheEntryFactory.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public class CountingCacheEntryFactory implements UpdatingCacheEntryFactory { - - private int count; - private final Object value; - private Random random; - - /** - * Creates a new instance - * - * @param value the factory always creates values equal to this value - */ - public CountingCacheEntryFactory(final Object value) { - this.value = value; - random = new Random(); - } - - /** - * Fetches an entry. - */ - public Object createEntry(final Object key) { - count++; - if (random.nextInt(2) == 1) { - return value; - } else { - return new Element(key, value); - } - } - - /** - * @return number of entries the factory has created. - */ - public int getCount() { - return count; - } - - /** - * Perform an incremental update of data within a CacheEntry. - * Based on identification of dirty values within a CacheEntry - * Insert Update or Delete those entries based on the existing value. - * - * This method does not return a modified value, because it modifies the value passed into it, relying - * on the pass by reference feature of Java. - * - * Implementations of this method must be thread safe. - * - * @param key the cache Key - * @param value a value copied from the value that belonged to the Element in the cache. Value must be mutable - * @throws Exception - */ - public void updateEntryValue(Object key, Object value) throws Exception { - count++; - if (key.equals("explode") && count > 1) { - throw new RuntimeException("EXPLODE!"); - } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 0) @@ -1,425 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 0) @@ -1,300 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.junit.Assert; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.ToolkitFactory; -import org.terracotta.toolkit.ToolkitInstantiationException; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; -import org.terracotta.toolkit.concurrent.atomic.ToolkitAtomicLong; - -import com.tc.test.config.model.TestConfig; - -import java.util.Calendar; -import java.util.Properties; -import java.util.concurrent.BrokenBarrierException; - -public class CacheEventualConsistencyTest extends AbstractCacheTestBase { - - - public CacheEventualConsistencyTest(TestConfig testConfig) { - super("eventual-cache-explicit-locking-test.xml", testConfig, TestClient.class, TestClient.class); - testConfig.addTcProperty("seda.receive_invalidate_objects_stage.sleepMs", "60000"); - - } - - public static class TestClient extends ClientBase { - - private static final String QWERTY = "qwerty"; - private static final String INTIAL_VALUE = "init_"; - private static final String PREFIX_COUNTER = "_updated"; - private static final String BARRIER_NAME = "eventual-cache-explicit-locking-barrier"; - private static final int CLIENT_COUNT = 2; - private static final int UPDATE_LIMIT = 6; // Test Case Runs - private static final int NUM_ELEMENTS = 2; // Number of keys updated - - public TestClient(String[] args) { - super("eventualConsistencyCache", args); - } - - @Override - protected Toolkit createToolkit() { - try { - Properties properties = new Properties(); - properties.put("rejoin", true); - properties.put("nonstop-terracotta", false); - return ToolkitFactory.createToolkit(getTerracottaTypeSubType() + getTerracottaUrl(), properties); - } catch (ToolkitInstantiationException e) { - throw new RuntimeException(e); - } - } - - @Override - protected void runTest(Cache cache, Toolkit toolkit) throws Throwable { - try { - Toolkit internaltoolkit = createToolkit(); - ToolkitBarrier barrier = internaltoolkit.getBarrier(BARRIER_NAME, CLIENT_COUNT); - int index = barrier.await(); - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, INTIAL_VALUE); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets"); - doEventualGets(cache); - } - barrier.await(); - passForEventualCache(cache, barrier, index, internaltoolkit); - } finally { - System.err.println("Text Completed"); - } - } - - private void passForEventualCache(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit) - throws InterruptedException, - BrokenBarrierException { - long runCounter = 0; - long runsLimit = UPDATE_LIMIT; - runCounter = runsForEventualPutsNGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 2; - runCounter = runsForStrongPutNEventualGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 3; - // runCounter = runsForEventualPutsNStrongGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - // runsLimit = UPDATE_LIMIT * 4; - runCounter = runsForStrongPutsNStrongGets(cache, barrier, index, runCounter, runsLimit); - } - - private long runsForStrongPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, long runCounter, - long runsLimit) throws InterruptedException, BrokenBarrierException { - while (runCounter < runsLimit) { - testExplicitStrongPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER); - } - return runCounter; - } - - private long runsForEventualPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, - Toolkit internaltoolkit, long runCounter, long runsLimit) - throws InterruptedException, - BrokenBarrierException { - testStrongGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForStrongPutNEventualGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testStrongPuts(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testEventualPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - - private void testExplicitStrongPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - doExplicitStrongGets(cache, prefix); - } - barrier.await(); - } - - private void testStrongPuts(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit toolkitInternal) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - failEventualGets(cache, prefix, toolkitInternal); - } - barrier.await(); - } - - private void testStrongGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - logTimeStart(); - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, prefix); - logTimeEnd(); - } - barrier.await(); - if (index > 0) { - logTimeStart(); - failExplicitStrongGets(cache, prefix, internaltoolkit); - logTimeEnd(); - } - barrier.await(); - } - - private void logTimeStart() { - System.out.println("XS:-" + Calendar.getInstance().getTime()); - } - - private void logTimeEnd() { - System.out.println("XE:-" + Calendar.getInstance().getTime()); - } - - private void testEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..." + prefix); - doEventualPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets..." + prefix); - failEventualGets(cache, prefix, internaltoolkit); - } - barrier.await(); - } - - private void doEventualPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.put(getElement(i, prefix)); - } - } - - private void doEventualGets(Cache cache) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.get(getKey(i)); - } - } - - private void doExplicitStrongPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.acquireWriteLockOnKey(getKey(i)); - try { - cache.put(getElement(i, prefix)); - } finally { - cache.releaseWriteLockOnKey(getKey(i)); - } - } - } - - private void doExplicitStrongGets(Cache cache, final String prefix) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - Assert.assertTrue(result); - } - - // ** Always called by Client with index > 0; - private void failExplicitStrongGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - if (!eq) { - System.out.println("HHHH Failed"); - } - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - // ** Always called by Client with index > 0; - private void failEventualGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - private void assertOnEventualFailures(Toolkit internaltoolkit) { - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - long evenutalRuns = atomicLong.longValue(); - Assert.assertTrue(evenutalRuns > 0); - atomicLong.set(0); - } - - private Element getElement(int i, String valPrefix) { - return new Element(getKey(i), getValue(i, valPrefix)); - } - - private String getValue(int i, String valPrefix) { - return valPrefix + "val_" + i; - } - - private String getKey(int i) { - return "key_" + i; - } - - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 0) @@ -1,98 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import net.sf.ehcache.config.generator.model.NodeAttribute; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueFactory; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueType; - -public class StandaloneEntryBasedConfigAttributesValueFactory implements XSDAttributeValueFactory { - - public String createValueForAttribute(NodeElement element, NodeAttribute attribute, XSDAttributeValueType xsdAttributeValueType) { - if ("terracotta".equals(element.getName())) { - if("coherent".equals(attribute.getName())) { - // returning null will skip this attribute - // can skip "coherent" attribute as its deprecated by consistency attribute - return null; - } - if("clustered".equals(attribute.getName())) { - return "false"; - } - } - if ("pinning".equals(element.getName())) { - if ("storage".equals(attribute.getName())) { - return "inMemory"; - } - } - if ("sizeOfPolicy".equals(element.getName())) { - if ("maxDepth".equals(attribute.getName())) { - return "100"; - } else if ("maxDepthExceededBehavior".equals(attribute.getName())) { - return "continue"; - } - } - // always generate with eternal=false - if ("defaultCache".equals(element.getName()) || "cache".equals(element.getName())) { - if("eternal".equals(attribute.getName())) { - return "false"; - } - if("transactionalMode".equals(attribute.getName())) { - return "off"; - } - // these are deprecated - if ("maxElementsInMemory".equals(attribute.getName()) || - "maxMemoryOffHeap".equals(attribute.getName()) || - "diskPersistent".equals(attribute.getName()) || - "overflowToDisk".equals(attribute.getName())) { - return null; - } - if ("maxElementsOnDisk".equals(attribute.getName()) || - "maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - if("maxEntriesLocalHeap".equals(attribute.getName()) || - "maxEntriesLocalOffHeap".equals(attribute.getName()) || - "maxEntriesLocalDisk".equals(attribute.getName())) { - return "10000"; - } - if("maxEntriesInCache".equals(attribute.getName())) { - return null; - } - } - if ("ehcache".equals(element.getName())) { - if("maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - } - if ("searchAttribute".equals(element.getName())) { - if ("expression".equals(attribute.getName())) { - return "value.toString()"; - } else if ("name".equals(attribute.getName())) { - return "name"; - } else { - return null; - } - } - - return xsdAttributeValueType.getRandomAllowedValue(); - } -} Index: rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 0) @@ -1,11 +0,0 @@ -@echo off - -rem All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - -cd "%~d0%~p0" -for /f "tokens=*" %%a in ('call relative-paths.bat tc_install_dir') do set tc_install_dir=%%a -pushd -cd %tc_install_dir% -set tc_install_dir=%CD% -popd -call "%tc_install_dir%\bin\stop-tc-server.bat" Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 0) @@ -1,52 +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 NoTcConfigStandaloneCacheTest extends AbstractCacheTestBase { - - public NoTcConfigStandaloneCacheTest(TestConfig testConfig) { - super("no-tcconfig-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; - boolean cacheException = false; - boolean tcConfig = false; - try { - fr = new FileReader(output); - BufferedReader reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - if (st.contains("CacheException")) cacheException = true; - if (st.contains("")) tcConfig = true; - } - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - } catch (Exception e) { - // - } - } - - if (!cacheException) { throw new AssertionError("Expected Exception"); } - - if (!tcConfig) { throw new AssertionError("Expected "); } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 0) @@ -1,113 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; -import net.sf.ehcache.config.MemoryUnit; -import net.sf.ehcache.config.PersistenceConfiguration; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.terracotta.test.categories.CheckShorts; - -import java.util.Arrays; -import java.util.Collection; - -@Category(CheckShorts.class) -@RunWith(Parameterized.class) -public class CacheCopyOnRwReplaceRemoveTest { - - public static final String MEMORY_CACHE = "memoryCache"; - public static final String DISK_CACHE = "diskCache"; - - @Parameters(name = "copyOnRead:{0}, copyOnWrite:{1}") - public static Collection data() { - Object[][] data = new Object[][] { { true, false }, { false, true }, { true, true } }; - return Arrays.asList(data); - } - - private final boolean copyOnRead; - private final boolean copyOnWrite; - - private CacheManager cacheManager; - - public CacheCopyOnRwReplaceRemoveTest(boolean copyOnRead, boolean copyOnWrite) { - this.copyOnRead = copyOnRead; - this.copyOnWrite = copyOnWrite; - } - - @Before - public void setUp() throws Exception { - cacheManager = CacheManager.create( new Configuration() - .name("copyOnRWReplaceRemoveManager") - .diskStore(new DiskStoreConfiguration().path(System.getProperty("java.io.tmpdir"))) - .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES) - .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES)); - cacheManager.addCache(new Cache(new CacheConfiguration().name(MEMORY_CACHE) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - cacheManager.addCache(new Cache(new CacheConfiguration().name(DISK_CACHE) - .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - @Test - public void testMemoryCache() throws Exception { - Ehcache cache = cacheManager.getCache(MEMORY_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - @Test - public void testDiskCache() throws Exception { - Ehcache cache = cacheManager.getCache(DISK_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - private void testReplaceElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - String nextValue = value + "1"; - Assert.assertTrue(cache.replace(new Element(new Long(key), new String(value)), new Element(new Long(key), new String(nextValue)))); - } - - private void testRemoveElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - Assert.assertTrue(cache.removeElement(new Element(new Long(key), new String(value)))); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 0) @@ -1,27 +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.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopReadTimeoutBehavior; -import org.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopWriteTimeoutBehavior; - -public class ToolkitNonStopExceptionOnTimeoutConfiguration extends ToolkitNonStopConfiguration { - - public ToolkitNonStopExceptionOnTimeoutConfiguration(NonstopConfiguration ehcacheNonStopConfig) { - super(ehcacheNonStopConfig); - } - - @Override - public NonStopReadTimeoutBehavior getReadOpNonStopTimeoutBehavior() { - return NonStopReadTimeoutBehavior.EXCEPTION; - } - - @Override - public NonStopWriteTimeoutBehavior getWriteOpNonStopTimeoutBehavior() { - return NonStopWriteTimeoutBehavior.EXCEPTION; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 0) @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 0) @@ -1,67 +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.SizeOfPolicyConfiguration; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * Element representing the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @author Ludovic Orban - * - */ -public class SizeOfPolicyConfigurationElement extends SimpleNodeElement { - private final SizeOfPolicyConfiguration sizeOfPolicyConfiguration; - - /** - * Construtor accepting the parent and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param parent - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(ConfigurationElement parent, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(parent, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - /** - * Construtor accepting the element and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param element - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(NodeElement element, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(element, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - private void init() { - if (sizeOfPolicyConfiguration == null) { - return; - } - addAttribute(new SimpleNodeAttribute("maxDepth", sizeOfPolicyConfiguration.getMaxDepth()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH)); - addAttribute(new SimpleNodeAttribute("maxDepthExceededBehavior", sizeOfPolicyConfiguration.getMaxDepthExceededBehavior()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR)); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 0) @@ -1,33 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.txns; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.test.util.TestBaseUtil; - -import bitronix.tm.TransactionManagerServices; - -import com.tc.test.config.model.TestConfig; - -import java.util.ArrayList; -import java.util.List; - -public class TwoResourceBTMXATest extends AbstractCacheTestBase { - - public TwoResourceBTMXATest(TestConfig testConfig) { - super("two-resource-xa-test.xml", testConfig, BTMTwoResourceTx1.class, BTMTwoResourceTx2.class); - testConfig.getClientConfig().setParallelClients(true); - - // DEV-3930 - // disableAllUntil("2010-03-31"); - } - - @Override - protected List getExtraJars() { - List extraJars = new ArrayList(); - extraJars.add(TestBaseUtil.jarFor(TransactionManagerServices.class)); - return extraJars; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 0) @@ -1,35 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.transaction; - -/** - * A factory of soft-locks supporting a specific isolation level. - * - * @author Chris Dennis - */ -public interface SoftLockFactory { - - /** - * Construct a new softlock to be managed by the given manager for a specific key. - * - * @param manager soft lock manager - * @param key key to generate against - * @return a new soft lock - */ - SoftLock newSoftLock(SoftLockManager manager, Object key); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 0) @@ -1,46 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.terracotta.upgradability.serialization; - -import java.io.IOException; -import java.util.Comparator; - -import net.sf.ehcache.Element; -import net.sf.ehcache.NonEternalElementData; -import org.junit.Test; - -import static org.terracotta.upgradability.serialization.SerializationUpgradabilityTesting.validateSerializedForm; - -/** - * - * @author cdennis - */ -public class NonEternalElementDataSerializationTest { - - private static final Comparator COMPARATOR = new Comparator() { - - @Override - public int compare(NonEternalElementData o1, NonEternalElementData o2) { - return ElementSerializationTest.COMPARATOR.compare(o1.createElement("foo"), o2.createElement("foo")); - } - }; - - @Test - public void testBasic() throws IOException, ClassNotFoundException { - validateSerializedForm(new NonEternalElementData(new Element("foo", "bar", 1000L, 2000L, 3000L, 4000L, false, 5000, 6000, 7000L)), COMPARATOR, "serializedforms/NonEternalElementDataSerializationTest.testBasic.ser"); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 0) @@ -1,159 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.lifecycle; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.ConfigurationFactory; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.mockito.Mockito; -import org.objenesis.ObjenesisStd; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.TestBaseUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.test.config.model.TestConfig; -import com.terracotta.entity.ClusteredEntityManager; -import com.terracotta.entity.ehcache.ClusteredCacheManager; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -public class CacheManagerDestroyCrashTest extends AbstractCacheTestBase { - private static final String CACHE_NAME = "cache1"; - - public CacheManagerDestroyCrashTest(TestConfig testConfig) { - super("lifecycle/cache-destroy.xml", testConfig, CacheManagerCreateClient.class, - CacheManagerEntityDestroyCrashClient.class); - } - - @Override - protected String createClassPath(Class client) throws IOException { - String classpath = super.createClassPath(client); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(Mockito.class)); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(ObjenesisStd.class)); - return classpath; - } - - public static class CacheManagerCreateClient extends ClientBase { - - public CacheManagerCreateClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - - CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, 100) - .terracotta(new TerracottaConfiguration()); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - cache.put(new Element("key", "value", true)); - - cacheManager.shutdown(); - - // Notify client to destroy - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 1 - - // Waiting for other client to signal destroy done - getBarrierForAllClients().await(1, TimeUnit.MINUTES); // hit 2 - - // Making sure adding back cache does not resurrect old data structures - setupCacheManager(); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - assertNull(cache.get("key")); - } - - @Override - protected Cache getCache() { - return null; - } - - } - - public static class CacheManagerEntityDestroyCrashClient extends ClientBase { - - public CacheManagerEntityDestroyCrashClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - // Waiting for CM to be created - - waitForAllClients(); // hit 1 - - Toolkit spiedToolkit = spy(getClusteringToolkit()); - - ClusteredEntityManager clusteredEntityManager1 = new ClusteredEntityManager(spiedToolkit); - Configuration configuration = ConfigurationFactory.parseConfiguration(getEhcacheXmlAsStream()); - String cmName = configuration.getName(); - - Map cacheManagers = clusteredEntityManager1 - .getRootEntities(ClusteredCacheManager.class); - - ClusteredCacheManager clusteredCacheManager = cacheManagers.get(cmName); - - while(clusteredCacheManager.isUsed()) { - TimeUnit.MILLISECONDS.sleep(200); - } - - - doThrow(new TestDestroyCrashException("Crashing destroy")) - .when(spiedToolkit) - .getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - try { - clusteredEntityManager1.destroyRootEntity(cmName, ClusteredCacheManager.class, clusteredCacheManager); - fail("Destroy should have thrown an exception"); - } catch(TestDestroyCrashException e) { - // Expected as we want destroy to crash - e.printStackTrace(); - } - reset(spiedToolkit); - - clusteredEntityManager1.getRootEntity(cmName, ClusteredCacheManager.class); - // Shows inline clean up performed - verify(spiedToolkit).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - reset(spiedToolkit); - - ClusteredEntityManager clusteredEntityManager2 = new ClusteredEntityManager(spiedToolkit); - assertNull(clusteredEntityManager2.getRootEntity(cmName, ClusteredCacheManager.class)); - - verify(spiedToolkit, never()).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 2 - } - - @Override - protected void setupCacheManager() { - // Do nothing here - } - - @Override - protected Cache getCache() { - // Do nothing here - return null; - } - } - - public static class TestDestroyCrashException extends RuntimeException { - public TestDestroyCrashException(String msg) { - super(msg); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 0) @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import net.sf.ehcache.management.resource.CacheConfigEntity; -import net.sf.ehcache.management.sampled.CacheManagerSampler; -import org.terracotta.management.resource.AgentEntity; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * @author brandony - */ -final class CacheConfigurationEntityBuilder { - - private final Map samplersByCName = new HashMap(); - - static CacheConfigurationEntityBuilder createWith(CacheManagerSampler sampler, - String cacheName) { - return new CacheConfigurationEntityBuilder(sampler, cacheName); - } - - private CacheConfigurationEntityBuilder(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - } - - CacheConfigurationEntityBuilder add(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - return this; - } - - Collection build() { - Collection cces = new ArrayList(); - - for (Map.Entry entry : samplersByCName.entrySet()) { - CacheConfigEntity cce = new CacheConfigEntity(); - - String cacheName = entry.getKey(); - cce.setCacheName(cacheName); - cce.setAgentId(AgentEntity.EMBEDDED_AGENT_ID); - cce.setVersion(this.getClass().getPackage().getImplementationVersion()); - - CacheManagerSampler sampler = entry.getValue(); - cce.setCacheManagerName(sampler.getName()); - cce.setXml(sampler.generateActiveConfigDeclaration(cacheName)); - - cces.add(cce); - } - - return cces; - } - - private void addSampler(CacheManagerSampler sampler, - String cacheName) { - if (sampler == null) throw new IllegalArgumentException("sampler == null"); - - if (cacheName == null) throw new IllegalArgumentException("cacheName == null"); - - if(!Arrays.asList(sampler.getCacheNames()).contains(cacheName)) { - throw new IllegalArgumentException(String.format("Invalid cache name: %s.", cacheName)); - } - - samplersByCName.put(cacheName, sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 0) @@ -1,45 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.constructs.refreshahead; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.constructs.CacheDecoratorFactory; - -/** - * Cache decorator factory for {@link RefreshAheadCache} instances - * - * @author cschanck - * - */ -public class RefreshAheadCacheFactory extends CacheDecoratorFactory { - - @Override - public Ehcache createDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - - @Override - public Ehcache createDefaultDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 0) @@ -1,50 +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.io.IOException; -import java.io.Serializable; - -/** - * Interface to implement single operations that are performed in the write behind implementation that using an - * AsyncCoordinator underneath - * - * @author Abhishek Maheshwari - */ -public interface SingleAsyncOperation extends Serializable { - /** - * Perform this operation as a single execution with the provided cache writer - * - * @param cacheWriter the cache writer this operation should be performed upon - */ - public void performSingleOperation(CacheWriter cacheWriter) throws ClassNotFoundException, IOException; - - /** - * Retrieves the key for this operation. - * - * @return this operation's key - */ - Object getKey(); - - Element getElement(); - - /** - * Retrieves the moment when the operation was created. - * - * @return the creation time in milliseconds - */ - public long getCreationTime(); - - /** - * This method will be called to throw the item away. - * - * @param cacheWriter - * @param e - */ - void throwAwayElement(CacheWriter cacheWriter, RuntimeException e); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 0) @@ -1,93 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.cluster; - -import java.util.Collection; -import java.util.List; - -/** - * Allows you to explore the Terracotta cluster nodes and register for events about the cluster. - * - * @author Geert Bevin, Abhishek Sanoujam - * @since 2.0 - */ -public interface CacheCluster { - - /** - * Get scheme name for this cluster info. - * - * @return a scheme name for the cluster information. - * Currently TERRACOTTA is the only scheme supported. - */ - ClusterScheme getScheme(); - - /** - * Retrieves the {@code ClusterNode} instance that corresponds to the current node. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode getCurrentNode(); - - /** - * Waits until the current node has successfully joined the cluster. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode waitUntilNodeJoinsCluster(); - - /** - * Get all the nodes in the cluster - * - * @return information on all the nodes in the cluster, including ID, hostname, and IP address. - */ - Collection getNodes(); - - /** - * Find out if the current node is connected to the cluster or not - * - * @return true if cluster is online otherwise false - */ - boolean isClusterOnline(); - - /** - * Add a listener for cluster events - * - * @param listener Listener - * @return True if already listening - */ - boolean addTopologyListener(ClusterTopologyListener listener); - - /** - * Remove a listener for cluster events - * - * @param listener Listener - * @return True if not listening - */ - boolean removeTopologyListener(ClusterTopologyListener listener); - - /** - * Removes all listeners for cluster events - */ - void removeAllListeners(); - - /** - * Get all the topology listeners - * - * @return a list of all the topology listeners - */ - List getTopologyListeners(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 0) @@ -1,77 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.impl; - -import java.util.Map; - -import net.sf.ehcache.store.StoreQuery; - -/** - * Result implementation - * - * @author teck - */ -public class ResultImpl extends BaseResult { - - private final Object key; - private final Object value; - private final Map attributes; - private final Object[] sortAttributes; - - /** - * Constructor - * - * @param key - * @param value - * @param query - * @param attributes - * @param sortAttributes - */ - public ResultImpl(Object key, Object value, StoreQuery query, Map attributes, Object[] sortAttributes) { - super(query); - this.key = key; - this.value = value; - this.attributes = attributes; - this.sortAttributes = sortAttributes; - } - - /** - * Get attribute value for use in sorting - * - * @param pos - * @return - */ - Object getSortAttribute(int pos) { - return sortAttributes[pos]; - } - - @Override - protected Object basicGetKey() { - return key; - } - - @Override - protected Object basicGetValue() { - return value; - } - - @Override - protected Object basicGetAttribute(String name) { - return attributes.get(name); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 0) @@ -1,151 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.FeaturesManager; -import net.sf.ehcache.terracotta.ClusteredInstanceFactory; -import net.sf.ehcache.terracotta.TerracottaClient; -import net.sf.ehcache.transaction.xa.XidTransactionID; - -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -import javax.transaction.xa.Xid; - -/** - * A TransactionIDFactory implementation with delegates calls to either a clustered - * or non-clustered factory - * - * @author Ludovic Orban - */ -public class DelegatingTransactionIDFactory implements TransactionIDFactory { - - private final FeaturesManager featuresManager; - private final TerracottaClient terracottaClient; - private final String cacheManagerName; - private volatile ClusteredInstanceFactory clusteredInstanceFactory; - private volatile AtomicReference transactionIDFactory = new AtomicReference(); - - /** - * Create a new DelegatingTransactionIDFactory - * - * @param terracottaClient a terracotta client - * @param cacheManagerName the name of the cache manager which creates this. - */ - public DelegatingTransactionIDFactory(FeaturesManager featuresManager, TerracottaClient terracottaClient, String cacheManagerName) { - this.featuresManager = featuresManager; - this.terracottaClient = terracottaClient; - this.cacheManagerName = cacheManagerName; - } - - private TransactionIDFactory get() { - ClusteredInstanceFactory cif = terracottaClient.getClusteredInstanceFactory(); - if (cif != null && cif != this.clusteredInstanceFactory) { - this.transactionIDFactory.set(cif.createTransactionIDFactory(UUID.randomUUID().toString(), cacheManagerName)); - this.clusteredInstanceFactory = cif; - } - - if (transactionIDFactory.get() == null) { - TransactionIDFactory constructed; - if (featuresManager == null) { - constructed = new TransactionIDFactoryImpl(); - } else { - constructed = featuresManager.createTransactionIDFactory(); - } - if (transactionIDFactory.compareAndSet(null, constructed)) { - return constructed; - } else { - return transactionIDFactory.get(); - } - } else { - return transactionIDFactory.get(); - } - } - - /** - * {@inheritDoc} - */ - public TransactionID createTransactionID() { - return get().createTransactionID(); - } - - /** - * {@inheritDoc} - */ - public TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm) { - return get().restoreTransactionID(serializedForm); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID createXidTransactionID(Xid xid, Ehcache cache) { - return get().createXidTransactionID(xid, cache); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm) { - return get().restoreXidTransactionID(serializedForm); - } - - @Override - public void markForCommit(TransactionID transactionID) { - get().markForCommit(transactionID); - } - - @Override - public void markForRollback(XidTransactionID transactionID) { - get().markForRollback(transactionID); - } - - @Override - public boolean isDecisionCommit(TransactionID transactionID) { - return get().isDecisionCommit(transactionID); - } - - @Override - public void clear(TransactionID transactionID) { - get().clear(transactionID); - } - - @Override - public Set getAllXidTransactionIDsFor(Ehcache cache) { - return get().getAllXidTransactionIDsFor(cache); - } - - @Override - public Set getAllTransactionIDs() { - return get().getAllTransactionIDs(); - } - - @Override - public boolean isExpired(TransactionID transactionID) { - return get().isExpired(transactionID); - } - - @Override - public Boolean isPersistent() { - if (transactionIDFactory.get() == null) { - return null; - } else { - return get().isPersistent(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 0) @@ -1,55 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; - -public class ConfigurationGeneratedParsesTest { - - private static final String[] TEST_CONFIGS = new String[] { - "ehcache.xml", - "ehcache-big.xml", - "ehcache-cacheextension.xml", - "ehcache-comparator.xml", - "ehcache-countinglisteners.xml", - "ehcache-search.xml", - "ehcache-tx-local.xml", - "ehcache-tx-twopc.xml", - "ehcache-writer.xml", - "ehcacheUTF8.xml", - }; - - @Test - public void testGeneratedConfigIsValid() throws CacheException, UnsupportedEncodingException { - for (String config : TEST_CONFIGS) { - String generatedConfig; - CacheManager manager = new CacheManager(ConfigurationGeneratedParsesTest.class.getClassLoader().getResource(config)); - try { - generatedConfig = manager.getActiveConfigurationText(); - } finally { - manager.shutdown(); - } - new CacheManager(new ByteArrayInputStream(generatedConfig.getBytes("UTF-8"))).shutdown(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 0) @@ -1,31 +0,0 @@ -package net.sf.ehcache.store; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.MemoryStorePerfTester; -import org.junit.Test; - -/** - * @author Alex Snaps - */ -public class LruMemoryStorePerfTest extends MemoryStorePerfTester { - - @Override - protected Cache createCache() throws CacheException { - return new Cache("LruMemoryStorePerfTest", 12000, MemoryStoreEvictionPolicy.FIFO, false, System.getProperty("java.io.tmpdir"), - true, 60, 30, false, 60, null); - } - - /** - * Benchmark to test speed. This uses both memory and disk and tries to be realistic - * v 1.38 DiskStore 7355 - * v 1.41 DiskStore 1609 - * Adjusted for change to laptop - */ - @Test - public void testBenchmarkPutGetSurya() throws Exception { - benchmarkPutGetSuryaTest(2500); - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 0) @@ -1,364 +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.cachingtier; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.AbstractCacheConfigurationListener; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.pool.Pool; -import net.sf.ehcache.pool.Size; -import net.sf.ehcache.pool.SizeOfEngine; -import net.sf.ehcache.pool.SizeOfEngineLoader; -import net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf; -import net.sf.ehcache.store.CachingTier; -import net.sf.ehcache.store.FifoPolicy; -import net.sf.ehcache.store.LfuPolicy; -import net.sf.ehcache.store.LruPolicy; -import net.sf.ehcache.store.MemoryStoreEvictionPolicy; -import net.sf.ehcache.store.Policy; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CopyOnWriteArrayList; -import net.sf.ehcache.store.StoreOperationOutcomes.GetOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.PutOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.RemoveOutcome; -import org.terracotta.context.annotations.ContextChild; -import org.terracotta.statistics.Statistic; -import org.terracotta.statistics.observer.OperationObserver; - -import static net.sf.ehcache.statistics.StatisticBuilder.operation; - -/** - * An instance of this class will delegate the storage to the backing HeapCacheBackEnd. - * Adding : - * - * making sure only a single thread populates the cache for a given key at a time - * translate calls to the eviction listeners - * Add all the crap about sizing and stuff - * - * - * @param The key type - * @param the value type - * @author Alex Snaps - */ -public class OnHeapCachingTier implements CachingTier { - - @ContextChild - private final HeapCacheBackEnd backEnd; - - private final OperationObserver getObserver = operation(GetOutcome.class).named("get").of(this).tag("local-heap").build(); - private final OperationObserver putObserver = operation(PutOutcome.class).named("put").of(this).tag("local-heap").build(); - private final OperationObserver removeObserver = operation(RemoveOutcome.class).named("remove").of(this).tag("local-heap").build(); - - - private volatile List> listeners = new CopyOnWriteArrayList>(); - - /** - * A Constructor - * - * @param backEnd the HeapCacheBackEnd that will back this CachingTier - */ - public OnHeapCachingTier(final HeapCacheBackEnd backEnd) { - this.backEnd = backEnd; - this.backEnd.registerEvictionCallback(new HeapCacheBackEnd.EvictionCallback() { - @Override - public void evicted(final K key, final Object value) { - final V v = getValue(value); - if (v != null) { - for (Listener listener : listeners) { - listener.evicted(key, v); - } - } - } - }); - } - - /** - * Factory method - * @param cache the cache we're planning to back - * @param onHeapPool the pool, if any, to use - * @return the OnHeapCachingTier properly configured for this cache - */ - public static OnHeapCachingTier createOnHeapCache(final Ehcache cache, final Pool onHeapPool) { - final HeapCacheBackEnd memCacheBackEnd; - final Policy memoryEvictionPolicy = determineEvictionPolicy(cache); - if (cache.getCacheConfiguration().isCountBasedTuned()) { - final long maxEntriesLocalHeap = getCachingTierMaxEntryCount(cache); - final CountBasedBackEnd countBasedBackEnd = - new CountBasedBackEnd(maxEntriesLocalHeap, memoryEvictionPolicy); - memCacheBackEnd = countBasedBackEnd; - cache.getCacheConfiguration().addConfigurationListener(new AbstractCacheConfigurationListener() { - @Override - public void memoryCapacityChanged(final int oldCapacity, final int newCapacity) { - countBasedBackEnd.setMaxEntriesLocalHeap(newCapacity); - } - }); - } else { - final PooledBasedBackEnd pooledBasedBackEnd = new PooledBasedBackEnd(memoryEvictionPolicy); - - pooledBasedBackEnd.registerAccessor( - onHeapPool.createPoolAccessor(new PooledBasedBackEnd.PoolParticipant(pooledBasedBackEnd), - SizeOfPolicyConfiguration.resolveMaxDepth(cache), - SizeOfPolicyConfiguration.resolveBehavior(cache) - .equals(SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT))); - - memCacheBackEnd = pooledBasedBackEnd; - } - - return new OnHeapCachingTier( - memCacheBackEnd); - } - - /** - * Chooses the Policy from the cache configuration - * - * @param cache the cache - * @return the chosen eviction policy - */ - static Policy determineEvictionPolicy(Ehcache cache) { - MemoryStoreEvictionPolicy policySelection = cache.getCacheConfiguration().getMemoryStoreEvictionPolicy(); - - if (policySelection.equals(MemoryStoreEvictionPolicy.LRU)) { - return new LruPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.FIFO)) { - return new FifoPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.LFU)) { - return new LfuPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.CLOCK)) { - return new LruPolicy(); - } - - throw new IllegalArgumentException(policySelection + " isn't a valid eviction policy"); - } - - - private static long getCachingTierMaxEntryCount(final Ehcache cache) { - final PinningConfiguration pinningConfiguration = cache.getCacheConfiguration().getPinningConfiguration(); - if (pinningConfiguration != null && pinningConfiguration.getStore() != PinningConfiguration.Store.INCACHE) { - return 0; - } - return cache.getCacheConfiguration().getMaxEntriesLocalHeap(); - } - - @Override - public boolean loadOnPut() { - return backEnd.hasSpace(); - } - - @Override - public V get(final K key, final Callable source, final boolean updateStats) { - if (updateStats) { getObserver.begin(); } - Object cachedValue = backEnd.get(key); - if (cachedValue == null) { - if (updateStats) { getObserver.end(GetOutcome.MISS); } - Fault f = new Fault(source); - cachedValue = backEnd.putIfAbsent(key, f); - if (cachedValue == null) { - try { - V value = f.get(); - putObserver.begin(); - if (value == null) { - backEnd.remove(key, f); - } else if (backEnd.replace(key, f, value)) { - putObserver.end(PutOutcome.ADDED); - } else { - V p = getValue(backEnd.remove(key)); - return p == null ? value : p; - } - return value; - } catch (Throwable e) { - backEnd.remove(key, f); - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } else { - throw new CacheException(e); - } - } - } - } else { - if (updateStats) { getObserver.end(GetOutcome.HIT); } - } - - return getValue(cachedValue); - } - - @Override - public V remove(final K key) { - removeObserver.begin(); - try { - return getValue(backEnd.remove(key)); - } finally { - removeObserver.end(RemoveOutcome.SUCCESS); - } - } - - @Override - public void clear() { - backEnd.clear(false); - } - - @Override - public void clearAndNotify() { - backEnd.clear(true); - } - - @Override - public void addListener(final Listener listener) { - if (listener == null) { - throw new NullPointerException("Listener can't be null!"); - } - listeners.add(listener); - } - - @Statistic(name = "size", tags = "local-heap") - @Override - public int getInMemorySize() { - return backEnd.size(); - } - - @Override - public int getOffHeapSize() { - return 0; - } - - @Override - public boolean contains(final K key) { - return backEnd.get(key) != null; - } - - @Statistic(name = "size-in-bytes", tags = "local-heap") - @Override - public long getInMemorySizeInBytes() { - long sizeInBytes; - if (backEnd instanceof PooledBasedBackEnd, ?>) { - sizeInBytes = ((PooledBasedBackEnd)backEnd).getSizeInBytes(); - } else { - SizeOfEngine defaultSizeOfEngine = SizeOfEngineLoader.newSizeOfEngine( - SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH, - SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR == SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT, - true - ); - sizeInBytes = 0; - for (Map.Entry entry : backEnd.entrySet()) { - // This could leak Fault values... We ignore these entirely - if (entry.getValue() != null && entry.getValue() instanceof Element) { - Element element = (Element)entry.getValue(); - // TODO this is a lie here! Should we add a dedicated method to BackEnd to return a container ? - Size size = defaultSizeOfEngine.sizeOf(element.getObjectKey(), element, null); - sizeInBytes += size.getCalculated(); - } - } - } - return sizeInBytes; - } - - @Override - public long getOffHeapSizeInBytes() { - return 0; - } - - @Override - public long getOnDiskSizeInBytes() { - return 0; - } - - @Override - public void recalculateSize(final K key) { - backEnd.recalculateSize(key); - } - - @Override - public Policy getEvictionPolicy() { - return backEnd.getPolicy(); - } - - @Override - public void setEvictionPolicy(final Policy policy) { - backEnd.setPolicy(policy); - } - - private V getValue(final Object cachedValue) { - if (cachedValue instanceof Fault) { - return ((Fault)cachedValue).get(); - } else { - return (V)cachedValue; - } - } - - /** - * Document me - * - * @param - */ - @IgnoreSizeOf - private static class Fault { - - private final Callable source; - private V value; - private Throwable throwable; - private boolean complete; - - public Fault(final Callable source) { - this.source = source; - } - - private void complete(V value) { - synchronized (this) { - this.value = value; - this.complete = true; - notifyAll(); - } - } - - private V get() { - synchronized (this) { - if (!complete) { - try { - complete(source.call()); - } catch (Throwable e) { - fail(e); - } - } - } - - return throwOrReturn(); - } - - private V throwOrReturn() { - if (throwable != null) { - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; - } - throw new CacheException("Faulting from repository failed", throwable); - } - return value; - } - - private void fail(final Throwable t) { - synchronized (this) { - this.throwable = t; - this.complete = true; - notifyAll(); - } - throwOrReturn(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - - -import org.terracotta.toolkit.concurrent.locks.ToolkitLock; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -public class LockHolder { - private static final int PARTIES = 2; - private final Map holdings = new HashMap(); - - public synchronized void hold(final ToolkitLock lock) { - if (lock == null || holdings.containsKey(lock)) { return; } - final CyclicBarrier barrier = new CyclicBarrier(PARTIES); - Thread lockThread = new Thread(new Runnable() { - @Override - public void run() { - lock.lock(); - try { - await(barrier); // hit 1 - await(barrier); // hit 2 - } finally { - try { - lock.unlock(); - } catch (Throwable th) { - // ignore any exception in unlock so that thread calling release() is not stuck at barrier.await() - } - await(barrier); // hit 3 - } - } - }); - holdings.put(lock.getName(), barrier); - lockThread.start(); - await(barrier); // hit 1 - } - - public synchronized void release(ToolkitLock lock) { - CyclicBarrier barrier = holdings.get(lock.getName()); - if (barrier != null) { - releaseLock(barrier); - holdings.remove(lock); - } - } - - private void releaseLock(CyclicBarrier barrier) { - await(barrier); // hit 2 - await(barrier); // hit 3 - } - - public synchronized void reset() { - for (CyclicBarrier barrier : holdings.values()) { - releaseLock(barrier); - } - holdings.clear(); - } - - private void await(CyclicBarrier barrier) { - try { - barrier.await(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (BrokenBarrierException e) { - // ignore - } - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 0) @@ -1,14 +0,0 @@ - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.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.pool.sizeof; - -import net.sf.ehcache.util.FindBugsSuppressWarnings; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.net.Proxy; -import java.nio.charset.CodingErrorAction; -import java.util.Collections; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -import javax.xml.datatype.DatatypeConstants; -import javax.xml.namespace.QName; - -/** - * Enum with all the flyweight types that we check for sizeOf measurements - * - * @author Alex Snaps - */ -@FindBugsSuppressWarnings("RC_REF_COMPARISON") -enum FlyweightType { - - /** - * java.lang.Enum - */ - ENUM(Enum.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * java.lang.Class - */ - CLASS(Class.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - // XXX There is no nullipotent way of determining the interned status of a string - // There are numerous String constants within the JDK (see list at http://docs.oracle.com/javase/7/docs/api/constant-values.html), - // but enumerating all of them would lead to lots of == tests. - /** - * java.lang.String - */ - //STRING(String.class) { - // @Override - // boolean isShared(final Object obj) { return obj == ((String)obj).intern(); } - //}, - /** - * java.lang.Boolean - */ - BOOLEAN(Boolean.class) { - @Override - boolean isShared(final Object obj) { return obj == Boolean.TRUE || obj == Boolean.FALSE; } - }, - /** - * java.lang.Integer - */ - INTEGER(Integer.class) { - @Override - boolean isShared(final Object obj) { - int value = ((Integer)obj).intValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Integer.valueOf(value); - } - }, - /** - * java.lang.Short - */ - SHORT(Short.class) { - @Override - boolean isShared(final Object obj) { - short value = ((Short)obj).shortValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Short.valueOf(value); - } - }, - /** - * java.lang.Byte - */ - BYTE(Byte.class) { - @Override - boolean isShared(final Object obj) { return obj == Byte.valueOf((Byte)obj); } - }, - /** - * java.lang.Long - */ - LONG(Long.class) { - @Override - boolean isShared(final Object obj) { - long value = ((Long)obj).longValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Long.valueOf(value); - } - }, - /** - * java.math.BigInteger - */ - BIGINTEGER(BigInteger.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigInteger.ZERO || obj == BigInteger.ONE || obj == BigInteger.TEN; - } - }, - /** - * java.math.BigDecimal - */ - BIGDECIMAL(BigDecimal.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigDecimal.ZERO || obj == BigDecimal.ONE || obj == BigDecimal.TEN; - } - }, - /** - * java.math.MathContext - */ - MATHCONTEXT(MathContext.class) { - @Override - boolean isShared(final Object obj) { - return obj == MathContext.UNLIMITED || obj == MathContext.DECIMAL32 || obj == MathContext.DECIMAL64 || obj == MathContext.DECIMAL128; - } - }, - /** - * java.lang.Character - */ - CHARACTER(Character.class) { - @Override - boolean isShared(final Object obj) { return ((Character)obj).charValue() <= Byte.MAX_VALUE && obj == Character.valueOf((Character)obj); } - }, - /** - * java.lang.Locale - */ - LOCALE(Locale.class) { - @Override - boolean isShared(final Object obj) { - return GLOBAL_LOCALES.contains(obj); - } - }, - /** - * java.util.Logger - */ - LOGGER(Logger.class) { - @Override - @SuppressWarnings("deprecation") - boolean isShared(final Object obj) { return obj == Logger.global; } - }, - /** - * java.net.Proxy - */ - PROXY(Proxy.class) { - @Override - boolean isShared(final Object obj) { return obj == Proxy.NO_PROXY; } - }, - /** - * java.nio.charset.CodingErrorAction - */ - CODINGERRORACTION(CodingErrorAction.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.datatype.DatatypeConstants.Field - */ - DATATYPECONSTANTS_FIELD(DatatypeConstants.Field.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.namespace.QName - */ - QNAME(QName.class) { - @Override - boolean isShared(final Object obj) { - return obj == DatatypeConstants.DATETIME - || obj == DatatypeConstants.TIME - || obj == DatatypeConstants.DATE - || obj == DatatypeConstants.GYEARMONTH - || obj == DatatypeConstants.GMONTHDAY - || obj == DatatypeConstants.GYEAR - || obj == DatatypeConstants.GMONTH - || obj == DatatypeConstants.GDAY - || obj == DatatypeConstants.DURATION - || obj == DatatypeConstants.DURATION_DAYTIME - || obj == DatatypeConstants.DURATION_YEARMONTH; - } - }, - /** - * misc comparisons that can not rely on the object's class. - */ - MISC(Void.class) { - @Override - boolean isShared(final Object obj) { - boolean emptyCollection = obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP; - boolean systemStream = obj == System.in || obj == System.out || obj == System.err; - return emptyCollection || systemStream || obj == String.CASE_INSENSITIVE_ORDER; - } - }; - - private static final Map, FlyweightType> TYPE_MAPPINGS = new HashMap, FlyweightType>(); - static { - for (FlyweightType type : FlyweightType.values()) { - TYPE_MAPPINGS.put(type.clazz, type); - } - } - - private static final Set GLOBAL_LOCALES; - static { - Map locales = new IdentityHashMap(); - for (Field f : Locale.class.getFields()) { - int modifiers = f.getModifiers(); - if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Locale.class.equals(f.getType())) { - try { - locales.put((Locale) f.get(null), null); - } catch (IllegalArgumentException e) { - continue; - } catch (IllegalAccessException e) { - continue; - } - } - } - GLOBAL_LOCALES = locales.keySet(); - } - - private final Class> clazz; - - private FlyweightType(final Class> clazz) { - this.clazz = clazz; - } - - /** - * Whether this is a shared object - * @param obj the object to check for - * @return true, if shared - */ - abstract boolean isShared(Object obj); - - /** - * Will return the Flyweight enum instance for the flyweight Class, or null if type isn't flyweight - * @param aClazz the class we need the FlyweightType instance for - * @return the FlyweightType, or null - */ - static FlyweightType getFlyweightType(final Class> aClazz) { - if (aClazz.isEnum() || (aClazz.getSuperclass() != null && aClazz.getSuperclass().isEnum())) { - return ENUM; - } else { - FlyweightType flyweightType = TYPE_MAPPINGS.get(aClazz); - return flyweightType != null ? flyweightType : MISC; - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 0) @@ -1,38 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to ignore a field, type or entire package while doing a SizeOf measurement - * @see net.sf.ehcache.pool.sizeof.SizeOf - * @author Chris Dennis - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE }) -public @interface IgnoreSizeOf { - - /** - * Controls whether the annotation, when applied to a {@link ElementType#TYPE type} is to be applied to all its subclasses - * as well or solely on that type only. true if inherited by subtypes, false otherwise - */ - boolean inherited() default false; -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 0) @@ -1,125 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.ccs; - -import java.util.Comparator; - -import org.hibernate.cache.CacheException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.hibernate.cache.access.SoftLock; - -/** - * Ehcache specific read-only cache concurrency strategy. - * - * This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache. - * - * @author Chris Dennis - */ -@Deprecated -public class EhcacheReadOnlyCache extends AbstractEhcacheConcurrencyStrategy { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheReadOnlyCache.class); - - /** - * {@inheritDoc} - */ - public Object get(Object key, long timestamp) throws CacheException { - return cache.get(key); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public SoftLock lock(Object key, Object version) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - public boolean put(Object key, Object value, long timestamp, Object version, - Comparator versionComparator, boolean minimalPut) throws CacheException { - if (minimalPut && cache.get(key) != null) { - return false; - } else { - cache.put(key, value); - return true; - } - } - - /** - * Logs an error since items in a read-only cache should not be mutated. - */ - public void release(Object key, SoftLock lock) { - LOG.error("Application attempted to edit read only item: " + key); - //throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Inserts the specified item into the cache. - */ - public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - cache.update(key, value); - return true; - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public void evict(Object key) throws CacheException { - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public boolean insert(Object key, Object value, Object currentVersion) { - return false; - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return cache + "(read-only)"; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 0) @@ -1,163 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * A regular expression criteria that matches attribute string values. For non java.lang.String attributes, - * the toString() form is used in the comparison. - * - * Expressions are always case insensitive - * - * The following special characters are supported: - * - * '?' - match any one single character - * '*' - match any multiple character(s) (including zero) - * - * The supported wildcard characters can be escaped with a backslash '\', and a literal backslash can be included with '\\' - * - * WARN: Expressions starting with a leading wildcard character are potentially very expensive (ie. full scan) for indexed caches - * - * - * @author teck - */ -public class ILike extends BaseCriteria { - - private final String attributeName; - private final String regex; - private final Pattern pattern; - - /** - * Construct a "like" criteria for the given expression - * - * @param attributeName attribute name - * @param regex expression - */ - public ILike(String attributeName, String regex) { - if ((attributeName == null) || (regex == null)) { - throw new SearchException("Both the attribute name and regex must be non null."); - } - - this.attributeName = attributeName; - this.regex = regex; - this.pattern = convertRegex(regex.trim()); - } - - /** - * Return attribute name. - * - * @return String attribute name - */ - public String getAttributeName() { - return attributeName; - } - - /** - * Return regex string. - * - * @return String regex. - */ - public String getRegex() { - return regex; - } - - private static Pattern convertRegex(final String expr) { - if (expr.length() == 0) { - throw new SearchException("Zero length regex"); - } - - StringBuilder javaRegex = new StringBuilder("^"); - - boolean escape = false; - for (int i = 0; i < expr.length(); i++) { - char ch = expr.charAt(i); - - if (escape) { - switch (ch) { - case '\\': - case '?': - case '*': { - javaRegex.append(Pattern.quote(lowerCase(ch))); - break; - } - - default: { - throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr); - } - } - - escape = false; - } else { - switch (ch) { - case '\\': { - escape = true; - break; - } - case '?': { - javaRegex.append("."); - break; - } - case '*': { - javaRegex.append(".*"); - break; - } - default: { - javaRegex.append(Pattern.quote(lowerCase(ch))); - } - } - } - } - - javaRegex.append("$"); - - return Pattern.compile(javaRegex.toString(), Pattern.DOTALL); - } - - private static String lowerCase(char ch) { - // heeding the advice in Character.toLowerCase() and using String.toLowerCase() instead here - return Character.toString(ch).toLowerCase(); - } - - /** - * {@inheritDoc} - */ - public boolean execute(Element e, Map attributeExtractors) { - Object value = getExtractor(attributeName, attributeExtractors).attributeFor(e, attributeName); - if (value == null) { - return false; - } - - String asString = value.toString().toLowerCase(); - - return pattern.matcher(asString).matches(); - } - - @Override - public Set> getAttributes() { - return Collections.>singleton(new Attribute(attributeName)); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 0) @@ -1,24 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; - -public class KeyBasedOperationWrapper implements KeyBasedOperation { - private final Object key; - private final long creationTime; - - public KeyBasedOperationWrapper(Object key, long creationTime) { - this.key = key; - this.creationTime = creationTime; - } - - public Object getKey() { - return key; - } - - public long getCreationTime() { - return creationTime; - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 0) @@ -1,108 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.hibernate.domain; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class Person { - - private Long id; - private int age; - private String firstname; - private String lastname; - private List events = new ArrayList(); // list semantics, e.g., indexed - private Set emailAddresses = new HashSet(); - private Set phoneNumbers = new HashSet(); - private List talismans = new ArrayList(); // a Bag of good-luck charms. - - public Person() { - // - } - - public List getEvents() { - return events; - } - - protected void setEvents(List events) { - this.events = events; - } - - public void addToEvent(Event event) { - this.getEvents().add(event); - event.getParticipants().add(this); - } - - public void removeFromEvent(Event event) { - this.getEvents().remove(event); - event.getParticipants().remove(this); - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public Set getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Set emailAddresses) { - this.emailAddresses = emailAddresses; - } - - public Set getPhoneNumbers() { - return phoneNumbers; - } - - public void setPhoneNumbers(Set phoneNumbers) { - this.phoneNumbers = phoneNumbers; - } - - public void addTalisman(String name) { - talismans.add(name); - } - - public List getTalismans() { - return talismans; - } - - public void setTalismans(List talismans) { - this.talismans = talismans; - } - - public String toString() { - return getFirstname() + " " + getLastname(); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 0) @@ -1,61 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.regions; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory; - -import org.hibernate.cache.CacheDataDescription; -import org.hibernate.cache.CacheException; -import org.hibernate.cache.EntityRegion; -import org.hibernate.cache.access.AccessType; -import org.hibernate.cache.access.EntityRegionAccessStrategy; -import org.hibernate.cfg.Settings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * An entity region specific wrapper around an Ehcache instance. - * - * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access - * is not supported. - * - * @author Chris Dennis - * @author Abhishek Sanoujam - */ -public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class); - - /** - * Constructs an EhcacheEntityRegion around the given underlying cache. - * - * @param accessStrategyFactory - */ - public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings, - CacheDataDescription metadata, Properties properties) { - super(accessStrategyFactory, underlyingCache, settings, metadata, properties); - } - - /** - * {@inheritDoc} - */ - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType); - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0) @@ -1,162 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2; -import net.sf.ehcache.management.sampled.CacheSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntityV2; - -/** - * A builder for {@link CacheStatisticSampleEntityV2} resource objects. - * - * @author brandony - */ -final class CacheStatisticSampleEntityBuilderV2 { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class); - - private static final String SAMPLE_SUFFIX = "Sample"; - - private final Set sampleNames; - - private final Map> samplersByCMName = new HashMap>(); - - static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) { - return new CacheStatisticSampleEntityBuilderV2(statisticSampleName); - } - - private CacheStatisticSampleEntityBuilderV2(Set sampleNames) { - this.sampleNames = sampleNames; - } - - CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler, - String cacheManagerName) { - addSampler(sampler, cacheManagerName); - return this; - } - - Collection build() { - Collection csses = new ArrayList(); - - for (Map.Entry> entry : samplersByCMName.entrySet()) { - for (CacheSampler sampler : entry.getValue()) { - if (sampleNames == null) { - for (Method m : CacheSampler.class.getMethods()) { - if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } else { - for (String sampleName : sampleNames) { - Method sampleMethod; - try { - sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX); - } catch (NoSuchMethodException e) { - LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName); - continue; - } - - if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } - } - } - - return csses; - } - - private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod, - CacheSampler sampler, - String cmName) { - SampledCounter sCntr; - try { - sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler)); - } catch (IllegalAccessException e) { - LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.", - sampleMethod.getName()); - sCntr = null; - } catch (InvocationTargetException e) { - LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e); - sCntr = null; - } - - if (sCntr != null) { - CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2(); - csse.setCacheManagerName(cmName); - csse.setName(sampler.getCacheName()); - csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID); - // csse.setVersion(this.getClass().getPackage().getImplementationVersion()); - csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, "")); - - TimeStampedCounterValue[] tscvs; - if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) { - tscvs = new TimeStampedCounterValue[0]; - } else { - tscvs = sCntr.getAllSampleValues(); - } - - Map statValueByTime = new TreeMap(); - csse.setStatValueByTimeMillis(statValueByTime); - - for (TimeStampedCounterValue tscv : tscvs) { - statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue()); - } - return csse; - } - - return null; - } - - private Set getExcludedMethodNames(CacheSampler sampler) { - if (sampler.isLocalHeapCountBased()) { - return Collections.singleton("getLocalHeapSizeInBytesSample"); - } - return Collections.emptySet(); - } - - private void addSampler(CacheSampler sampler, - String cacheManagerName) { - if (sampler == null) { - throw new IllegalArgumentException("sampler == null"); - } - - if (cacheManagerName == null) { - throw new IllegalArgumentException("cacheManagerName == null"); - } - - Set samplers = samplersByCMName.get(cacheManagerName); - - if (samplers == null) { - samplers = new HashSet(); - samplersByCMName.put(cacheManagerName, samplers); - } - - samplers.add(sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0) @@ -1,60 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -@Category(CheckShorts.class) -public class DecoratedCacheConfigTest { - - private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache", - "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"}); - - @Test - public void testDecoratedCacheConfig() { - CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource( - "ehcache-decorator-noname-test.xml")); - try { - List names = new ArrayList(Arrays.asList(cm.getCacheNames())); - names.removeAll(ALL_CACHE_NAMES); - Assert.assertEquals("This list should be empty - " + names, 0, names.size()); - // System.out.println("Original config: " + cm.getOriginalConfigurationText()); - String text = cm.getActiveConfigurationText(); - // System.out.println("Cache manager config: " + text); - for (String name : ALL_CACHE_NAMES) { - Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\"")); - String cacheConfigTest = cm.getActiveConfigurationText(name); - // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest); - Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ", - cacheConfigTest.contains("name=\"" + name + "\"")); - } - - } finally { - cm.shutdown(); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/resources/serializedforms/SerializationCopyStrategySerializationTest.testBasic.ser =================================================================== diff -u -N -r10926 -r10963 Binary files differ Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0) @@ -1,149 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.util.Random; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - private static final int NUM_OF_ELEMENTS = 1000; - private static final int NUM_OF_THREADS = 10; - private static final int WRITE_PERCENTAGE = 5; - - public L1BMOnHeapReadWriteTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class); - } - - public static class L1BMOnHeapReadWriteTestApp extends ClientBase { - private final ToolkitBarrier barrier; - - public L1BMOnHeapReadWriteTestApp(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new L1BMOnHeapReadWriteTestApp(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - boolean shouldWait = true; - Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true); - testL1BigMemorySanity(eventualWithStatsCache, shouldWait); - eventualWithStatsCache.removeAll(); - - Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false); - testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait); - eventualWithoutStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true); - testL1BigMemorySanity(strongWithStatsCache, shouldWait); - strongWithStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false); - testL1BigMemorySanity(strongWithoutStatsCache, shouldWait); - strongWithoutStatsCache.removeAll(); - } - - private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException, - BrokenBarrierException { - int index = barrier.await(); - if (index == 0) { - System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache"); - for (int i = 0; i < NUM_OF_ELEMENTS; i++) { - cache.put(new Element("key" + i, "val" + i)); - } - System.out.println("XXXXX done with putting " + cache.getSize() + " entries"); - } - barrier.await(); - if (shouldWait) { - while (cache.getSize() != NUM_OF_ELEMENTS) { - Thread.sleep(1000); - } - } - Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize()); - System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: " - + cache.getStatistics().getLocalHeapSize()); - if (index == 0) { - Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0); - } else { - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize()); - } - - System.out.println("XXXXX starting test threads...."); - Thread ths[] = new Thread[NUM_OF_THREADS]; - for (int i = 0; i < NUM_OF_THREADS; i++) { - ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i); - ths[i].start(); - } - - for (Thread th : ths) { - th.join(); - } - barrier.await(); - System.out.println("XXXXXX done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxBytesLocalHeap(10485760L); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - return cache; - } - - private static class TestThread implements Runnable { - private final long TIME_TO_RUN = 1 * 60 * 1000; - private final Cache cache; - private final int threadIndex; - private final int clientIndex; - - public TestThread(Cache cache, int threadIndex, int clientIndex) { - this.cache = cache; - this.threadIndex = threadIndex; - this.clientIndex = clientIndex; - } - - @Override - public void run() { - System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex); - long start = System.currentTimeMillis(); - Random rand = new Random(start); - while (System.currentTimeMillis() - start < TIME_TO_RUN) { - if (rand.nextInt(100) < WRITE_PERCENTAGE) { - this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS))); - } else { - String key = "key" + rand.nextInt(NUM_OF_ELEMENTS); - Assert.assertNotNull("value for " + key + " is null", this.cache.get(key)); - } - } - } - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0) @@ -1,32 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.wan; - -/** - * @author Eugene Shelestovich - */ -public interface Watchable { - - /** - * - */ - void goLive(); - - void die(); - - /** - * Checks whether or not a given Watchable is alive. - * - * @return {@code true} if a given Watchable is alive, {@code false} otherwise - */ - boolean probeLiveness(); - - /** - * Returns a name which uniquely identifies the Watchable. - * - * @return unique name - */ - String name(); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0) @@ -1,147 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs.blocking; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - - -/** - * Test cases for the {@link UpdatingSelfPopulatingCache}. - * - * @author Greg Luck - * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $ - */ -public class UpdatingSelfPopulatingCacheTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private CacheManager cacheManager; - private Cache cache; - - @Before - public void setUp() throws Exception { - Configuration configuration = new Configuration(); - configuration.name("upSelfPopCM") - .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath())) - .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2) - .timeToLiveSeconds(5) - .overflowToDisk(true) - .diskPersistent(true)); - cacheManager = CacheManager.newInstance(configuration); - cache = cacheManager.getCache("cache"); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - /** - * Tests fetching an entry, and then an update. - */ - @Test - public void testFetchAndUpdate() throws Exception { - final Object value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - - //test null - Element element = selfPopulatingCache.get(null); - - // Lookup - element = selfPopulatingCache.get("key"); - assertThat(element.getObjectValue(), sameInstance(value)); - assertThat(factory.getCount(), is(2)); - - Object actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(3)); - - actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(4)); - } - - /** - * Tests when fetch fails. - */ - @Test - public void testFetchFail() throws Exception { - final Exception exception = new Exception("Failed."); - final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() { - public Object createEntry(final Object key) - throws Exception { - throw exception; - } - - public void updateEntryValue(Object key, Object value) - throws Exception { - throw exception; - } - }; - - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Lookup - try { - selfPopulatingCache.get("key"); - fail(); - } catch (final Exception e) { - // Check the error - assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage()); - } - } - - /** - * Tests refreshing the entries. - */ - @Test - public void testRefresh() throws Exception { - final String value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Refresh - try { - selfPopulatingCache.refresh(); - fail(); - } catch (CacheException e) { - //expected. - assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 0) @@ -1,34 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import java.util.Map; - -import javax.management.ObjectName; - -/** - * @author Abhishek Sanoujam - */ -public interface DSOMBean { - - long getGlobalServerMapGetSizeRequestsCount(); - - long getGlobalServerMapGetValueRequestsCount(); - - long getGlobalServerMapGetSizeRequestsRate(); - - long getGlobalServerMapGetValueRequestsRate(); - - long getReadOperationRate(); - - Map getServerMapGetSizeRequestsCount(); - - Map getServerMapGetValueRequestsCount(); - - Map getServerMapGetSizeRequestsRate(); - - Map getServerMapGetValueRequestsRate(); - - Void dumpClusterState(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0) @@ -1,87 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.statistics.extended; - -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.StatisticArchive; -import org.terracotta.statistics.archive.StatisticSampler; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class SampledStatistic. - * - * @param the generic type - * @author cdennis - */ -class SampledStatistic { - - /** The sampler. */ - private final StatisticSampler sampler; - - /** The history. */ - private final StatisticArchive history; - - /** - * Instantiates a new sampled statistic. - * - * @param statistic the statistic - * @param executor the executor - * @param historySize the history size - * @param periodNanos the period nanos - */ - public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) { - this.history = new StatisticArchive(historySize); - this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history); - } - - /** - * Start sampling. - */ - public void startSampling() { - sampler.start(); - } - - /** - * Stop sampling. - */ - public void stopSampling() { - sampler.stop(); - history.clear(); - } - - /** - * History. - * - * @return the list - */ - public List> history() { - return history.getArchive(); - } - - /** - * Adjust. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void adjust(int historySize, long historyNanos) { - history.setCapacity(historySize); - sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.transaction.SoftLockID; - -/** - * @author Alex Snaps - */ -public class TxCopyStrategyHandler extends CopyStrategyHandler { - - /** - * Creates a TxCopyStrategyHandler based on the copy configuration - * - * @param copyOnRead copy on read flag - * @param copyOnWrite copy on write flag - * @param copyStrategy the copy strategy to use - * @param loader - */ - public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) { - super(copyOnRead, copyOnWrite, copyStrategy, loader); - } - - @Override - public Element copyElementForReadIfNeeded(final Element element) { - final Object objectValue = element.getObjectValue(); - if (objectValue instanceof SoftLockID) { - return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement()); - } - return super.copyElementForReadIfNeeded(element); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0) @@ -1,40 +0,0 @@ -RULE trace RemoteTransactionManagerImpl commitWithoutThrottling -CLASS RemoteTransactionManagerImpl -METHOD commitWithoutThrottling -AT ENTRY -IF true -DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterEntry -CLASS ClusteredStore -METHOD putWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterExit -CLASS ClusteredStore -METHOD putWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterEntry -CLASS ClusteredStore -METHOD removeWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterExit -CLASS ClusteredStore -METHOD removeWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 0) @@ -1,48 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.bootstrap; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; - -/** - * @author Greg Luck - * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public interface BootstrapCacheLoader { - - /** - * Instructs the loader to load the given cache - * @param cache cache to load - */ - void load(Ehcache cache) throws CacheException; - - /** - * - * @return true if this bootstrap loader is asynchronous - */ - boolean isAsynchronous(); - - /** - * Clones the loader - * - * @return clone of this instance - * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface. - */ - Object clone() throws CloneNotSupportedException; - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0) @@ -1,90 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.local; - -import net.sf.ehcache.transaction.TransactionID; -import net.sf.ehcache.transaction.TransactionIDFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * The local transactions mode recovery manager which is used to trigger full recovery of all - * caches configured with local transaction mode. - * - * @author Ludovic Orban - */ -public class LocalRecoveryManager { - - private final TransactionIDFactory transactionIdFactory; - private final List localTransactionStores = new CopyOnWriteArrayList(); - private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet(); - - /** - * Create a LocalRecoveryManager instance - * @param transactionIdFactory the TransactionIDFactory - */ - public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) { - this.transactionIdFactory = transactionIdFactory; - } - - /** - * Register a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void register(LocalTransactionStore localTransactionStore) { - localTransactionStores.add(localTransactionStore); - } - - /** - * Unregister a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void unregister(LocalTransactionStore localTransactionStore) { - localTransactionStores.remove(localTransactionStore); - } - - /** - * Run recovery on all registered local transaction stores. The latter - * are used internally by caches when they're configured with local transaction mode. - * @return the set of recovered TransactionIDs - */ - public Set recover() { - Set recovered = new HashSet(); - // first ask all stores to cleanup their soft locks - for (LocalTransactionStore localTransactionStore : localTransactionStores) { - recovered.addAll(localTransactionStore.recover()); - } - // then clear the transaction ID - for (TransactionID transactionId : recovered) { - transactionIdFactory.clear(transactionId); - } - - previouslyRecoveredTransactionIDs = recovered; - return recovered; - } - - /** - * Get the set of transaction IDs collected by the previous recover() call - * @return the set of previously recovered TransactionIDs - */ - public Set getPreviouslyRecoveredTransactionIDs() { - return previouslyRecoveredTransactionIDs; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 0) @@ -1,54 +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; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentBLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentBLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentBLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderB"; - } - - /** - * @param arg0 - * @return - * @throws CacheException - */ - public Object load(Object arg0) throws CacheException { - LOG.info("Loading Component B..."); - String key = (String) arg0; - return new ComponentB(key); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0) @@ -1,233 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.bulkops; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; - -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.TimeUnit; - -public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) { - super(testConfig, App.class, App.class); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG); - testBulkOpsSanity(dcv2StrongSerialization); - barrier.await(); - - Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL); - testBulkOpsSanity(dcv2EventualSerialization); - barrier.await(); - - barrier.await(); - - } - - private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException { - int index = barrier.await(); - int numOfElements = 100; - Set elements = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i))); - } - if (index == 0) { - cache.putAll(elements); - } - - barrier.await(); - while (cache.getSize() != numOfElements) { - Thread.sleep(1000); - } - Assert.assertEquals(numOfElements, cache.getSize()); - - Set keySet1 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - keySet1.add(new Key("key" + i, i)); - } - - Map rv = cache.getAll(keySet1); - Assert.assertEquals(numOfElements, rv.size()); - - Collection values = new HashSet(); - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - values.add(entry.getValue()); - } - - for (Element element : elements) { - Assert.assertTrue(values.contains(element)); - } - - Set keySet2 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - if (i % 2 == 0) { - keySet2.add(new Key("key" + i, i)); - } - } - - rv = cache.getAll(keySet2); - Assert.assertEquals(keySet2.size(), rv.size()); - - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.removeAll(keySet2); - System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - // sleep for 60 seconds for eventual caches - if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) { - Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS)); - } - } - index = barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client"); - for (Object key : keySet2) { - Assert.assertNull(cache.get(key)); - } - System.out.println("client " + index + " done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxElementsInMemory(100000); - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(100000); - cacheConfiguration.setTimeToIdleSeconds(200000); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency); - return cache; - } - } - - private static class Key implements Serializable { - private final String stringKey; - private final int intKey; - - public Key(String stringKey, int intKey) { - super(); - this.stringKey = stringKey; - this.intKey = intKey; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intKey; - result = prime * result + ((stringKey == null) ? 0 : stringKey.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Key other = (Key) obj; - if (intKey != other.intKey) return false; - if (stringKey == null) { - if (other.stringKey != null) return false; - } else if (!stringKey.equals(other.stringKey)) return false; - return true; - } - - @Override - public String toString() { - return stringKey; - } - - } - - private static class Value implements Serializable { - private final String keyVal; - private final int intVal; - - public Value(String keyVal, int intVal) { - this.keyVal = keyVal; - this.intVal = intVal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intVal; - result = prime * result + ((keyVal == null) ? 0 : keyVal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Value other = (Value) obj; - if (intVal != other.intVal) return false; - if (keyVal == null) { - if (other.keyVal != null) return false; - } else if (!keyVal.equals(other.keyVal)) return false; - return true; - } - - @Override - public String toString() { - return keyVal; - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0) @@ -1,21 +0,0 @@ -package org.terracotta.ehcache.tests.servermap; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase { - - public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) { - super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig, - ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class); - testConfig.setDgcEnabled(true); - testConfig.setDgcIntervalInSec(60); - testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true"); - - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000"); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 0) @@ -1,368 +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.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.properties.TCPropertiesConsts; -import com.tc.test.config.model.TestConfig; - -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.SECONDS; - -/** - * @author cdennis - */ -public class DynamicCacheConfigurationTest extends AbstractCacheTestBase { - public DynamicCacheConfigurationTest(TestConfig testConfig) { - super(testConfig, App.class); - testConfig.addTcProperty(TCPropertiesConsts.L2_SERVERMAP_EVICTION_CLIENTOBJECT_REFERENCES_REFRESH_INTERVAL, "5000"); - testConfig.addTcProperty(TCPropertiesConsts.EHCACHE_EVICTOR_LOGGING_ENABLED, "true"); - } - - public static class App extends ClientBase { - private static final double TOLERANCE = 0.1; - - 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 { - testTTIChange(cacheManager); - testTTLChange(cacheManager); - testDiskCapacityChange(cacheManager); - testMemoryCapacityChange(cacheManager); - testTTIChangeWithCustomElements(cacheManager); - testTTLChangeWithCustomElements(cacheManager); - } - - private Cache createCache(String cacheName, int maxMemory, boolean eternal, long ttl, long tti) { - return new Cache(new CacheConfiguration(cacheName, maxMemory) - .eternal(eternal) - .timeToLiveSeconds(ttl) - .timeToIdleSeconds(tti) - .clearOnFlush(true) - .terracotta(new TerracottaConfiguration().clustered(true).consistency(Consistency.STRONG) - .coherentReads(true).orphanEviction(true).orphanEvictionPeriod(4).localKeyCache(false) - .localKeyCacheSize(0).copyOnRead(false)).logging(true)); - } - - private void testTTIChange(CacheManager manager) throws InterruptedException { - Cache cache = createCache("testTTIChange", 10, false, 0, 10); - manager.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - cache.get("key2"); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - long currentTime = System.currentTimeMillis(); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("key1")); - if (System.currentTimeMillis() - currentTime < 20000 ) { - Assert.assertNotNull(cache.get("key2")); - } else { - Assert.assertNull(cache.get("key2")); - } - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - private void testTTLChange(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChange", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("key1")); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("key1")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - public void testTTIChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTIChangeWithCustomElements", 10, false, 0, 10); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("short")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - public void testTTLChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChangeWithCustomElements", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - private void testMemoryCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testMemoryCapacityChange", 100, true, 0, 0); - cache.getCacheConfiguration().getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG); - cm.addCache(cache); - - int i = 0; - for (; i < 150; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(200); - - for (; i < 250; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100, 200); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(50); - - for (; i < 350; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 50); - - cache.removeAll(); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int lowerBound, final int upperBound) - throws Exception { - final int min = (int) ((1 - TOLERANCE) * lowerBound); - final int max = (int) ((1 + TOLERANCE) * upperBound); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - if (cache.getStatistics().getLocalHeapSize() <= max && cache.getStatistics().getLocalHeapSize() >= min) { - return true; - } - System.out.println("Still waiting for memory store size to fall in bounds [" + lowerBound + ", " + upperBound - + "] current=" + cache.getStatistics().getLocalHeapSize()); - return false; - } - }); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int upperBound) throws Exception { - waitForCacheMemoryStoreSize(cache, 0, upperBound); - } - - public void testDiskCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testDiskCapacityChange", 10, true, 0, 0); - cache.getCacheConfiguration().maxEntriesLocalHeap(1).maxEntriesInCache(100).getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG).concurrency(16); - cm.addCache(cache); - - testCacheDiskCapacity(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesInCache(200); - - testCacheDiskCapacity(cache, 200); - - cache.getCacheConfiguration().setMaxEntriesInCache(50); - - testCacheDiskCapacity(cache, 50); - - cache.removeAll(); - } - - private void testCacheDiskCapacity(final Cache cache, final int capacity) throws Exception { - for (int i = 0; i < 1000; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - System.out.println("Waiting on capacoty of " + capacity); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - System.out.println("Current cache size " + cache.getSize()); - Assert.assertTrue(cache.getSize() > capacity * .85); - return cache.getSize() >= capacity * 0.9 && cache.getSize() <= capacity * 1.1; - } - }); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0) @@ -1,161 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.parser; - -import net.sf.ehcache.search.expression.And; -import net.sf.ehcache.search.expression.EqualTo; -import net.sf.ehcache.search.expression.GreaterThan; -import net.sf.ehcache.search.expression.GreaterThanOrEqual; -import net.sf.ehcache.search.expression.ILike; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.LessThanOrEqual; -import net.sf.ehcache.search.expression.Not; -import net.sf.ehcache.search.expression.NotEqualTo; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.parser.MCriteria.Between; -import net.sf.ehcache.search.parser.MCriteria.Simple; -import net.sf.ehcache.search.parser.MValue.MInt; - -import org.junit.Assert; -import org.junit.Test; - -public class MCriteriaTest { - - private final ClassLoader loader = getClass().getClassLoader(); - - @Test - public void testSimpleModelCriteria() throws CustomParseException { - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj); - EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj); - NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj); - GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj); - GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj); - LessThan crit = (LessThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj); - LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - } - - void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) { - Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max); - net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), name); - Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader)); - Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader)); - Assert.assertEquals(crit.isMinInclusive(), min); - Assert.assertEquals(crit.isMaxInclusive(), max); - } - - @Test - public void testBetween() throws CustomParseException { - MInt obj1 = new MValue.MInt(null, "0"); - MInt obj2 = new MValue.MInt(null, "110"); - checkBetween("foo", obj1, false, obj2, false); - checkBetween("foo", obj1, true, obj2, false); - checkBetween("foo", obj1, false, obj2, true); - checkBetween("foo", obj1, true, obj2, true); - } - - @Test - public void testIlike() { - MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo"); - ILike crit = (ILike)ilike.asEhcacheObject(loader); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testLike() { - MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo"); - ILike crit = (ILike)like.asEhcacheObject(loader); - Assert.assertEquals(like.getLikeRegex(), "foo.%foo"); - Assert.assertEquals(like.getILikeRegex(), "foo.*foo"); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testNot() throws CustomParseException { - MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1")); - MCriteria.Not not = new MCriteria.Not(simple); - Not crit = (Not)not.asEhcacheObject(loader); - @SuppressWarnings("unused") - EqualTo inner = (EqualTo)crit.getCriteria(); - Assert.assertTrue(true); // the casts are sufficient for the test. - } - - @Test - public void testAnd() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5")); - - MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3); - And crit = (And)and.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof And); - And crit2 = (And)crit.getCriterion()[1]; - Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan); - Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo); - - } - - @Test - public void testOr() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2); - - Or crit = (Or)or.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - -import net.sf.ehcache.Ehcache; - -public interface AsyncCoordinatorFactory { - AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config); - - boolean destroy(String cacheManagerName, String cacheName); -} Index: rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,342 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error -org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 0) @@ -1,194 +0,0 @@ -/** - * All content copyright 2010 (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package net.sf.ehcache.servermaplocalcache; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListenerAdapter; - -public class ServerMapLocalCache { - - private final static int CONCURRENCY = 256; - private volatile TCObjectSelfStore tcoSelfStore; - private volatile Cache ehcache; - private final ReentrantReadWriteLock[] locks = new ReentrantReadWriteLock[CONCURRENCY]; - private final Object localSync = new Object(); - private static final ExecutorService evictionHandlerStage = Executors.newFixedThreadPool(4, new ThreadFactory() { - private final AtomicInteger count = new AtomicInteger(); - - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "eviction_handler_stage_thread_" + count.incrementAndGet()); - t.setDaemon(true); - return t; - } - }); - - public ServerMapLocalCache(TCObjectSelfStore tcoSelfStore, Cache ehcache) { - this.tcoSelfStore = tcoSelfStore; - this.ehcache = ehcache; - ehcache.getCacheEventNotificationService().registerListener(new EvictionListener(this)); - for (int i = 0; i < CONCURRENCY; i++) { - locks[i] = new ReentrantReadWriteLock(); - } - } - - private ReentrantReadWriteLock getLock(Object key) { - return locks[Math.abs(key.hashCode() % CONCURRENCY)]; - } - - public void put(TCObjectSelf tcoSelf) { - synchronized (localSync) { - tcoSelfStore.addTCObjectSelf(tcoSelf); - addToCache(tcoSelf); - } - } - - public TCObjectSelf getFromTCObjectSelfStore(Long oid) { - synchronized (localSync) { - return tcoSelfStore.getById(oid); - } - } - - // public void remove(String key) { - // synchronized (localSync) { - // removeFromCache(key); - // } - // } - // - // private void removeFromCache(String key) { - // WriteLock writeLock = getLock(key).writeLock(); - // writeLock.lock(); - // try { - // // remove key-value mapping: key->value - // Element element = ehcache.removeAndReturnElement(key); - // if (element != null) { - // TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - // if (tcoSelf != null) { - // handleKeyValueMappingRemoved(key, tcoSelf); - // } - // } - // - // } finally { - // writeLock.unlock(); - // } - // } - - private void handleKeyValueMappingRemoved(String key, TCObjectSelf tcoSelf) { - // remote remove - tcoSelfStore.removeTCObjectSelf(tcoSelf); - if (tcoSelf != null) { - // clean up meta-mapping: id->key - ehcache.remove(tcoSelf.getOid()); - } - } - - private void addToCache(TCObjectSelf tcoSelf) { - ReentrantReadWriteLock lock = getLock(tcoSelf.getKey()); - lock.writeLock().lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Add to cache: " + tcoSelf); - } - - // add meta mapping: oid->key - ehcache.put(new Element(tcoSelf.getOid(), tcoSelf.getKey())); - - // add the key->value mapping - ehcache.put(new Element(tcoSelf.getKey(), tcoSelf)); - - } finally { - lock.writeLock().unlock(); - } - } - - public void entryEvicted(Object objectKey, Object objectValue) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Entry evicted; evictedKey: " + objectKey + ", evictedValue: " + objectValue); - } - if (objectValue instanceof TCObjectSelf) { - // key-value mapping evicted - keyValueMappingEvicted((String) objectKey, (TCObjectSelf) objectValue); - } else { - // oid-> key mapping removed - objectIdMappingEvicted((Long) objectKey, (String) objectValue); - } - } - - private void objectIdMappingEvicted(Long oid, String key) { - WriteLock writeLock = getLock(key).writeLock(); - writeLock.lock(); - Element element = null; - try { - element = ehcache.get(key); - if (element != null) { - TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - if (tcoSelf != null && tcoSelf.getOid() == oid) { - // clean up key-value mapping - ehcache.remove(key); - tcoSelfStore.removeTCObjectSelf(tcoSelf); - } - } - } finally { - writeLock.unlock(); - } - if (DebugUtil.DEBUG) { - DebugUtil.debug("[objectIdEvicted] oid: " + oid + ", key: " + key + ", was mapped to value: " - + (element == null ? "null" : element.getObjectValue())); - } - } - - private void keyValueMappingEvicted(String objectKey, TCObjectSelf objectValue) { - WriteLock writeLock = getLock(objectKey).writeLock(); - writeLock.lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[keyValueMappingEvicted] key: " + objectKey + ", value: " + objectValue); - } - handleKeyValueMappingRemoved(objectKey, objectValue); - } finally { - writeLock.unlock(); - } - } - - private static class EvictionListener extends CacheEventListenerAdapter { - private final ServerMapLocalCache serverMapLocalCache; - - public EvictionListener(ServerMapLocalCache serverMapLocalCache) { - this.serverMapLocalCache = serverMapLocalCache; - } - - @Override - public void notifyElementExpired(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementExpired] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - - @Override - public void notifyElementEvicted(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementEvicted] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to LiveCacheStatistics and its implementation. - - - Index: rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 0) @@ -1,45 +0,0 @@ - - distribution - - tar.gz - - - - - - - - - - - - ${basedir}/src - /src - - - ${project.build.directory}/${project.name} - - **/ehcache*.jar - **/terracotta-toolkit*-runtime*.jar - - /webapps/${project.name} - - - ${basedir}/src/assemble - - README.* - - / - - - ${basedir}/src/assemble/jetty6.1 - /jetty6.1 - - - ${basedir}/src/assemble/bin - /bin - 0755 - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 0) @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 0) @@ -1,28 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class VersionedItem extends Item { - private Long version; - - public Long getVersion() { - return version; - } - - public void setVersion(Long version) { - this.version = version; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0) @@ -1,309 +0,0 @@ -package net.sf.ehcache.constructs.eventual; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * StronglyConsistentCacheAccessorTest - */ -@Category(CheckShorts.class) -public class StronglyConsistentCacheAccessorTest { - - @Test - public void refusesStandaloneCache() { - try { - new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600)); - fail("Underlying cache not clustered and eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void refusesClusteredButNoEventualCache() { - TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG); - - try { - new StronglyConsistentCacheAccessor(underlyingCache); - fail("Underlying cache clustered but not eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void acceptClusteredAndEventualUnderlyingCache() { - Ehcache underlyingCache = buildMockCache(); - - new StronglyConsistentCacheAccessor(underlyingCache); - } - - @Test - public void testPutIfAbsent() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.putIfAbsent(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.putIfAbsent(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.putIfAbsent(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testSingleArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.replace(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.replace(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.replace(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testTwoArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false)); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true)); - - try { - cacheAccessor.replace(new Element(null, null), new Element("key", "other")); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - - try { - cacheAccessor.replace(new Element("key", "other"), new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testRemoveElement() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element); - when(underlyingCache.remove((Object)"key")).thenReturn(true); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.removeElement(element), is(false)); - assertThat(cacheAccessor.removeElement(element), is(true)); - - try { - cacheAccessor.removeElement(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void putMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - String put = "put"; - Set putMethods = getMethodsMatching(put); - for (Method putMethod : putMethods) { - int paramLength = putMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + putMethod.getName()); - putMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void replaceMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - Set replaceMethods = getMethodsMatching("replace"); - for (Method replaceMethod : replaceMethods) { - int paramLength = replaceMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) { - params[1] = element; - } - System.out.println("Invoking " + replaceMethod.getName()); - replaceMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void removeMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "someValue"); - - String remove = "remove"; - Set removeMethods = getMethodsMatching(remove, "Property"); - for (Method removeMethod : removeMethods) { - System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")"); - int paramLength = removeMethod.getParameterTypes().length; - if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) { - continue; - } - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = element; - } else { - params[0] = key; - } - if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params)); - removeMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void getMethodsDoReadLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "key"; - String get = "get"; - Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid"); - for (Method getMethod : getMethods) { - System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")"); - int paramLength = getMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else { - params[0] = key; - } - - System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params)); - getMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireReadLockOnKey(key); - verify(ehcache).releaseReadLockOnKey(key); - reset(ehcache); - } - } - - private Set getMethodsMatching(String put, String... excludes) { - Set results = new HashSet(); - Method[] methods = Ehcache.class.getMethods(); - for (Method method : methods) { - if (method.getName().contains(put)) { - boolean exclude = false; - for (String exclusion : excludes) { - if (method.getName().contains(exclusion)) { - exclude = true; - } - } - if (!exclude) { - results.add(method); - } - } - } - return results; - } - - private Ehcache buildMockCache() {TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(cacheConfiguration.getElementValueComparatorConfiguration()).thenReturn(new ElementValueComparatorConfiguration()); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.EVENTUAL); - return underlyingCache; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0) @@ -1,440 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Direction; -import net.sf.ehcache.search.ExecutionHints; -import net.sf.ehcache.search.Query; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.expression.AlwaysMatch; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.store.StoreQuery; - -/** - * Query builder implementation. Instances are bound to a specific cache - * - * @author teck - */ -class CacheQuery implements Query, StoreQuery { - - private volatile boolean frozen; - private volatile boolean includeKeys; - private volatile boolean includeValues; - private volatile int maxResults = -1; - private String[] targets; - - private final List orderings = Collections.synchronizedList(new ArrayList()); - private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>()); - private final List criteria = Collections.synchronizedList(new ArrayList()); - private final List aggregators = Collections.synchronizedList(new ArrayList()); - private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>()); - - private final Cache cache; - private volatile ExecutionHints hints; - - /** - * Create a new builder instance - * - * @param cache - */ - public CacheQuery(Cache cache) { - this.cache = cache; - } - - /** - * {@inheritDoc} - */ - public Query includeKeys() { - checkFrozen(); - this.includeKeys = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeValues() { - checkFrozen(); - this.includeValues = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAttribute(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - - this.includedAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException { - checkFrozen(); - - if (aggregators == null) { - throw new NullPointerException(); - } - - for (Aggregator aggregator : aggregators) { - if (aggregator == null) { - throw new NullPointerException("null aggregator"); - } - - this.aggregators.add(aggregator); - } - - return this; - } - - /** - * {@inheritDoc} - */ - public Query addOrderBy(Attribute> attribute, Direction direction) { - checkFrozen(); - this.orderings.add(new OrderingImpl(attribute, direction)); - return this; - } - - /** - * {@inheritDoc} - */ - public Query addGroupBy(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - groupByAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query maxResults(int maxResults) { - checkFrozen(); - this.maxResults = maxResults; - return this; - } - - /** - * {@inheritDoc} - */ - public Query addCriteria(Criteria criteria) { - checkFrozen(); - - if (criteria == null) { - throw new NullPointerException("null criteria"); - } - - this.criteria.add(criteria); - return this; - } - - /** - * {@inheritDoc} - */ - public Results execute() throws SearchException { - return cache.executeQuery(snapshot()); - } - - /** - * {@inheritDoc} - */ - public Results execute(ExecutionHints params) throws SearchException { - this.hints = params; - return cache.executeQuery(snapshot()); - } - - - /** - * {@inheritDoc} - */ - public Query end() { - frozen = true; - return this; - } - - /** - * {@inheritDoc} - */ - public List getOrdering() { - assertFrozen(); - return Collections.unmodifiableList(orderings); - } - - /** - * {@inheritDoc} - */ - public Criteria getCriteria() { - assertFrozen(); - return getEffectiveCriteriaCopy(); - } - - /** - * {@inheritDoc} - */ - public boolean requestsKeys() { - assertFrozen(); - return includeKeys; - } - - /** - * {@inheritDoc} - */ - public boolean requestsValues() { - assertFrozen(); - return includeValues; - } - - /** - * {@inheritDoc} - */ - public Cache getCache() { - assertFrozen(); - return cache; - } - - /** - * {@inheritDoc} - */ - public Set> requestedAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.includedAttributes); - } - - /** - * {@inheritDoc} - */ - public Set> groupByAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.groupByAttributes); - } - - /** - * {@inheritDoc} - */ - public int maxResults() { - assertFrozen(); - return maxResults; - } - - - /** - * {@inheritDoc} - */ - @Override - public ExecutionHints getExecutionHints() { - assertFrozen(); - return hints; - } - - /** - * {@inheritDoc} - */ - public List getAggregators() { - return Collections.unmodifiableList(this.aggregators); - } - - /** - * {@inheritDoc} - */ - public List> getAggregatorInstances() { - assertFrozen(); - return Collections.unmodifiableList(createAggregatorInstances(aggregators)); - } - - private static List> createAggregatorInstances(List aggregators) { - List> rv = new ArrayList>(aggregators.size()); - for (Aggregator aggregator : aggregators) { - rv.add(aggregator.createInstance()); - } - - return rv; - } - - private Criteria getEffectiveCriteriaCopy() { - Criteria result = new AlwaysMatch(); - for (Criteria c : criteria) { - result = result.and(c); - } - return result; - } - - private void assertFrozen() { - if (!frozen) { - throw new AssertionError("not frozen"); - } - } - - private StoreQuery snapshot() { - if (frozen) { - return this; - } - - return new StoreQueryImpl(); - } - - private void checkFrozen() { - if (frozen) { - throw new SearchException("Query is frozen and cannot be mutated"); - } - } - - /** - * {@inheritDoc} - */ - public String[] getTargets() { - return this.targets; - } - - /** - * {@inheritDoc} - */ - @Override - public void targets(final String[] targets) { - this.targets = targets; - } - - /** - * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder - */ - private class StoreQueryImpl implements StoreQuery { - private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy(); - private final boolean copiedIncludeKeys = includeKeys; - private final boolean copiedIncludeValues = includeValues; - private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes)); - private final int copiedMaxResults = maxResults; - private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings)); - private final List copiedAggregators = Collections.unmodifiableList(aggregators); - private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators)); - private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes)); - private final ExecutionHints execHints = hints; - - public Criteria getCriteria() { - return copiedCriteria; - } - - public boolean requestsKeys() { - return copiedIncludeKeys; - } - - public boolean requestsValues() { - return copiedIncludeValues; - } - - public Cache getCache() { - return cache; - } - - public Set
- * This is useful for writing tests. - * - * @author Greg Luck - * @version $Id: CountingCacheEntryFactory.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public class CountingCacheEntryFactory implements UpdatingCacheEntryFactory { - - private int count; - private final Object value; - private Random random; - - /** - * Creates a new instance - * - * @param value the factory always creates values equal to this value - */ - public CountingCacheEntryFactory(final Object value) { - this.value = value; - random = new Random(); - } - - /** - * Fetches an entry. - */ - public Object createEntry(final Object key) { - count++; - if (random.nextInt(2) == 1) { - return value; - } else { - return new Element(key, value); - } - } - - /** - * @return number of entries the factory has created. - */ - public int getCount() { - return count; - } - - /** - * Perform an incremental update of data within a CacheEntry. - * Based on identification of dirty values within a CacheEntry - * Insert Update or Delete those entries based on the existing value. - *
- * This method does not return a modified value, because it modifies the value passed into it, relying - * on the pass by reference feature of Java. - *
- * Implementations of this method must be thread safe. - * - * @param key the cache Key - * @param value a value copied from the value that belonged to the Element in the cache. Value must be mutable - * @throws Exception - */ - public void updateEntryValue(Object key, Object value) throws Exception { - count++; - if (key.equals("explode") && count > 1) { - throw new RuntimeException("EXPLODE!"); - } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/resources/distribution/ehcache-distributed-big-payload-3.xml (revision 0) @@ -1,425 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/CacheEventualConsistencyTest.java (revision 0) @@ -1,300 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; - -import org.junit.Assert; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.ToolkitFactory; -import org.terracotta.toolkit.ToolkitInstantiationException; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; -import org.terracotta.toolkit.concurrent.atomic.ToolkitAtomicLong; - -import com.tc.test.config.model.TestConfig; - -import java.util.Calendar; -import java.util.Properties; -import java.util.concurrent.BrokenBarrierException; - -public class CacheEventualConsistencyTest extends AbstractCacheTestBase { - - - public CacheEventualConsistencyTest(TestConfig testConfig) { - super("eventual-cache-explicit-locking-test.xml", testConfig, TestClient.class, TestClient.class); - testConfig.addTcProperty("seda.receive_invalidate_objects_stage.sleepMs", "60000"); - - } - - public static class TestClient extends ClientBase { - - private static final String QWERTY = "qwerty"; - private static final String INTIAL_VALUE = "init_"; - private static final String PREFIX_COUNTER = "_updated"; - private static final String BARRIER_NAME = "eventual-cache-explicit-locking-barrier"; - private static final int CLIENT_COUNT = 2; - private static final int UPDATE_LIMIT = 6; // Test Case Runs - private static final int NUM_ELEMENTS = 2; // Number of keys updated - - public TestClient(String[] args) { - super("eventualConsistencyCache", args); - } - - @Override - protected Toolkit createToolkit() { - try { - Properties properties = new Properties(); - properties.put("rejoin", true); - properties.put("nonstop-terracotta", false); - return ToolkitFactory.createToolkit(getTerracottaTypeSubType() + getTerracottaUrl(), properties); - } catch (ToolkitInstantiationException e) { - throw new RuntimeException(e); - } - } - - @Override - protected void runTest(Cache cache, Toolkit toolkit) throws Throwable { - try { - Toolkit internaltoolkit = createToolkit(); - ToolkitBarrier barrier = internaltoolkit.getBarrier(BARRIER_NAME, CLIENT_COUNT); - int index = barrier.await(); - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, INTIAL_VALUE); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets"); - doEventualGets(cache); - } - barrier.await(); - passForEventualCache(cache, barrier, index, internaltoolkit); - } finally { - System.err.println("Text Completed"); - } - } - - private void passForEventualCache(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit) - throws InterruptedException, - BrokenBarrierException { - long runCounter = 0; - long runsLimit = UPDATE_LIMIT; - runCounter = runsForEventualPutsNGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 2; - runCounter = runsForStrongPutNEventualGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - runsLimit = UPDATE_LIMIT * 3; - // runCounter = runsForEventualPutsNStrongGets(cache, barrier, index, internaltoolkit, runCounter, runsLimit); - // runsLimit = UPDATE_LIMIT * 4; - runCounter = runsForStrongPutsNStrongGets(cache, barrier, index, runCounter, runsLimit); - } - - private long runsForStrongPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, long runCounter, - long runsLimit) throws InterruptedException, BrokenBarrierException { - while (runCounter < runsLimit) { - testExplicitStrongPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER); - } - return runCounter; - } - - private long runsForEventualPutsNStrongGets(Cache cache, ToolkitBarrier barrier, int index, - Toolkit internaltoolkit, long runCounter, long runsLimit) - throws InterruptedException, - BrokenBarrierException { - testStrongGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForStrongPutNEventualGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testStrongPuts(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - private long runsForEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, Toolkit internaltoolkit, - long runCounter, long runsLimit) throws InterruptedException, - BrokenBarrierException { - testEventualPutsNGets(cache, barrier, index, "#" + (++runCounter) + PREFIX_COUNTER, internaltoolkit); - if (index > 0) { - assertOnEventualFailures(internaltoolkit); - } - barrier.await(); - return runCounter; - } - - - private void testExplicitStrongPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - doExplicitStrongGets(cache, prefix); - } - barrier.await(); - } - - private void testStrongPuts(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit toolkitInternal) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..."); - doExplicitStrongPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - failEventualGets(cache, prefix, toolkitInternal); - } - barrier.await(); - } - - private void testStrongGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - logTimeStart(); - System.err.println("Client: " + index + " doing eventual puts..."); - doEventualPuts(cache, prefix); - logTimeEnd(); - } - barrier.await(); - if (index > 0) { - logTimeStart(); - failExplicitStrongGets(cache, prefix, internaltoolkit); - logTimeEnd(); - } - barrier.await(); - } - - private void logTimeStart() { - System.out.println("XS:-" + Calendar.getInstance().getTime()); - } - - private void logTimeEnd() { - System.out.println("XE:-" + Calendar.getInstance().getTime()); - } - - private void testEventualPutsNGets(Cache cache, ToolkitBarrier barrier, int index, final String prefix, - Toolkit internaltoolkit) - throws InterruptedException, BrokenBarrierException { - if (index == 0) { - System.err.println("Client: " + index + " doing eventual puts..." + prefix); - doEventualPuts(cache, prefix); - } - barrier.await(); - if (index > 0) { - System.err.println("Client: " + index + " doing eventual gets..." + prefix); - failEventualGets(cache, prefix, internaltoolkit); - } - barrier.await(); - } - - private void doEventualPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.put(getElement(i, prefix)); - } - } - - private void doEventualGets(Cache cache) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.get(getKey(i)); - } - } - - private void doExplicitStrongPuts(Cache cache, final String prefix) { - for (int i = 0; i < NUM_ELEMENTS; i++) { - cache.acquireWriteLockOnKey(getKey(i)); - try { - cache.put(getElement(i, prefix)); - } finally { - cache.releaseWriteLockOnKey(getKey(i)); - } - } - } - - private void doExplicitStrongGets(Cache cache, final String prefix) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - Assert.assertTrue(result); - } - - // ** Always called by Client with index > 0; - private void failExplicitStrongGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - cache.acquireReadLockOnKey(getKey(i)); - try { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - if (!eq) { - System.out.println("HHHH Failed"); - } - result = result ? eq : result; - } finally { - cache.releaseReadLockOnKey(getKey(i)); - } - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - // ** Always called by Client with index > 0; - private void failEventualGets(Cache cache, final String prefix, Toolkit internaltoolkit) { - boolean result = true; - for (int i = NUM_ELEMENTS - 1; i >= 0; i--) { - Element element = cache.get(getKey(i)); - boolean eq = getValue(i, prefix).equals(element.getObjectValue()); - result = result ? eq : result; - } - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - if (!result) { - atomicLong.incrementAndGet(); - } - } - - private void assertOnEventualFailures(Toolkit internaltoolkit) { - ToolkitAtomicLong atomicLong = internaltoolkit.getAtomicLong(QWERTY); - long evenutalRuns = atomicLong.longValue(); - Assert.assertTrue(evenutalRuns > 0); - atomicLong.set(0); - } - - private Element getElement(int i, String valPrefix) { - return new Element(getKey(i), getValue(i, valPrefix)); - } - - private String getValue(int i, String valPrefix) { - return valPrefix + "val_" + i; - } - - private String getKey(int i) { - return "key_" + i; - } - - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/StandaloneEntryBasedConfigAttributesValueFactory.java (revision 0) @@ -1,98 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import net.sf.ehcache.config.generator.model.NodeAttribute; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueFactory; -import net.sf.ehcache.config.generator.xsom.XSDAttributeValueType; - -public class StandaloneEntryBasedConfigAttributesValueFactory implements XSDAttributeValueFactory { - - public String createValueForAttribute(NodeElement element, NodeAttribute attribute, XSDAttributeValueType xsdAttributeValueType) { - if ("terracotta".equals(element.getName())) { - if("coherent".equals(attribute.getName())) { - // returning null will skip this attribute - // can skip "coherent" attribute as its deprecated by consistency attribute - return null; - } - if("clustered".equals(attribute.getName())) { - return "false"; - } - } - if ("pinning".equals(element.getName())) { - if ("storage".equals(attribute.getName())) { - return "inMemory"; - } - } - if ("sizeOfPolicy".equals(element.getName())) { - if ("maxDepth".equals(attribute.getName())) { - return "100"; - } else if ("maxDepthExceededBehavior".equals(attribute.getName())) { - return "continue"; - } - } - // always generate with eternal=false - if ("defaultCache".equals(element.getName()) || "cache".equals(element.getName())) { - if("eternal".equals(attribute.getName())) { - return "false"; - } - if("transactionalMode".equals(attribute.getName())) { - return "off"; - } - // these are deprecated - if ("maxElementsInMemory".equals(attribute.getName()) || - "maxMemoryOffHeap".equals(attribute.getName()) || - "diskPersistent".equals(attribute.getName()) || - "overflowToDisk".equals(attribute.getName())) { - return null; - } - if ("maxElementsOnDisk".equals(attribute.getName()) || - "maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - if("maxEntriesLocalHeap".equals(attribute.getName()) || - "maxEntriesLocalOffHeap".equals(attribute.getName()) || - "maxEntriesLocalDisk".equals(attribute.getName())) { - return "10000"; - } - if("maxEntriesInCache".equals(attribute.getName())) { - return null; - } - } - if ("ehcache".equals(element.getName())) { - if("maxBytesLocalHeap".equals(attribute.getName()) || - "maxBytesLocalOffHeap".equals(attribute.getName()) || - "maxBytesLocalDisk".equals(attribute.getName())) { - return null; - } - } - if ("searchAttribute".equals(element.getName())) { - if ("expression".equals(attribute.getName())) { - return "value.toString()"; - } else if ("name".equals(attribute.getName())) { - return "name"; - } else { - return null; - } - } - - return xsdAttributeValueType.getRandomAllowedValue(); - } -} Index: rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/events/src/assemble/bin/stop-sample-server.bat (revision 0) @@ -1,11 +0,0 @@ -@echo off - -rem All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - -cd "%~d0%~p0" -for /f "tokens=*" %%a in ('call relative-paths.bat tc_install_dir') do set tc_install_dir=%%a -pushd -cd %tc_install_dir% -set tc_install_dir=%CD% -popd -call "%tc_install_dir%\bin\stop-tc-server.bat" Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/NoTcConfigStandaloneCacheTest.java (revision 0) @@ -1,52 +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 NoTcConfigStandaloneCacheTest extends AbstractCacheTestBase { - - public NoTcConfigStandaloneCacheTest(TestConfig testConfig) { - super("no-tcconfig-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; - boolean cacheException = false; - boolean tcConfig = false; - try { - fr = new FileReader(output); - BufferedReader reader = new BufferedReader(fr); - String st = ""; - while ((st = reader.readLine()) != null) { - if (st.contains("CacheException")) cacheException = true; - if (st.contains("")) tcConfig = true; - } - } catch (Exception e) { - throw new AssertionError(e); - } finally { - try { - fr.close(); - } catch (Exception e) { - // - } - } - - if (!cacheException) { throw new AssertionError("Expected Exception"); } - - if (!tcConfig) { throw new AssertionError("Expected "); } - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/CacheCopyOnRwReplaceRemoveTest.java (revision 0) @@ -1,113 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; -import net.sf.ehcache.config.MemoryUnit; -import net.sf.ehcache.config.PersistenceConfiguration; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; -import org.terracotta.test.categories.CheckShorts; - -import java.util.Arrays; -import java.util.Collection; - -@Category(CheckShorts.class) -@RunWith(Parameterized.class) -public class CacheCopyOnRwReplaceRemoveTest { - - public static final String MEMORY_CACHE = "memoryCache"; - public static final String DISK_CACHE = "diskCache"; - - @Parameters(name = "copyOnRead:{0}, copyOnWrite:{1}") - public static Collection data() { - Object[][] data = new Object[][] { { true, false }, { false, true }, { true, true } }; - return Arrays.asList(data); - } - - private final boolean copyOnRead; - private final boolean copyOnWrite; - - private CacheManager cacheManager; - - public CacheCopyOnRwReplaceRemoveTest(boolean copyOnRead, boolean copyOnWrite) { - this.copyOnRead = copyOnRead; - this.copyOnWrite = copyOnWrite; - } - - @Before - public void setUp() throws Exception { - cacheManager = CacheManager.create( new Configuration() - .name("copyOnRWReplaceRemoveManager") - .diskStore(new DiskStoreConfiguration().path(System.getProperty("java.io.tmpdir"))) - .maxBytesLocalHeap(100, MemoryUnit.KILOBYTES) - .maxBytesLocalDisk(200, MemoryUnit.KILOBYTES)); - cacheManager.addCache(new Cache(new CacheConfiguration().name(MEMORY_CACHE) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - cacheManager.addCache(new Cache(new CacheConfiguration().name(DISK_CACHE) - .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)) - .copyOnRead(copyOnRead) - .copyOnWrite(copyOnWrite))); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - @Test - public void testMemoryCache() throws Exception { - Ehcache cache = cacheManager.getCache(MEMORY_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - @Test - public void testDiskCache() throws Exception { - Ehcache cache = cacheManager.getCache(DISK_CACHE); - testReplaceElement(cache); - testRemoveElement(cache); - } - - private void testReplaceElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - String nextValue = value + "1"; - Assert.assertTrue(cache.replace(new Element(new Long(key), new String(value)), new Element(new Long(key), new String(nextValue)))); - } - - private void testRemoveElement(Ehcache cache) { - Long key = System.nanoTime(); - String value = "value" + key; - cache.put(new Element(new Long(key), new String(value))); - Assert.assertEquals(cache.get(key).getValue(), new Element(new Long(key), new String(value)).getValue()); - Assert.assertTrue(cache.removeElement(new Element(new Long(key), new String(value)))); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/store/ToolkitNonStopExceptionOnTimeoutConfiguration.java (revision 0) @@ -1,27 +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.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopReadTimeoutBehavior; -import org.terracotta.toolkit.nonstop.NonStopConfigurationFields.NonStopWriteTimeoutBehavior; - -public class ToolkitNonStopExceptionOnTimeoutConfiguration extends ToolkitNonStopConfiguration { - - public ToolkitNonStopExceptionOnTimeoutConfiguration(NonstopConfiguration ehcacheNonStopConfig) { - super(ehcacheNonStopConfig); - } - - @Override - public NonStopReadTimeoutBehavior getReadOpNonStopTimeoutBehavior() { - return NonStopReadTimeoutBehavior.EXCEPTION; - } - - @Override - public NonStopWriteTimeoutBehavior getWriteOpNonStopTimeoutBehavior() { - return NonStopWriteTimeoutBehavior.EXCEPTION; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/.classpath (revision 0) @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/config/generator/model/elements/SizeOfPolicyConfigurationElement.java (revision 0) @@ -1,67 +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.SizeOfPolicyConfiguration; -import net.sf.ehcache.config.generator.model.NodeElement; -import net.sf.ehcache.config.generator.model.SimpleNodeAttribute; -import net.sf.ehcache.config.generator.model.SimpleNodeElement; - -/** - * Element representing the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @author Ludovic Orban - * - */ -public class SizeOfPolicyConfigurationElement extends SimpleNodeElement { - private final SizeOfPolicyConfiguration sizeOfPolicyConfiguration; - - /** - * Construtor accepting the parent and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param parent - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(ConfigurationElement parent, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(parent, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - /** - * Construtor accepting the element and the {@link net.sf.ehcache.config.SizeOfPolicyConfiguration} - * - * @param element - * @param sizeOfPolicyConfiguration - */ - public SizeOfPolicyConfigurationElement(NodeElement element, SizeOfPolicyConfiguration sizeOfPolicyConfiguration) { - super(element, "sizeOfPolicy"); - this.sizeOfPolicyConfiguration = sizeOfPolicyConfiguration; - init(); - } - - private void init() { - if (sizeOfPolicyConfiguration == null) { - return; - } - addAttribute(new SimpleNodeAttribute("maxDepth", sizeOfPolicyConfiguration.getMaxDepth()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH)); - addAttribute(new SimpleNodeAttribute("maxDepthExceededBehavior", sizeOfPolicyConfiguration.getMaxDepthExceededBehavior()) - .optional(true).defaultValue(SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR)); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/txns/TwoResourceBTMXATest.java (revision 0) @@ -1,33 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.txns; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.test.util.TestBaseUtil; - -import bitronix.tm.TransactionManagerServices; - -import com.tc.test.config.model.TestConfig; - -import java.util.ArrayList; -import java.util.List; - -public class TwoResourceBTMXATest extends AbstractCacheTestBase { - - public TwoResourceBTMXATest(TestConfig testConfig) { - super("two-resource-xa-test.xml", testConfig, BTMTwoResourceTx1.class, BTMTwoResourceTx2.class); - testConfig.getClientConfig().setParallelClients(true); - - // DEV-3930 - // disableAllUntil("2010-03-31"); - } - - @Override - protected List getExtraJars() { - List extraJars = new ArrayList(); - extraJars.add(TestBaseUtil.jarFor(TransactionManagerServices.class)); - return extraJars; - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/SoftLockFactory.java (revision 0) @@ -1,35 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.transaction; - -/** - * A factory of soft-locks supporting a specific isolation level. - * - * @author Chris Dennis - */ -public interface SoftLockFactory { - - /** - * Construct a new softlock to be managed by the given manager for a specific key. - * - * @param manager soft lock manager - * @param key key to generate against - * @return a new soft lock - */ - SoftLock newSoftLock(SoftLockManager manager, Object key); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache/src/test/java/net/sf/ehcache/terracotta/upgradability/serialization/NonEternalElementDataSerializationTest.java (revision 0) @@ -1,46 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.terracotta.upgradability.serialization; - -import java.io.IOException; -import java.util.Comparator; - -import net.sf.ehcache.Element; -import net.sf.ehcache.NonEternalElementData; -import org.junit.Test; - -import static org.terracotta.upgradability.serialization.SerializationUpgradabilityTesting.validateSerializedForm; - -/** - * - * @author cdennis - */ -public class NonEternalElementDataSerializationTest { - - private static final Comparator COMPARATOR = new Comparator() { - - @Override - public int compare(NonEternalElementData o1, NonEternalElementData o2) { - return ElementSerializationTest.COMPARATOR.compare(o1.createElement("foo"), o2.createElement("foo")); - } - }; - - @Test - public void testBasic() throws IOException, ClassNotFoundException { - validateSerializedForm(new NonEternalElementData(new Element("foo", "bar", 1000L, 2000L, 3000L, 4000L, false, 5000, 6000, 7000L)), COMPARATOR, "serializedforms/NonEternalElementDataSerializationTest.testBasic.ser"); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/lifecycle/CacheManagerDestroyCrashTest.java (revision 0) @@ -1,159 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.lifecycle; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.ConfigurationFactory; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.mockito.Mockito; -import org.objenesis.ObjenesisStd; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.TestBaseUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.test.config.model.TestConfig; -import com.terracotta.entity.ClusteredEntityManager; -import com.terracotta.entity.ehcache.ClusteredCacheManager; - -import java.io.IOException; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; - -public class CacheManagerDestroyCrashTest extends AbstractCacheTestBase { - private static final String CACHE_NAME = "cache1"; - - public CacheManagerDestroyCrashTest(TestConfig testConfig) { - super("lifecycle/cache-destroy.xml", testConfig, CacheManagerCreateClient.class, - CacheManagerEntityDestroyCrashClient.class); - } - - @Override - protected String createClassPath(Class client) throws IOException { - String classpath = super.createClassPath(client); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(Mockito.class)); - classpath = addToClasspath(classpath, TestBaseUtil.jarFor(ObjenesisStd.class)); - return classpath; - } - - public static class CacheManagerCreateClient extends ClientBase { - - public CacheManagerCreateClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - - CacheConfiguration cacheConfig = new CacheConfiguration(CACHE_NAME, 100) - .terracotta(new TerracottaConfiguration()); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - cache.put(new Element("key", "value", true)); - - cacheManager.shutdown(); - - // Notify client to destroy - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 1 - - // Waiting for other client to signal destroy done - getBarrierForAllClients().await(1, TimeUnit.MINUTES); // hit 2 - - // Making sure adding back cache does not resurrect old data structures - setupCacheManager(); - cacheManager.addCache(new Cache(cacheConfig)); - cache = cacheManager.getCache(CACHE_NAME); - assertNull(cache.get("key")); - } - - @Override - protected Cache getCache() { - return null; - } - - } - - public static class CacheManagerEntityDestroyCrashClient extends ClientBase { - - public CacheManagerEntityDestroyCrashClient(String[] mainArgs) { - super(mainArgs); - } - - @Override - protected void runTest(Cache cache, Toolkit myToolkit) throws Throwable { - // Waiting for CM to be created - - waitForAllClients(); // hit 1 - - Toolkit spiedToolkit = spy(getClusteringToolkit()); - - ClusteredEntityManager clusteredEntityManager1 = new ClusteredEntityManager(spiedToolkit); - Configuration configuration = ConfigurationFactory.parseConfiguration(getEhcacheXmlAsStream()); - String cmName = configuration.getName(); - - Map cacheManagers = clusteredEntityManager1 - .getRootEntities(ClusteredCacheManager.class); - - ClusteredCacheManager clusteredCacheManager = cacheManagers.get(cmName); - - while(clusteredCacheManager.isUsed()) { - TimeUnit.MILLISECONDS.sleep(200); - } - - - doThrow(new TestDestroyCrashException("Crashing destroy")) - .when(spiedToolkit) - .getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - try { - clusteredEntityManager1.destroyRootEntity(cmName, ClusteredCacheManager.class, clusteredCacheManager); - fail("Destroy should have thrown an exception"); - } catch(TestDestroyCrashException e) { - // Expected as we want destroy to crash - e.printStackTrace(); - } - reset(spiedToolkit); - - clusteredEntityManager1.getRootEntity(cmName, ClusteredCacheManager.class); - // Shows inline clean up performed - verify(spiedToolkit).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - reset(spiedToolkit); - - ClusteredEntityManager clusteredEntityManager2 = new ClusteredEntityManager(spiedToolkit); - assertNull(clusteredEntityManager2.getRootEntity(cmName, ClusteredCacheManager.class)); - - verify(spiedToolkit, never()).getCache(any(String.class), any(org.terracotta.toolkit.config.Configuration.class), any(Class.class)); - - getBarrierForAllClients().await(10, TimeUnit.SECONDS); // hit 2 - } - - @Override - protected void setupCacheManager() { - // Do nothing here - } - - @Override - protected Cache getCache() { - // Do nothing here - return null; - } - } - - public static class TestDestroyCrashException extends RuntimeException { - public TestDestroyCrashException(String msg) { - super(msg); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/net/sf/ehcache/osgi/Event.hbm.xml (revision 0) @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v1/src/main/java/net/sf/ehcache/management/service/impl/CacheConfigurationEntityBuilder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import net.sf.ehcache.management.resource.CacheConfigEntity; -import net.sf.ehcache.management.sampled.CacheManagerSampler; -import org.terracotta.management.resource.AgentEntity; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -/** - * @author brandony - */ -final class CacheConfigurationEntityBuilder { - - private final Map samplersByCName = new HashMap(); - - static CacheConfigurationEntityBuilder createWith(CacheManagerSampler sampler, - String cacheName) { - return new CacheConfigurationEntityBuilder(sampler, cacheName); - } - - private CacheConfigurationEntityBuilder(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - } - - CacheConfigurationEntityBuilder add(CacheManagerSampler sampler, - String cacheName) { - addSampler(sampler, cacheName); - return this; - } - - Collection build() { - Collection cces = new ArrayList(); - - for (Map.Entry entry : samplersByCName.entrySet()) { - CacheConfigEntity cce = new CacheConfigEntity(); - - String cacheName = entry.getKey(); - cce.setCacheName(cacheName); - cce.setAgentId(AgentEntity.EMBEDDED_AGENT_ID); - cce.setVersion(this.getClass().getPackage().getImplementationVersion()); - - CacheManagerSampler sampler = entry.getValue(); - cce.setCacheManagerName(sampler.getName()); - cce.setXml(sampler.generateActiveConfigDeclaration(cacheName)); - - cces.add(cce); - } - - return cces; - } - - private void addSampler(CacheManagerSampler sampler, - String cacheName) { - if (sampler == null) throw new IllegalArgumentException("sampler == null"); - - if (cacheName == null) throw new IllegalArgumentException("cacheName == null"); - - if(!Arrays.asList(sampler.getCacheNames()).contains(cacheName)) { - throw new IllegalArgumentException(String.format("Invalid cache name: %s.", cacheName)); - } - - samplersByCName.put(cacheName, sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/constructs/refreshahead/RefreshAheadCacheFactory.java (revision 0) @@ -1,45 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.constructs.refreshahead; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.constructs.CacheDecoratorFactory; - -/** - * Cache decorator factory for {@link RefreshAheadCache} instances - * - * @author cschanck - * - */ -public class RefreshAheadCacheFactory extends CacheDecoratorFactory { - - @Override - public Ehcache createDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - - @Override - public Ehcache createDefaultDecoratedEhcache(Ehcache cache, Properties properties) { - RefreshAheadCacheConfiguration config = new RefreshAheadCacheConfiguration().fromProperties(properties).build(); - RefreshAheadCache decorator = new RefreshAheadCache(cache, config); - return decorator; - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/operations/SingleAsyncOperation.java (revision 0) @@ -1,50 +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.io.IOException; -import java.io.Serializable; - -/** - * Interface to implement single operations that are performed in the write behind implementation that using an - * AsyncCoordinator underneath - * - * @author Abhishek Maheshwari - */ -public interface SingleAsyncOperation extends Serializable { - /** - * Perform this operation as a single execution with the provided cache writer - * - * @param cacheWriter the cache writer this operation should be performed upon - */ - public void performSingleOperation(CacheWriter cacheWriter) throws ClassNotFoundException, IOException; - - /** - * Retrieves the key for this operation. - * - * @return this operation's key - */ - Object getKey(); - - Element getElement(); - - /** - * Retrieves the moment when the operation was created. - * - * @return the creation time in milliseconds - */ - public long getCreationTime(); - - /** - * This method will be called to throw the item away. - * - * @param cacheWriter - * @param e - */ - void throwAwayElement(CacheWriter cacheWriter, RuntimeException e); - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/cluster/CacheCluster.java (revision 0) @@ -1,93 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.cluster; - -import java.util.Collection; -import java.util.List; - -/** - * Allows you to explore the Terracotta cluster nodes and register for events about the cluster. - * - * @author Geert Bevin, Abhishek Sanoujam - * @since 2.0 - */ -public interface CacheCluster { - - /** - * Get scheme name for this cluster info. - * - * @return a scheme name for the cluster information. - * Currently TERRACOTTA is the only scheme supported. - */ - ClusterScheme getScheme(); - - /** - * Retrieves the {@code ClusterNode} instance that corresponds to the current node. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode getCurrentNode(); - - /** - * Waits until the current node has successfully joined the cluster. - * - * @return the {@code ClusterNode} instance that corresponds to the current node - */ - ClusterNode waitUntilNodeJoinsCluster(); - - /** - * Get all the nodes in the cluster - * - * @return information on all the nodes in the cluster, including ID, hostname, and IP address. - */ - Collection getNodes(); - - /** - * Find out if the current node is connected to the cluster or not - * - * @return true if cluster is online otherwise false - */ - boolean isClusterOnline(); - - /** - * Add a listener for cluster events - * - * @param listener Listener - * @return True if already listening - */ - boolean addTopologyListener(ClusterTopologyListener listener); - - /** - * Remove a listener for cluster events - * - * @param listener Listener - * @return True if not listening - */ - boolean removeTopologyListener(ClusterTopologyListener listener); - - /** - * Removes all listeners for cluster events - */ - void removeAllListeners(); - - /** - * Get all the topology listeners - * - * @return a list of all the topology listeners - */ - List getTopologyListeners(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/impl/ResultImpl.java (revision 0) @@ -1,77 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.impl; - -import java.util.Map; - -import net.sf.ehcache.store.StoreQuery; - -/** - * Result implementation - * - * @author teck - */ -public class ResultImpl extends BaseResult { - - private final Object key; - private final Object value; - private final Map attributes; - private final Object[] sortAttributes; - - /** - * Constructor - * - * @param key - * @param value - * @param query - * @param attributes - * @param sortAttributes - */ - public ResultImpl(Object key, Object value, StoreQuery query, Map attributes, Object[] sortAttributes) { - super(query); - this.key = key; - this.value = value; - this.attributes = attributes; - this.sortAttributes = sortAttributes; - } - - /** - * Get attribute value for use in sorting - * - * @param pos - * @return - */ - Object getSortAttribute(int pos) { - return sortAttributes[pos]; - } - - @Override - protected Object basicGetKey() { - return key; - } - - @Override - protected Object basicGetValue() { - return value; - } - - @Override - protected Object basicGetAttribute(String name) { - return attributes.get(name); - } - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/DelegatingTransactionIDFactory.java (revision 0) @@ -1,151 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.FeaturesManager; -import net.sf.ehcache.terracotta.ClusteredInstanceFactory; -import net.sf.ehcache.terracotta.TerracottaClient; -import net.sf.ehcache.transaction.xa.XidTransactionID; - -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicReference; - -import javax.transaction.xa.Xid; - -/** - * A TransactionIDFactory implementation with delegates calls to either a clustered - * or non-clustered factory - * - * @author Ludovic Orban - */ -public class DelegatingTransactionIDFactory implements TransactionIDFactory { - - private final FeaturesManager featuresManager; - private final TerracottaClient terracottaClient; - private final String cacheManagerName; - private volatile ClusteredInstanceFactory clusteredInstanceFactory; - private volatile AtomicReference transactionIDFactory = new AtomicReference(); - - /** - * Create a new DelegatingTransactionIDFactory - * - * @param terracottaClient a terracotta client - * @param cacheManagerName the name of the cache manager which creates this. - */ - public DelegatingTransactionIDFactory(FeaturesManager featuresManager, TerracottaClient terracottaClient, String cacheManagerName) { - this.featuresManager = featuresManager; - this.terracottaClient = terracottaClient; - this.cacheManagerName = cacheManagerName; - } - - private TransactionIDFactory get() { - ClusteredInstanceFactory cif = terracottaClient.getClusteredInstanceFactory(); - if (cif != null && cif != this.clusteredInstanceFactory) { - this.transactionIDFactory.set(cif.createTransactionIDFactory(UUID.randomUUID().toString(), cacheManagerName)); - this.clusteredInstanceFactory = cif; - } - - if (transactionIDFactory.get() == null) { - TransactionIDFactory constructed; - if (featuresManager == null) { - constructed = new TransactionIDFactoryImpl(); - } else { - constructed = featuresManager.createTransactionIDFactory(); - } - if (transactionIDFactory.compareAndSet(null, constructed)) { - return constructed; - } else { - return transactionIDFactory.get(); - } - } else { - return transactionIDFactory.get(); - } - } - - /** - * {@inheritDoc} - */ - public TransactionID createTransactionID() { - return get().createTransactionID(); - } - - /** - * {@inheritDoc} - */ - public TransactionID restoreTransactionID(TransactionIDSerializedForm serializedForm) { - return get().restoreTransactionID(serializedForm); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID createXidTransactionID(Xid xid, Ehcache cache) { - return get().createXidTransactionID(xid, cache); - } - - /** - * {@inheritDoc} - */ - public XidTransactionID restoreXidTransactionID(XidTransactionIDSerializedForm serializedForm) { - return get().restoreXidTransactionID(serializedForm); - } - - @Override - public void markForCommit(TransactionID transactionID) { - get().markForCommit(transactionID); - } - - @Override - public void markForRollback(XidTransactionID transactionID) { - get().markForRollback(transactionID); - } - - @Override - public boolean isDecisionCommit(TransactionID transactionID) { - return get().isDecisionCommit(transactionID); - } - - @Override - public void clear(TransactionID transactionID) { - get().clear(transactionID); - } - - @Override - public Set getAllXidTransactionIDsFor(Ehcache cache) { - return get().getAllXidTransactionIDsFor(cache); - } - - @Override - public Set getAllTransactionIDs() { - return get().getAllTransactionIDs(); - } - - @Override - public boolean isExpired(TransactionID transactionID) { - return get().isExpired(transactionID); - } - - @Override - public Boolean isPersistent() { - if (transactionIDFactory.get() == null) { - return null; - } else { - return get().isPersistent(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/ConfigurationGeneratedParsesTest.java (revision 0) @@ -1,55 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.io.ByteArrayInputStream; -import java.io.UnsupportedEncodingException; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; - -public class ConfigurationGeneratedParsesTest { - - private static final String[] TEST_CONFIGS = new String[] { - "ehcache.xml", - "ehcache-big.xml", - "ehcache-cacheextension.xml", - "ehcache-comparator.xml", - "ehcache-countinglisteners.xml", - "ehcache-search.xml", - "ehcache-tx-local.xml", - "ehcache-tx-twopc.xml", - "ehcache-writer.xml", - "ehcacheUTF8.xml", - }; - - @Test - public void testGeneratedConfigIsValid() throws CacheException, UnsupportedEncodingException { - for (String config : TEST_CONFIGS) { - String generatedConfig; - CacheManager manager = new CacheManager(ConfigurationGeneratedParsesTest.class.getClassLoader().getResource(config)); - try { - generatedConfig = manager.getActiveConfigurationText(); - } finally { - manager.shutdown(); - } - new CacheManager(new ByteArrayInputStream(generatedConfig.getBytes("UTF-8"))).shutdown(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/cache-locks-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/store/LruMemoryStorePerfTest.java (revision 0) @@ -1,31 +0,0 @@ -package net.sf.ehcache.store; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.MemoryStorePerfTester; -import org.junit.Test; - -/** - * @author Alex Snaps - */ -public class LruMemoryStorePerfTest extends MemoryStorePerfTester { - - @Override - protected Cache createCache() throws CacheException { - return new Cache("LruMemoryStorePerfTest", 12000, MemoryStoreEvictionPolicy.FIFO, false, System.getProperty("java.io.tmpdir"), - true, 60, 30, false, 60, null); - } - - /** - * Benchmark to test speed. This uses both memory and disk and tries to be realistic - * v 1.38 DiskStore 7355 - * v 1.41 DiskStore 1609 - * Adjusted for change to laptop - */ - @Test - public void testBenchmarkPutGetSurya() throws Exception { - benchmarkPutGetSuryaTest(2500); - } - - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/cachingtier/OnHeapCachingTier.java (revision 0) @@ -1,364 +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.cachingtier; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.AbstractCacheConfigurationListener; -import net.sf.ehcache.config.PinningConfiguration; -import net.sf.ehcache.config.SizeOfPolicyConfiguration; -import net.sf.ehcache.pool.Pool; -import net.sf.ehcache.pool.Size; -import net.sf.ehcache.pool.SizeOfEngine; -import net.sf.ehcache.pool.SizeOfEngineLoader; -import net.sf.ehcache.pool.sizeof.annotations.IgnoreSizeOf; -import net.sf.ehcache.store.CachingTier; -import net.sf.ehcache.store.FifoPolicy; -import net.sf.ehcache.store.LfuPolicy; -import net.sf.ehcache.store.LruPolicy; -import net.sf.ehcache.store.MemoryStoreEvictionPolicy; -import net.sf.ehcache.store.Policy; - -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.CopyOnWriteArrayList; -import net.sf.ehcache.store.StoreOperationOutcomes.GetOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.PutOutcome; -import net.sf.ehcache.store.StoreOperationOutcomes.RemoveOutcome; -import org.terracotta.context.annotations.ContextChild; -import org.terracotta.statistics.Statistic; -import org.terracotta.statistics.observer.OperationObserver; - -import static net.sf.ehcache.statistics.StatisticBuilder.operation; - -/** - * An instance of this class will delegate the storage to the backing HeapCacheBackEnd. - * Adding : - * - * making sure only a single thread populates the cache for a given key at a time - * translate calls to the eviction listeners - * Add all the crap about sizing and stuff - * - * - * @param The key type - * @param the value type - * @author Alex Snaps - */ -public class OnHeapCachingTier implements CachingTier { - - @ContextChild - private final HeapCacheBackEnd backEnd; - - private final OperationObserver getObserver = operation(GetOutcome.class).named("get").of(this).tag("local-heap").build(); - private final OperationObserver putObserver = operation(PutOutcome.class).named("put").of(this).tag("local-heap").build(); - private final OperationObserver removeObserver = operation(RemoveOutcome.class).named("remove").of(this).tag("local-heap").build(); - - - private volatile List> listeners = new CopyOnWriteArrayList>(); - - /** - * A Constructor - * - * @param backEnd the HeapCacheBackEnd that will back this CachingTier - */ - public OnHeapCachingTier(final HeapCacheBackEnd backEnd) { - this.backEnd = backEnd; - this.backEnd.registerEvictionCallback(new HeapCacheBackEnd.EvictionCallback() { - @Override - public void evicted(final K key, final Object value) { - final V v = getValue(value); - if (v != null) { - for (Listener listener : listeners) { - listener.evicted(key, v); - } - } - } - }); - } - - /** - * Factory method - * @param cache the cache we're planning to back - * @param onHeapPool the pool, if any, to use - * @return the OnHeapCachingTier properly configured for this cache - */ - public static OnHeapCachingTier createOnHeapCache(final Ehcache cache, final Pool onHeapPool) { - final HeapCacheBackEnd memCacheBackEnd; - final Policy memoryEvictionPolicy = determineEvictionPolicy(cache); - if (cache.getCacheConfiguration().isCountBasedTuned()) { - final long maxEntriesLocalHeap = getCachingTierMaxEntryCount(cache); - final CountBasedBackEnd countBasedBackEnd = - new CountBasedBackEnd(maxEntriesLocalHeap, memoryEvictionPolicy); - memCacheBackEnd = countBasedBackEnd; - cache.getCacheConfiguration().addConfigurationListener(new AbstractCacheConfigurationListener() { - @Override - public void memoryCapacityChanged(final int oldCapacity, final int newCapacity) { - countBasedBackEnd.setMaxEntriesLocalHeap(newCapacity); - } - }); - } else { - final PooledBasedBackEnd pooledBasedBackEnd = new PooledBasedBackEnd(memoryEvictionPolicy); - - pooledBasedBackEnd.registerAccessor( - onHeapPool.createPoolAccessor(new PooledBasedBackEnd.PoolParticipant(pooledBasedBackEnd), - SizeOfPolicyConfiguration.resolveMaxDepth(cache), - SizeOfPolicyConfiguration.resolveBehavior(cache) - .equals(SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT))); - - memCacheBackEnd = pooledBasedBackEnd; - } - - return new OnHeapCachingTier( - memCacheBackEnd); - } - - /** - * Chooses the Policy from the cache configuration - * - * @param cache the cache - * @return the chosen eviction policy - */ - static Policy determineEvictionPolicy(Ehcache cache) { - MemoryStoreEvictionPolicy policySelection = cache.getCacheConfiguration().getMemoryStoreEvictionPolicy(); - - if (policySelection.equals(MemoryStoreEvictionPolicy.LRU)) { - return new LruPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.FIFO)) { - return new FifoPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.LFU)) { - return new LfuPolicy(); - } else if (policySelection.equals(MemoryStoreEvictionPolicy.CLOCK)) { - return new LruPolicy(); - } - - throw new IllegalArgumentException(policySelection + " isn't a valid eviction policy"); - } - - - private static long getCachingTierMaxEntryCount(final Ehcache cache) { - final PinningConfiguration pinningConfiguration = cache.getCacheConfiguration().getPinningConfiguration(); - if (pinningConfiguration != null && pinningConfiguration.getStore() != PinningConfiguration.Store.INCACHE) { - return 0; - } - return cache.getCacheConfiguration().getMaxEntriesLocalHeap(); - } - - @Override - public boolean loadOnPut() { - return backEnd.hasSpace(); - } - - @Override - public V get(final K key, final Callable source, final boolean updateStats) { - if (updateStats) { getObserver.begin(); } - Object cachedValue = backEnd.get(key); - if (cachedValue == null) { - if (updateStats) { getObserver.end(GetOutcome.MISS); } - Fault f = new Fault(source); - cachedValue = backEnd.putIfAbsent(key, f); - if (cachedValue == null) { - try { - V value = f.get(); - putObserver.begin(); - if (value == null) { - backEnd.remove(key, f); - } else if (backEnd.replace(key, f, value)) { - putObserver.end(PutOutcome.ADDED); - } else { - V p = getValue(backEnd.remove(key)); - return p == null ? value : p; - } - return value; - } catch (Throwable e) { - backEnd.remove(key, f); - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } else { - throw new CacheException(e); - } - } - } - } else { - if (updateStats) { getObserver.end(GetOutcome.HIT); } - } - - return getValue(cachedValue); - } - - @Override - public V remove(final K key) { - removeObserver.begin(); - try { - return getValue(backEnd.remove(key)); - } finally { - removeObserver.end(RemoveOutcome.SUCCESS); - } - } - - @Override - public void clear() { - backEnd.clear(false); - } - - @Override - public void clearAndNotify() { - backEnd.clear(true); - } - - @Override - public void addListener(final Listener listener) { - if (listener == null) { - throw new NullPointerException("Listener can't be null!"); - } - listeners.add(listener); - } - - @Statistic(name = "size", tags = "local-heap") - @Override - public int getInMemorySize() { - return backEnd.size(); - } - - @Override - public int getOffHeapSize() { - return 0; - } - - @Override - public boolean contains(final K key) { - return backEnd.get(key) != null; - } - - @Statistic(name = "size-in-bytes", tags = "local-heap") - @Override - public long getInMemorySizeInBytes() { - long sizeInBytes; - if (backEnd instanceof PooledBasedBackEnd, ?>) { - sizeInBytes = ((PooledBasedBackEnd)backEnd).getSizeInBytes(); - } else { - SizeOfEngine defaultSizeOfEngine = SizeOfEngineLoader.newSizeOfEngine( - SizeOfPolicyConfiguration.DEFAULT_MAX_SIZEOF_DEPTH, - SizeOfPolicyConfiguration.DEFAULT_MAX_DEPTH_EXCEEDED_BEHAVIOR == SizeOfPolicyConfiguration.MaxDepthExceededBehavior.ABORT, - true - ); - sizeInBytes = 0; - for (Map.Entry entry : backEnd.entrySet()) { - // This could leak Fault values... We ignore these entirely - if (entry.getValue() != null && entry.getValue() instanceof Element) { - Element element = (Element)entry.getValue(); - // TODO this is a lie here! Should we add a dedicated method to BackEnd to return a container ? - Size size = defaultSizeOfEngine.sizeOf(element.getObjectKey(), element, null); - sizeInBytes += size.getCalculated(); - } - } - } - return sizeInBytes; - } - - @Override - public long getOffHeapSizeInBytes() { - return 0; - } - - @Override - public long getOnDiskSizeInBytes() { - return 0; - } - - @Override - public void recalculateSize(final K key) { - backEnd.recalculateSize(key); - } - - @Override - public Policy getEvictionPolicy() { - return backEnd.getPolicy(); - } - - @Override - public void setEvictionPolicy(final Policy policy) { - backEnd.setPolicy(policy); - } - - private V getValue(final Object cachedValue) { - if (cachedValue instanceof Fault) { - return ((Fault)cachedValue).get(); - } else { - return (V)cachedValue; - } - } - - /** - * Document me - * - * @param - */ - @IgnoreSizeOf - private static class Fault { - - private final Callable source; - private V value; - private Throwable throwable; - private boolean complete; - - public Fault(final Callable source) { - this.source = source; - } - - private void complete(V value) { - synchronized (this) { - this.value = value; - this.complete = true; - notifyAll(); - } - } - - private V get() { - synchronized (this) { - if (!complete) { - try { - complete(source.call()); - } catch (Throwable e) { - fail(e); - } - } - } - - return throwOrReturn(); - } - - private V throwOrReturn() { - if (throwable != null) { - if (throwable instanceof RuntimeException) { - throw (RuntimeException) throwable; - } - throw new CacheException("Faulting from repository failed", throwable); - } - return value; - } - - private void fail(final Throwable t) { - synchronized (this) { - this.throwable = t; - this.complete = true; - notifyAll(); - } - throwOrReturn(); - } - } -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/LockHolder.java (revision 0) @@ -1,73 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - - -import org.terracotta.toolkit.concurrent.locks.ToolkitLock; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CyclicBarrier; - -public class LockHolder { - private static final int PARTIES = 2; - private final Map holdings = new HashMap(); - - public synchronized void hold(final ToolkitLock lock) { - if (lock == null || holdings.containsKey(lock)) { return; } - final CyclicBarrier barrier = new CyclicBarrier(PARTIES); - Thread lockThread = new Thread(new Runnable() { - @Override - public void run() { - lock.lock(); - try { - await(barrier); // hit 1 - await(barrier); // hit 2 - } finally { - try { - lock.unlock(); - } catch (Throwable th) { - // ignore any exception in unlock so that thread calling release() is not stuck at barrier.await() - } - await(barrier); // hit 3 - } - } - }); - holdings.put(lock.getName(), barrier); - lockThread.start(); - await(barrier); // hit 1 - } - - public synchronized void release(ToolkitLock lock) { - CyclicBarrier barrier = holdings.get(lock.getName()); - if (barrier != null) { - releaseLock(barrier); - holdings.remove(lock); - } - } - - private void releaseLock(CyclicBarrier barrier) { - await(barrier); // hit 2 - await(barrier); // hit 3 - } - - public synchronized void reset() { - for (CyclicBarrier barrier : holdings.values()) { - releaseLock(barrier); - } - holdings.clear(); - } - - private void await(CyclicBarrier barrier) { - try { - barrier.await(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (BrokenBarrierException e) { - // ignore - } - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/one-cache-test.xml (revision 0) @@ -1,14 +0,0 @@ - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/FlyweightType.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.pool.sizeof; - -import net.sf.ehcache.util.FindBugsSuppressWarnings; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.MathContext; -import java.net.Proxy; -import java.nio.charset.CodingErrorAction; -import java.util.Collections; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -import javax.xml.datatype.DatatypeConstants; -import javax.xml.namespace.QName; - -/** - * Enum with all the flyweight types that we check for sizeOf measurements - * - * @author Alex Snaps - */ -@FindBugsSuppressWarnings("RC_REF_COMPARISON") -enum FlyweightType { - - /** - * java.lang.Enum - */ - ENUM(Enum.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * java.lang.Class - */ - CLASS(Class.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - // XXX There is no nullipotent way of determining the interned status of a string - // There are numerous String constants within the JDK (see list at http://docs.oracle.com/javase/7/docs/api/constant-values.html), - // but enumerating all of them would lead to lots of == tests. - /** - * java.lang.String - */ - //STRING(String.class) { - // @Override - // boolean isShared(final Object obj) { return obj == ((String)obj).intern(); } - //}, - /** - * java.lang.Boolean - */ - BOOLEAN(Boolean.class) { - @Override - boolean isShared(final Object obj) { return obj == Boolean.TRUE || obj == Boolean.FALSE; } - }, - /** - * java.lang.Integer - */ - INTEGER(Integer.class) { - @Override - boolean isShared(final Object obj) { - int value = ((Integer)obj).intValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Integer.valueOf(value); - } - }, - /** - * java.lang.Short - */ - SHORT(Short.class) { - @Override - boolean isShared(final Object obj) { - short value = ((Short)obj).shortValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Short.valueOf(value); - } - }, - /** - * java.lang.Byte - */ - BYTE(Byte.class) { - @Override - boolean isShared(final Object obj) { return obj == Byte.valueOf((Byte)obj); } - }, - /** - * java.lang.Long - */ - LONG(Long.class) { - @Override - boolean isShared(final Object obj) { - long value = ((Long)obj).longValue(); - return value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE && obj == Long.valueOf(value); - } - }, - /** - * java.math.BigInteger - */ - BIGINTEGER(BigInteger.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigInteger.ZERO || obj == BigInteger.ONE || obj == BigInteger.TEN; - } - }, - /** - * java.math.BigDecimal - */ - BIGDECIMAL(BigDecimal.class) { - @Override - boolean isShared(final Object obj) { - return obj == BigDecimal.ZERO || obj == BigDecimal.ONE || obj == BigDecimal.TEN; - } - }, - /** - * java.math.MathContext - */ - MATHCONTEXT(MathContext.class) { - @Override - boolean isShared(final Object obj) { - return obj == MathContext.UNLIMITED || obj == MathContext.DECIMAL32 || obj == MathContext.DECIMAL64 || obj == MathContext.DECIMAL128; - } - }, - /** - * java.lang.Character - */ - CHARACTER(Character.class) { - @Override - boolean isShared(final Object obj) { return ((Character)obj).charValue() <= Byte.MAX_VALUE && obj == Character.valueOf((Character)obj); } - }, - /** - * java.lang.Locale - */ - LOCALE(Locale.class) { - @Override - boolean isShared(final Object obj) { - return GLOBAL_LOCALES.contains(obj); - } - }, - /** - * java.util.Logger - */ - LOGGER(Logger.class) { - @Override - @SuppressWarnings("deprecation") - boolean isShared(final Object obj) { return obj == Logger.global; } - }, - /** - * java.net.Proxy - */ - PROXY(Proxy.class) { - @Override - boolean isShared(final Object obj) { return obj == Proxy.NO_PROXY; } - }, - /** - * java.nio.charset.CodingErrorAction - */ - CODINGERRORACTION(CodingErrorAction.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.datatype.DatatypeConstants.Field - */ - DATATYPECONSTANTS_FIELD(DatatypeConstants.Field.class) { - @Override - boolean isShared(final Object obj) { return true; } - }, - /** - * javax.xml.namespace.QName - */ - QNAME(QName.class) { - @Override - boolean isShared(final Object obj) { - return obj == DatatypeConstants.DATETIME - || obj == DatatypeConstants.TIME - || obj == DatatypeConstants.DATE - || obj == DatatypeConstants.GYEARMONTH - || obj == DatatypeConstants.GMONTHDAY - || obj == DatatypeConstants.GYEAR - || obj == DatatypeConstants.GMONTH - || obj == DatatypeConstants.GDAY - || obj == DatatypeConstants.DURATION - || obj == DatatypeConstants.DURATION_DAYTIME - || obj == DatatypeConstants.DURATION_YEARMONTH; - } - }, - /** - * misc comparisons that can not rely on the object's class. - */ - MISC(Void.class) { - @Override - boolean isShared(final Object obj) { - boolean emptyCollection = obj == Collections.EMPTY_SET || obj == Collections.EMPTY_LIST || obj == Collections.EMPTY_MAP; - boolean systemStream = obj == System.in || obj == System.out || obj == System.err; - return emptyCollection || systemStream || obj == String.CASE_INSENSITIVE_ORDER; - } - }; - - private static final Map, FlyweightType> TYPE_MAPPINGS = new HashMap, FlyweightType>(); - static { - for (FlyweightType type : FlyweightType.values()) { - TYPE_MAPPINGS.put(type.clazz, type); - } - } - - private static final Set GLOBAL_LOCALES; - static { - Map locales = new IdentityHashMap(); - for (Field f : Locale.class.getFields()) { - int modifiers = f.getModifiers(); - if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Locale.class.equals(f.getType())) { - try { - locales.put((Locale) f.get(null), null); - } catch (IllegalArgumentException e) { - continue; - } catch (IllegalAccessException e) { - continue; - } - } - } - GLOBAL_LOCALES = locales.keySet(); - } - - private final Class> clazz; - - private FlyweightType(final Class> clazz) { - this.clazz = clazz; - } - - /** - * Whether this is a shared object - * @param obj the object to check for - * @return true, if shared - */ - abstract boolean isShared(Object obj); - - /** - * Will return the Flyweight enum instance for the flyweight Class, or null if type isn't flyweight - * @param aClazz the class we need the FlyweightType instance for - * @return the FlyweightType, or null - */ - static FlyweightType getFlyweightType(final Class> aClazz) { - if (aClazz.isEnum() || (aClazz.getSuperclass() != null && aClazz.getSuperclass().isEnum())) { - return ENUM; - } else { - FlyweightType flyweightType = TYPE_MAPPINGS.get(aClazz); - return flyweightType != null ? flyweightType : MISC; - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/pool/sizeof/annotations/IgnoreSizeOf.java (revision 0) @@ -1,38 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.pool.sizeof.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to ignore a field, type or entire package while doing a SizeOf measurement - * @see net.sf.ehcache.pool.sizeof.SizeOf - * @author Chris Dennis - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.FIELD, ElementType.TYPE, ElementType.PACKAGE }) -public @interface IgnoreSizeOf { - - /** - * Controls whether the annotation, when applied to a {@link ElementType#TYPE type} is to be applied to all its subclasses - * as well or solely on that type only. true if inherited by subtypes, false otherwise - */ - boolean inherited() default false; -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/ccs/EhcacheReadOnlyCache.java (revision 0) @@ -1,125 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.ccs; - -import java.util.Comparator; - -import org.hibernate.cache.CacheException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.hibernate.cache.access.SoftLock; - -/** - * Ehcache specific read-only cache concurrency strategy. - * - * This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache. - * - * @author Chris Dennis - */ -@Deprecated -public class EhcacheReadOnlyCache extends AbstractEhcacheConcurrencyStrategy { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheReadOnlyCache.class); - - /** - * {@inheritDoc} - */ - public Object get(Object key, long timestamp) throws CacheException { - return cache.get(key); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public SoftLock lock(Object key, Object version) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - public boolean put(Object key, Object value, long timestamp, Object version, - Comparator versionComparator, boolean minimalPut) throws CacheException { - if (minimalPut && cache.get(key) != null) { - return false; - } else { - cache.put(key, value); - return true; - } - } - - /** - * Logs an error since items in a read-only cache should not be mutated. - */ - public void release(Object key, SoftLock lock) { - LOG.error("Application attempted to edit read only item: " + key); - //throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Inserts the specified item into the cache. - */ - public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - cache.update(key, value); - return true; - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public void evict(Object key) throws CacheException { - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public boolean insert(Object key, Object value, Object currentVersion) { - return false; - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return cache + "(read-only)"; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 0) @@ -1,163 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * A regular expression criteria that matches attribute string values. For non java.lang.String attributes, - * the toString() form is used in the comparison. - * - * Expressions are always case insensitive - * - * The following special characters are supported: - * - * '?' - match any one single character - * '*' - match any multiple character(s) (including zero) - * - * The supported wildcard characters can be escaped with a backslash '\', and a literal backslash can be included with '\\' - * - * WARN: Expressions starting with a leading wildcard character are potentially very expensive (ie. full scan) for indexed caches - * - * - * @author teck - */ -public class ILike extends BaseCriteria { - - private final String attributeName; - private final String regex; - private final Pattern pattern; - - /** - * Construct a "like" criteria for the given expression - * - * @param attributeName attribute name - * @param regex expression - */ - public ILike(String attributeName, String regex) { - if ((attributeName == null) || (regex == null)) { - throw new SearchException("Both the attribute name and regex must be non null."); - } - - this.attributeName = attributeName; - this.regex = regex; - this.pattern = convertRegex(regex.trim()); - } - - /** - * Return attribute name. - * - * @return String attribute name - */ - public String getAttributeName() { - return attributeName; - } - - /** - * Return regex string. - * - * @return String regex. - */ - public String getRegex() { - return regex; - } - - private static Pattern convertRegex(final String expr) { - if (expr.length() == 0) { - throw new SearchException("Zero length regex"); - } - - StringBuilder javaRegex = new StringBuilder("^"); - - boolean escape = false; - for (int i = 0; i < expr.length(); i++) { - char ch = expr.charAt(i); - - if (escape) { - switch (ch) { - case '\\': - case '?': - case '*': { - javaRegex.append(Pattern.quote(lowerCase(ch))); - break; - } - - default: { - throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr); - } - } - - escape = false; - } else { - switch (ch) { - case '\\': { - escape = true; - break; - } - case '?': { - javaRegex.append("."); - break; - } - case '*': { - javaRegex.append(".*"); - break; - } - default: { - javaRegex.append(Pattern.quote(lowerCase(ch))); - } - } - } - } - - javaRegex.append("$"); - - return Pattern.compile(javaRegex.toString(), Pattern.DOTALL); - } - - private static String lowerCase(char ch) { - // heeding the advice in Character.toLowerCase() and using String.toLowerCase() instead here - return Character.toString(ch).toLowerCase(); - } - - /** - * {@inheritDoc} - */ - public boolean execute(Element e, Map attributeExtractors) { - Object value = getExtractor(attributeName, attributeExtractors).attributeFor(e, attributeName); - if (value == null) { - return false; - } - - String asString = value.toString().toLowerCase(); - - return pattern.matcher(asString).matches(); - } - - @Override - public Set> getAttributes() { - return Collections.>singleton(new Attribute(attributeName)); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 0) @@ -1,24 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; - -public class KeyBasedOperationWrapper implements KeyBasedOperation { - private final Object key; - private final long creationTime; - - public KeyBasedOperationWrapper(Object key, long creationTime) { - this.key = key; - this.creationTime = creationTime; - } - - public Object getKey() { - return key; - } - - public long getCreationTime() { - return creationTime; - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 0) @@ -1,108 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.hibernate.domain; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class Person { - - private Long id; - private int age; - private String firstname; - private String lastname; - private List events = new ArrayList(); // list semantics, e.g., indexed - private Set emailAddresses = new HashSet(); - private Set phoneNumbers = new HashSet(); - private List talismans = new ArrayList(); // a Bag of good-luck charms. - - public Person() { - // - } - - public List getEvents() { - return events; - } - - protected void setEvents(List events) { - this.events = events; - } - - public void addToEvent(Event event) { - this.getEvents().add(event); - event.getParticipants().add(this); - } - - public void removeFromEvent(Event event) { - this.getEvents().remove(event); - event.getParticipants().remove(this); - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public Set getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Set emailAddresses) { - this.emailAddresses = emailAddresses; - } - - public Set getPhoneNumbers() { - return phoneNumbers; - } - - public void setPhoneNumbers(Set phoneNumbers) { - this.phoneNumbers = phoneNumbers; - } - - public void addTalisman(String name) { - talismans.add(name); - } - - public List getTalismans() { - return talismans; - } - - public void setTalismans(List talismans) { - this.talismans = talismans; - } - - public String toString() { - return getFirstname() + " " + getLastname(); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 0) @@ -1,61 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.regions; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory; - -import org.hibernate.cache.CacheDataDescription; -import org.hibernate.cache.CacheException; -import org.hibernate.cache.EntityRegion; -import org.hibernate.cache.access.AccessType; -import org.hibernate.cache.access.EntityRegionAccessStrategy; -import org.hibernate.cfg.Settings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * An entity region specific wrapper around an Ehcache instance. - * - * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access - * is not supported. - * - * @author Chris Dennis - * @author Abhishek Sanoujam - */ -public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class); - - /** - * Constructs an EhcacheEntityRegion around the given underlying cache. - * - * @param accessStrategyFactory - */ - public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings, - CacheDataDescription metadata, Properties properties) { - super(accessStrategyFactory, underlyingCache, settings, metadata, properties); - } - - /** - * {@inheritDoc} - */ - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType); - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0) @@ -1,162 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2; -import net.sf.ehcache.management.sampled.CacheSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntityV2; - -/** - * A builder for {@link CacheStatisticSampleEntityV2} resource objects. - * - * @author brandony - */ -final class CacheStatisticSampleEntityBuilderV2 { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class); - - private static final String SAMPLE_SUFFIX = "Sample"; - - private final Set sampleNames; - - private final Map> samplersByCMName = new HashMap>(); - - static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) { - return new CacheStatisticSampleEntityBuilderV2(statisticSampleName); - } - - private CacheStatisticSampleEntityBuilderV2(Set sampleNames) { - this.sampleNames = sampleNames; - } - - CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler, - String cacheManagerName) { - addSampler(sampler, cacheManagerName); - return this; - } - - Collection build() { - Collection csses = new ArrayList(); - - for (Map.Entry> entry : samplersByCMName.entrySet()) { - for (CacheSampler sampler : entry.getValue()) { - if (sampleNames == null) { - for (Method m : CacheSampler.class.getMethods()) { - if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } else { - for (String sampleName : sampleNames) { - Method sampleMethod; - try { - sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX); - } catch (NoSuchMethodException e) { - LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName); - continue; - } - - if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } - } - } - - return csses; - } - - private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod, - CacheSampler sampler, - String cmName) { - SampledCounter sCntr; - try { - sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler)); - } catch (IllegalAccessException e) { - LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.", - sampleMethod.getName()); - sCntr = null; - } catch (InvocationTargetException e) { - LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e); - sCntr = null; - } - - if (sCntr != null) { - CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2(); - csse.setCacheManagerName(cmName); - csse.setName(sampler.getCacheName()); - csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID); - // csse.setVersion(this.getClass().getPackage().getImplementationVersion()); - csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, "")); - - TimeStampedCounterValue[] tscvs; - if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) { - tscvs = new TimeStampedCounterValue[0]; - } else { - tscvs = sCntr.getAllSampleValues(); - } - - Map statValueByTime = new TreeMap(); - csse.setStatValueByTimeMillis(statValueByTime); - - for (TimeStampedCounterValue tscv : tscvs) { - statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue()); - } - return csse; - } - - return null; - } - - private Set getExcludedMethodNames(CacheSampler sampler) { - if (sampler.isLocalHeapCountBased()) { - return Collections.singleton("getLocalHeapSizeInBytesSample"); - } - return Collections.emptySet(); - } - - private void addSampler(CacheSampler sampler, - String cacheManagerName) { - if (sampler == null) { - throw new IllegalArgumentException("sampler == null"); - } - - if (cacheManagerName == null) { - throw new IllegalArgumentException("cacheManagerName == null"); - } - - Set samplers = samplersByCMName.get(cacheManagerName); - - if (samplers == null) { - samplers = new HashSet(); - samplersByCMName.put(cacheManagerName, samplers); - } - - samplers.add(sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0) @@ -1,60 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -@Category(CheckShorts.class) -public class DecoratedCacheConfigTest { - - private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache", - "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"}); - - @Test - public void testDecoratedCacheConfig() { - CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource( - "ehcache-decorator-noname-test.xml")); - try { - List names = new ArrayList(Arrays.asList(cm.getCacheNames())); - names.removeAll(ALL_CACHE_NAMES); - Assert.assertEquals("This list should be empty - " + names, 0, names.size()); - // System.out.println("Original config: " + cm.getOriginalConfigurationText()); - String text = cm.getActiveConfigurationText(); - // System.out.println("Cache manager config: " + text); - for (String name : ALL_CACHE_NAMES) { - Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\"")); - String cacheConfigTest = cm.getActiveConfigurationText(name); - // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest); - Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ", - cacheConfigTest.contains("name=\"" + name + "\"")); - } - - } finally { - cm.shutdown(); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/resources/serializedforms/SerializationCopyStrategySerializationTest.testBasic.ser =================================================================== diff -u -N -r10926 -r10963 Binary files differ Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0) @@ -1,149 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.util.Random; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - private static final int NUM_OF_ELEMENTS = 1000; - private static final int NUM_OF_THREADS = 10; - private static final int WRITE_PERCENTAGE = 5; - - public L1BMOnHeapReadWriteTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class); - } - - public static class L1BMOnHeapReadWriteTestApp extends ClientBase { - private final ToolkitBarrier barrier; - - public L1BMOnHeapReadWriteTestApp(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new L1BMOnHeapReadWriteTestApp(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - boolean shouldWait = true; - Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true); - testL1BigMemorySanity(eventualWithStatsCache, shouldWait); - eventualWithStatsCache.removeAll(); - - Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false); - testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait); - eventualWithoutStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true); - testL1BigMemorySanity(strongWithStatsCache, shouldWait); - strongWithStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false); - testL1BigMemorySanity(strongWithoutStatsCache, shouldWait); - strongWithoutStatsCache.removeAll(); - } - - private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException, - BrokenBarrierException { - int index = barrier.await(); - if (index == 0) { - System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache"); - for (int i = 0; i < NUM_OF_ELEMENTS; i++) { - cache.put(new Element("key" + i, "val" + i)); - } - System.out.println("XXXXX done with putting " + cache.getSize() + " entries"); - } - barrier.await(); - if (shouldWait) { - while (cache.getSize() != NUM_OF_ELEMENTS) { - Thread.sleep(1000); - } - } - Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize()); - System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: " - + cache.getStatistics().getLocalHeapSize()); - if (index == 0) { - Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0); - } else { - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize()); - } - - System.out.println("XXXXX starting test threads...."); - Thread ths[] = new Thread[NUM_OF_THREADS]; - for (int i = 0; i < NUM_OF_THREADS; i++) { - ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i); - ths[i].start(); - } - - for (Thread th : ths) { - th.join(); - } - barrier.await(); - System.out.println("XXXXXX done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxBytesLocalHeap(10485760L); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - return cache; - } - - private static class TestThread implements Runnable { - private final long TIME_TO_RUN = 1 * 60 * 1000; - private final Cache cache; - private final int threadIndex; - private final int clientIndex; - - public TestThread(Cache cache, int threadIndex, int clientIndex) { - this.cache = cache; - this.threadIndex = threadIndex; - this.clientIndex = clientIndex; - } - - @Override - public void run() { - System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex); - long start = System.currentTimeMillis(); - Random rand = new Random(start); - while (System.currentTimeMillis() - start < TIME_TO_RUN) { - if (rand.nextInt(100) < WRITE_PERCENTAGE) { - this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS))); - } else { - String key = "key" + rand.nextInt(NUM_OF_ELEMENTS); - Assert.assertNotNull("value for " + key + " is null", this.cache.get(key)); - } - } - } - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0) @@ -1,32 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.wan; - -/** - * @author Eugene Shelestovich - */ -public interface Watchable { - - /** - * - */ - void goLive(); - - void die(); - - /** - * Checks whether or not a given Watchable is alive. - * - * @return {@code true} if a given Watchable is alive, {@code false} otherwise - */ - boolean probeLiveness(); - - /** - * Returns a name which uniquely identifies the Watchable. - * - * @return unique name - */ - String name(); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0) @@ -1,147 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs.blocking; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - - -/** - * Test cases for the {@link UpdatingSelfPopulatingCache}. - * - * @author Greg Luck - * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $ - */ -public class UpdatingSelfPopulatingCacheTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private CacheManager cacheManager; - private Cache cache; - - @Before - public void setUp() throws Exception { - Configuration configuration = new Configuration(); - configuration.name("upSelfPopCM") - .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath())) - .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2) - .timeToLiveSeconds(5) - .overflowToDisk(true) - .diskPersistent(true)); - cacheManager = CacheManager.newInstance(configuration); - cache = cacheManager.getCache("cache"); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - /** - * Tests fetching an entry, and then an update. - */ - @Test - public void testFetchAndUpdate() throws Exception { - final Object value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - - //test null - Element element = selfPopulatingCache.get(null); - - // Lookup - element = selfPopulatingCache.get("key"); - assertThat(element.getObjectValue(), sameInstance(value)); - assertThat(factory.getCount(), is(2)); - - Object actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(3)); - - actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(4)); - } - - /** - * Tests when fetch fails. - */ - @Test - public void testFetchFail() throws Exception { - final Exception exception = new Exception("Failed."); - final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() { - public Object createEntry(final Object key) - throws Exception { - throw exception; - } - - public void updateEntryValue(Object key, Object value) - throws Exception { - throw exception; - } - }; - - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Lookup - try { - selfPopulatingCache.get("key"); - fail(); - } catch (final Exception e) { - // Check the error - assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage()); - } - } - - /** - * Tests refreshing the entries. - */ - @Test - public void testRefresh() throws Exception { - final String value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Refresh - try { - selfPopulatingCache.refresh(); - fail(); - } catch (CacheException e) { - //expected. - assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 0) @@ -1,34 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import java.util.Map; - -import javax.management.ObjectName; - -/** - * @author Abhishek Sanoujam - */ -public interface DSOMBean { - - long getGlobalServerMapGetSizeRequestsCount(); - - long getGlobalServerMapGetValueRequestsCount(); - - long getGlobalServerMapGetSizeRequestsRate(); - - long getGlobalServerMapGetValueRequestsRate(); - - long getReadOperationRate(); - - Map getServerMapGetSizeRequestsCount(); - - Map getServerMapGetValueRequestsCount(); - - Map getServerMapGetSizeRequestsRate(); - - Map getServerMapGetValueRequestsRate(); - - Void dumpClusterState(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0) @@ -1,87 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.statistics.extended; - -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.StatisticArchive; -import org.terracotta.statistics.archive.StatisticSampler; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class SampledStatistic. - * - * @param the generic type - * @author cdennis - */ -class SampledStatistic { - - /** The sampler. */ - private final StatisticSampler sampler; - - /** The history. */ - private final StatisticArchive history; - - /** - * Instantiates a new sampled statistic. - * - * @param statistic the statistic - * @param executor the executor - * @param historySize the history size - * @param periodNanos the period nanos - */ - public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) { - this.history = new StatisticArchive(historySize); - this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history); - } - - /** - * Start sampling. - */ - public void startSampling() { - sampler.start(); - } - - /** - * Stop sampling. - */ - public void stopSampling() { - sampler.stop(); - history.clear(); - } - - /** - * History. - * - * @return the list - */ - public List> history() { - return history.getArchive(); - } - - /** - * Adjust. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void adjust(int historySize, long historyNanos) { - history.setCapacity(historySize); - sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.transaction.SoftLockID; - -/** - * @author Alex Snaps - */ -public class TxCopyStrategyHandler extends CopyStrategyHandler { - - /** - * Creates a TxCopyStrategyHandler based on the copy configuration - * - * @param copyOnRead copy on read flag - * @param copyOnWrite copy on write flag - * @param copyStrategy the copy strategy to use - * @param loader - */ - public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) { - super(copyOnRead, copyOnWrite, copyStrategy, loader); - } - - @Override - public Element copyElementForReadIfNeeded(final Element element) { - final Object objectValue = element.getObjectValue(); - if (objectValue instanceof SoftLockID) { - return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement()); - } - return super.copyElementForReadIfNeeded(element); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0) @@ -1,40 +0,0 @@ -RULE trace RemoteTransactionManagerImpl commitWithoutThrottling -CLASS RemoteTransactionManagerImpl -METHOD commitWithoutThrottling -AT ENTRY -IF true -DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterEntry -CLASS ClusteredStore -METHOD putWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterExit -CLASS ClusteredStore -METHOD putWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterEntry -CLASS ClusteredStore -METHOD removeWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterExit -CLASS ClusteredStore -METHOD removeWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 0) @@ -1,48 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.bootstrap; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; - -/** - * @author Greg Luck - * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public interface BootstrapCacheLoader { - - /** - * Instructs the loader to load the given cache - * @param cache cache to load - */ - void load(Ehcache cache) throws CacheException; - - /** - * - * @return true if this bootstrap loader is asynchronous - */ - boolean isAsynchronous(); - - /** - * Clones the loader - * - * @return clone of this instance - * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface. - */ - Object clone() throws CloneNotSupportedException; - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0) @@ -1,90 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.local; - -import net.sf.ehcache.transaction.TransactionID; -import net.sf.ehcache.transaction.TransactionIDFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * The local transactions mode recovery manager which is used to trigger full recovery of all - * caches configured with local transaction mode. - * - * @author Ludovic Orban - */ -public class LocalRecoveryManager { - - private final TransactionIDFactory transactionIdFactory; - private final List localTransactionStores = new CopyOnWriteArrayList(); - private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet(); - - /** - * Create a LocalRecoveryManager instance - * @param transactionIdFactory the TransactionIDFactory - */ - public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) { - this.transactionIdFactory = transactionIdFactory; - } - - /** - * Register a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void register(LocalTransactionStore localTransactionStore) { - localTransactionStores.add(localTransactionStore); - } - - /** - * Unregister a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void unregister(LocalTransactionStore localTransactionStore) { - localTransactionStores.remove(localTransactionStore); - } - - /** - * Run recovery on all registered local transaction stores. The latter - * are used internally by caches when they're configured with local transaction mode. - * @return the set of recovered TransactionIDs - */ - public Set recover() { - Set recovered = new HashSet(); - // first ask all stores to cleanup their soft locks - for (LocalTransactionStore localTransactionStore : localTransactionStores) { - recovered.addAll(localTransactionStore.recover()); - } - // then clear the transaction ID - for (TransactionID transactionId : recovered) { - transactionIdFactory.clear(transactionId); - } - - previouslyRecoveredTransactionIDs = recovered; - return recovered; - } - - /** - * Get the set of transaction IDs collected by the previous recover() call - * @return the set of previously recovered TransactionIDs - */ - public Set getPreviouslyRecoveredTransactionIDs() { - return previouslyRecoveredTransactionIDs; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 0) @@ -1,54 +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; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentBLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentBLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentBLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderB"; - } - - /** - * @param arg0 - * @return - * @throws CacheException - */ - public Object load(Object arg0) throws CacheException { - LOG.info("Loading Component B..."); - String key = (String) arg0; - return new ComponentB(key); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0) @@ -1,233 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.bulkops; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; - -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.TimeUnit; - -public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) { - super(testConfig, App.class, App.class); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG); - testBulkOpsSanity(dcv2StrongSerialization); - barrier.await(); - - Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL); - testBulkOpsSanity(dcv2EventualSerialization); - barrier.await(); - - barrier.await(); - - } - - private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException { - int index = barrier.await(); - int numOfElements = 100; - Set elements = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i))); - } - if (index == 0) { - cache.putAll(elements); - } - - barrier.await(); - while (cache.getSize() != numOfElements) { - Thread.sleep(1000); - } - Assert.assertEquals(numOfElements, cache.getSize()); - - Set keySet1 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - keySet1.add(new Key("key" + i, i)); - } - - Map rv = cache.getAll(keySet1); - Assert.assertEquals(numOfElements, rv.size()); - - Collection values = new HashSet(); - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - values.add(entry.getValue()); - } - - for (Element element : elements) { - Assert.assertTrue(values.contains(element)); - } - - Set keySet2 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - if (i % 2 == 0) { - keySet2.add(new Key("key" + i, i)); - } - } - - rv = cache.getAll(keySet2); - Assert.assertEquals(keySet2.size(), rv.size()); - - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.removeAll(keySet2); - System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - // sleep for 60 seconds for eventual caches - if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) { - Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS)); - } - } - index = barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client"); - for (Object key : keySet2) { - Assert.assertNull(cache.get(key)); - } - System.out.println("client " + index + " done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxElementsInMemory(100000); - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(100000); - cacheConfiguration.setTimeToIdleSeconds(200000); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency); - return cache; - } - } - - private static class Key implements Serializable { - private final String stringKey; - private final int intKey; - - public Key(String stringKey, int intKey) { - super(); - this.stringKey = stringKey; - this.intKey = intKey; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intKey; - result = prime * result + ((stringKey == null) ? 0 : stringKey.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Key other = (Key) obj; - if (intKey != other.intKey) return false; - if (stringKey == null) { - if (other.stringKey != null) return false; - } else if (!stringKey.equals(other.stringKey)) return false; - return true; - } - - @Override - public String toString() { - return stringKey; - } - - } - - private static class Value implements Serializable { - private final String keyVal; - private final int intVal; - - public Value(String keyVal, int intVal) { - this.keyVal = keyVal; - this.intVal = intVal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intVal; - result = prime * result + ((keyVal == null) ? 0 : keyVal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Value other = (Value) obj; - if (intVal != other.intVal) return false; - if (keyVal == null) { - if (other.keyVal != null) return false; - } else if (!keyVal.equals(other.keyVal)) return false; - return true; - } - - @Override - public String toString() { - return keyVal; - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0) @@ -1,21 +0,0 @@ -package org.terracotta.ehcache.tests.servermap; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase { - - public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) { - super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig, - ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class); - testConfig.setDgcEnabled(true); - testConfig.setDgcIntervalInSec(60); - testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true"); - - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000"); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 0) @@ -1,368 +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.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.properties.TCPropertiesConsts; -import com.tc.test.config.model.TestConfig; - -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.SECONDS; - -/** - * @author cdennis - */ -public class DynamicCacheConfigurationTest extends AbstractCacheTestBase { - public DynamicCacheConfigurationTest(TestConfig testConfig) { - super(testConfig, App.class); - testConfig.addTcProperty(TCPropertiesConsts.L2_SERVERMAP_EVICTION_CLIENTOBJECT_REFERENCES_REFRESH_INTERVAL, "5000"); - testConfig.addTcProperty(TCPropertiesConsts.EHCACHE_EVICTOR_LOGGING_ENABLED, "true"); - } - - public static class App extends ClientBase { - private static final double TOLERANCE = 0.1; - - 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 { - testTTIChange(cacheManager); - testTTLChange(cacheManager); - testDiskCapacityChange(cacheManager); - testMemoryCapacityChange(cacheManager); - testTTIChangeWithCustomElements(cacheManager); - testTTLChangeWithCustomElements(cacheManager); - } - - private Cache createCache(String cacheName, int maxMemory, boolean eternal, long ttl, long tti) { - return new Cache(new CacheConfiguration(cacheName, maxMemory) - .eternal(eternal) - .timeToLiveSeconds(ttl) - .timeToIdleSeconds(tti) - .clearOnFlush(true) - .terracotta(new TerracottaConfiguration().clustered(true).consistency(Consistency.STRONG) - .coherentReads(true).orphanEviction(true).orphanEvictionPeriod(4).localKeyCache(false) - .localKeyCacheSize(0).copyOnRead(false)).logging(true)); - } - - private void testTTIChange(CacheManager manager) throws InterruptedException { - Cache cache = createCache("testTTIChange", 10, false, 0, 10); - manager.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - cache.get("key2"); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - long currentTime = System.currentTimeMillis(); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("key1")); - if (System.currentTimeMillis() - currentTime < 20000 ) { - Assert.assertNotNull(cache.get("key2")); - } else { - Assert.assertNull(cache.get("key2")); - } - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - private void testTTLChange(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChange", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("key1")); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("key1")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - public void testTTIChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTIChangeWithCustomElements", 10, false, 0, 10); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("short")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - public void testTTLChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChangeWithCustomElements", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - private void testMemoryCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testMemoryCapacityChange", 100, true, 0, 0); - cache.getCacheConfiguration().getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG); - cm.addCache(cache); - - int i = 0; - for (; i < 150; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(200); - - for (; i < 250; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100, 200); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(50); - - for (; i < 350; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 50); - - cache.removeAll(); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int lowerBound, final int upperBound) - throws Exception { - final int min = (int) ((1 - TOLERANCE) * lowerBound); - final int max = (int) ((1 + TOLERANCE) * upperBound); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - if (cache.getStatistics().getLocalHeapSize() <= max && cache.getStatistics().getLocalHeapSize() >= min) { - return true; - } - System.out.println("Still waiting for memory store size to fall in bounds [" + lowerBound + ", " + upperBound - + "] current=" + cache.getStatistics().getLocalHeapSize()); - return false; - } - }); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int upperBound) throws Exception { - waitForCacheMemoryStoreSize(cache, 0, upperBound); - } - - public void testDiskCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testDiskCapacityChange", 10, true, 0, 0); - cache.getCacheConfiguration().maxEntriesLocalHeap(1).maxEntriesInCache(100).getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG).concurrency(16); - cm.addCache(cache); - - testCacheDiskCapacity(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesInCache(200); - - testCacheDiskCapacity(cache, 200); - - cache.getCacheConfiguration().setMaxEntriesInCache(50); - - testCacheDiskCapacity(cache, 50); - - cache.removeAll(); - } - - private void testCacheDiskCapacity(final Cache cache, final int capacity) throws Exception { - for (int i = 0; i < 1000; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - System.out.println("Waiting on capacoty of " + capacity); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - System.out.println("Current cache size " + cache.getSize()); - Assert.assertTrue(cache.getSize() > capacity * .85); - return cache.getSize() >= capacity * 0.9 && cache.getSize() <= capacity * 1.1; - } - }); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0) @@ -1,161 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.parser; - -import net.sf.ehcache.search.expression.And; -import net.sf.ehcache.search.expression.EqualTo; -import net.sf.ehcache.search.expression.GreaterThan; -import net.sf.ehcache.search.expression.GreaterThanOrEqual; -import net.sf.ehcache.search.expression.ILike; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.LessThanOrEqual; -import net.sf.ehcache.search.expression.Not; -import net.sf.ehcache.search.expression.NotEqualTo; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.parser.MCriteria.Between; -import net.sf.ehcache.search.parser.MCriteria.Simple; -import net.sf.ehcache.search.parser.MValue.MInt; - -import org.junit.Assert; -import org.junit.Test; - -public class MCriteriaTest { - - private final ClassLoader loader = getClass().getClassLoader(); - - @Test - public void testSimpleModelCriteria() throws CustomParseException { - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj); - EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj); - NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj); - GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj); - GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj); - LessThan crit = (LessThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj); - LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - } - - void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) { - Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max); - net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), name); - Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader)); - Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader)); - Assert.assertEquals(crit.isMinInclusive(), min); - Assert.assertEquals(crit.isMaxInclusive(), max); - } - - @Test - public void testBetween() throws CustomParseException { - MInt obj1 = new MValue.MInt(null, "0"); - MInt obj2 = new MValue.MInt(null, "110"); - checkBetween("foo", obj1, false, obj2, false); - checkBetween("foo", obj1, true, obj2, false); - checkBetween("foo", obj1, false, obj2, true); - checkBetween("foo", obj1, true, obj2, true); - } - - @Test - public void testIlike() { - MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo"); - ILike crit = (ILike)ilike.asEhcacheObject(loader); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testLike() { - MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo"); - ILike crit = (ILike)like.asEhcacheObject(loader); - Assert.assertEquals(like.getLikeRegex(), "foo.%foo"); - Assert.assertEquals(like.getILikeRegex(), "foo.*foo"); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testNot() throws CustomParseException { - MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1")); - MCriteria.Not not = new MCriteria.Not(simple); - Not crit = (Not)not.asEhcacheObject(loader); - @SuppressWarnings("unused") - EqualTo inner = (EqualTo)crit.getCriteria(); - Assert.assertTrue(true); // the casts are sufficient for the test. - } - - @Test - public void testAnd() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5")); - - MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3); - And crit = (And)and.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof And); - And crit2 = (And)crit.getCriterion()[1]; - Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan); - Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo); - - } - - @Test - public void testOr() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2); - - Or crit = (Or)or.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - -import net.sf.ehcache.Ehcache; - -public interface AsyncCoordinatorFactory { - AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config); - - boolean destroy(String cacheManagerName, String cacheName); -} Index: rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,342 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error -org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 0) @@ -1,194 +0,0 @@ -/** - * All content copyright 2010 (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package net.sf.ehcache.servermaplocalcache; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListenerAdapter; - -public class ServerMapLocalCache { - - private final static int CONCURRENCY = 256; - private volatile TCObjectSelfStore tcoSelfStore; - private volatile Cache ehcache; - private final ReentrantReadWriteLock[] locks = new ReentrantReadWriteLock[CONCURRENCY]; - private final Object localSync = new Object(); - private static final ExecutorService evictionHandlerStage = Executors.newFixedThreadPool(4, new ThreadFactory() { - private final AtomicInteger count = new AtomicInteger(); - - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "eviction_handler_stage_thread_" + count.incrementAndGet()); - t.setDaemon(true); - return t; - } - }); - - public ServerMapLocalCache(TCObjectSelfStore tcoSelfStore, Cache ehcache) { - this.tcoSelfStore = tcoSelfStore; - this.ehcache = ehcache; - ehcache.getCacheEventNotificationService().registerListener(new EvictionListener(this)); - for (int i = 0; i < CONCURRENCY; i++) { - locks[i] = new ReentrantReadWriteLock(); - } - } - - private ReentrantReadWriteLock getLock(Object key) { - return locks[Math.abs(key.hashCode() % CONCURRENCY)]; - } - - public void put(TCObjectSelf tcoSelf) { - synchronized (localSync) { - tcoSelfStore.addTCObjectSelf(tcoSelf); - addToCache(tcoSelf); - } - } - - public TCObjectSelf getFromTCObjectSelfStore(Long oid) { - synchronized (localSync) { - return tcoSelfStore.getById(oid); - } - } - - // public void remove(String key) { - // synchronized (localSync) { - // removeFromCache(key); - // } - // } - // - // private void removeFromCache(String key) { - // WriteLock writeLock = getLock(key).writeLock(); - // writeLock.lock(); - // try { - // // remove key-value mapping: key->value - // Element element = ehcache.removeAndReturnElement(key); - // if (element != null) { - // TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - // if (tcoSelf != null) { - // handleKeyValueMappingRemoved(key, tcoSelf); - // } - // } - // - // } finally { - // writeLock.unlock(); - // } - // } - - private void handleKeyValueMappingRemoved(String key, TCObjectSelf tcoSelf) { - // remote remove - tcoSelfStore.removeTCObjectSelf(tcoSelf); - if (tcoSelf != null) { - // clean up meta-mapping: id->key - ehcache.remove(tcoSelf.getOid()); - } - } - - private void addToCache(TCObjectSelf tcoSelf) { - ReentrantReadWriteLock lock = getLock(tcoSelf.getKey()); - lock.writeLock().lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Add to cache: " + tcoSelf); - } - - // add meta mapping: oid->key - ehcache.put(new Element(tcoSelf.getOid(), tcoSelf.getKey())); - - // add the key->value mapping - ehcache.put(new Element(tcoSelf.getKey(), tcoSelf)); - - } finally { - lock.writeLock().unlock(); - } - } - - public void entryEvicted(Object objectKey, Object objectValue) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Entry evicted; evictedKey: " + objectKey + ", evictedValue: " + objectValue); - } - if (objectValue instanceof TCObjectSelf) { - // key-value mapping evicted - keyValueMappingEvicted((String) objectKey, (TCObjectSelf) objectValue); - } else { - // oid-> key mapping removed - objectIdMappingEvicted((Long) objectKey, (String) objectValue); - } - } - - private void objectIdMappingEvicted(Long oid, String key) { - WriteLock writeLock = getLock(key).writeLock(); - writeLock.lock(); - Element element = null; - try { - element = ehcache.get(key); - if (element != null) { - TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - if (tcoSelf != null && tcoSelf.getOid() == oid) { - // clean up key-value mapping - ehcache.remove(key); - tcoSelfStore.removeTCObjectSelf(tcoSelf); - } - } - } finally { - writeLock.unlock(); - } - if (DebugUtil.DEBUG) { - DebugUtil.debug("[objectIdEvicted] oid: " + oid + ", key: " + key + ", was mapped to value: " - + (element == null ? "null" : element.getObjectValue())); - } - } - - private void keyValueMappingEvicted(String objectKey, TCObjectSelf objectValue) { - WriteLock writeLock = getLock(objectKey).writeLock(); - writeLock.lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[keyValueMappingEvicted] key: " + objectKey + ", value: " + objectValue); - } - handleKeyValueMappingRemoved(objectKey, objectValue); - } finally { - writeLock.unlock(); - } - } - - private static class EvictionListener extends CacheEventListenerAdapter { - private final ServerMapLocalCache serverMapLocalCache; - - public EvictionListener(ServerMapLocalCache serverMapLocalCache) { - this.serverMapLocalCache = serverMapLocalCache; - } - - @Override - public void notifyElementExpired(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementExpired] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - - @Override - public void notifyElementEvicted(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementEvicted] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to LiveCacheStatistics and its implementation. - - - Index: rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 0) @@ -1,45 +0,0 @@ - - distribution - - tar.gz - - - - - - - - - - - - ${basedir}/src - /src - - - ${project.build.directory}/${project.name} - - **/ehcache*.jar - **/terracotta-toolkit*-runtime*.jar - - /webapps/${project.name} - - - ${basedir}/src/assemble - - README.* - - / - - - ${basedir}/src/assemble/jetty6.1 - /jetty6.1 - - - ${basedir}/src/assemble/bin - /bin - 0755 - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 0) @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 0) @@ -1,28 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class VersionedItem extends Item { - private Long version; - - public Long getVersion() { - return version; - } - - public void setVersion(Long version) { - this.version = version; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0) @@ -1,309 +0,0 @@ -package net.sf.ehcache.constructs.eventual; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * StronglyConsistentCacheAccessorTest - */ -@Category(CheckShorts.class) -public class StronglyConsistentCacheAccessorTest { - - @Test - public void refusesStandaloneCache() { - try { - new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600)); - fail("Underlying cache not clustered and eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void refusesClusteredButNoEventualCache() { - TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG); - - try { - new StronglyConsistentCacheAccessor(underlyingCache); - fail("Underlying cache clustered but not eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void acceptClusteredAndEventualUnderlyingCache() { - Ehcache underlyingCache = buildMockCache(); - - new StronglyConsistentCacheAccessor(underlyingCache); - } - - @Test - public void testPutIfAbsent() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.putIfAbsent(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.putIfAbsent(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.putIfAbsent(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testSingleArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.replace(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.replace(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.replace(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testTwoArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false)); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true)); - - try { - cacheAccessor.replace(new Element(null, null), new Element("key", "other")); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - - try { - cacheAccessor.replace(new Element("key", "other"), new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testRemoveElement() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element); - when(underlyingCache.remove((Object)"key")).thenReturn(true); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.removeElement(element), is(false)); - assertThat(cacheAccessor.removeElement(element), is(true)); - - try { - cacheAccessor.removeElement(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void putMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - String put = "put"; - Set putMethods = getMethodsMatching(put); - for (Method putMethod : putMethods) { - int paramLength = putMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + putMethod.getName()); - putMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void replaceMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - Set replaceMethods = getMethodsMatching("replace"); - for (Method replaceMethod : replaceMethods) { - int paramLength = replaceMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) { - params[1] = element; - } - System.out.println("Invoking " + replaceMethod.getName()); - replaceMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void removeMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "someValue"); - - String remove = "remove"; - Set removeMethods = getMethodsMatching(remove, "Property"); - for (Method removeMethod : removeMethods) { - System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")"); - int paramLength = removeMethod.getParameterTypes().length; - if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) { - continue; - } - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = element; - } else { - params[0] = key; - } - if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params)); - removeMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void getMethodsDoReadLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "key"; - String get = "get"; - Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid"); - for (Method getMethod : getMethods) { - System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")"); - int paramLength = getMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else { - params[0] = key; - } - - System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params)); - getMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireReadLockOnKey(key); - verify(ehcache).releaseReadLockOnKey(key); - reset(ehcache); - } - } - - private Set getMethodsMatching(String put, String... excludes) { - Set results = new HashSet(); - Method[] methods = Ehcache.class.getMethods(); - for (Method method : methods) { - if (method.getName().contains(put)) { - boolean exclude = false; - for (String exclusion : excludes) { - if (method.getName().contains(exclusion)) { - exclude = true; - } - } - if (!exclude) { - results.add(method); - } - } - } - return results; - } - - private Ehcache buildMockCache() {TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(cacheConfiguration.getElementValueComparatorConfiguration()).thenReturn(new ElementValueComparatorConfiguration()); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.EVENTUAL); - return underlyingCache; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0) @@ -1,440 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Direction; -import net.sf.ehcache.search.ExecutionHints; -import net.sf.ehcache.search.Query; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.expression.AlwaysMatch; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.store.StoreQuery; - -/** - * Query builder implementation. Instances are bound to a specific cache - * - * @author teck - */ -class CacheQuery implements Query, StoreQuery { - - private volatile boolean frozen; - private volatile boolean includeKeys; - private volatile boolean includeValues; - private volatile int maxResults = -1; - private String[] targets; - - private final List orderings = Collections.synchronizedList(new ArrayList()); - private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>()); - private final List criteria = Collections.synchronizedList(new ArrayList()); - private final List aggregators = Collections.synchronizedList(new ArrayList()); - private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>()); - - private final Cache cache; - private volatile ExecutionHints hints; - - /** - * Create a new builder instance - * - * @param cache - */ - public CacheQuery(Cache cache) { - this.cache = cache; - } - - /** - * {@inheritDoc} - */ - public Query includeKeys() { - checkFrozen(); - this.includeKeys = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeValues() { - checkFrozen(); - this.includeValues = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAttribute(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - - this.includedAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException { - checkFrozen(); - - if (aggregators == null) { - throw new NullPointerException(); - } - - for (Aggregator aggregator : aggregators) { - if (aggregator == null) { - throw new NullPointerException("null aggregator"); - } - - this.aggregators.add(aggregator); - } - - return this; - } - - /** - * {@inheritDoc} - */ - public Query addOrderBy(Attribute> attribute, Direction direction) { - checkFrozen(); - this.orderings.add(new OrderingImpl(attribute, direction)); - return this; - } - - /** - * {@inheritDoc} - */ - public Query addGroupBy(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - groupByAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query maxResults(int maxResults) { - checkFrozen(); - this.maxResults = maxResults; - return this; - } - - /** - * {@inheritDoc} - */ - public Query addCriteria(Criteria criteria) { - checkFrozen(); - - if (criteria == null) { - throw new NullPointerException("null criteria"); - } - - this.criteria.add(criteria); - return this; - } - - /** - * {@inheritDoc} - */ - public Results execute() throws SearchException { - return cache.executeQuery(snapshot()); - } - - /** - * {@inheritDoc} - */ - public Results execute(ExecutionHints params) throws SearchException { - this.hints = params; - return cache.executeQuery(snapshot()); - } - - - /** - * {@inheritDoc} - */ - public Query end() { - frozen = true; - return this; - } - - /** - * {@inheritDoc} - */ - public List getOrdering() { - assertFrozen(); - return Collections.unmodifiableList(orderings); - } - - /** - * {@inheritDoc} - */ - public Criteria getCriteria() { - assertFrozen(); - return getEffectiveCriteriaCopy(); - } - - /** - * {@inheritDoc} - */ - public boolean requestsKeys() { - assertFrozen(); - return includeKeys; - } - - /** - * {@inheritDoc} - */ - public boolean requestsValues() { - assertFrozen(); - return includeValues; - } - - /** - * {@inheritDoc} - */ - public Cache getCache() { - assertFrozen(); - return cache; - } - - /** - * {@inheritDoc} - */ - public Set> requestedAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.includedAttributes); - } - - /** - * {@inheritDoc} - */ - public Set> groupByAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.groupByAttributes); - } - - /** - * {@inheritDoc} - */ - public int maxResults() { - assertFrozen(); - return maxResults; - } - - - /** - * {@inheritDoc} - */ - @Override - public ExecutionHints getExecutionHints() { - assertFrozen(); - return hints; - } - - /** - * {@inheritDoc} - */ - public List getAggregators() { - return Collections.unmodifiableList(this.aggregators); - } - - /** - * {@inheritDoc} - */ - public List> getAggregatorInstances() { - assertFrozen(); - return Collections.unmodifiableList(createAggregatorInstances(aggregators)); - } - - private static List> createAggregatorInstances(List aggregators) { - List> rv = new ArrayList>(aggregators.size()); - for (Aggregator aggregator : aggregators) { - rv.add(aggregator.createInstance()); - } - - return rv; - } - - private Criteria getEffectiveCriteriaCopy() { - Criteria result = new AlwaysMatch(); - for (Criteria c : criteria) { - result = result.and(c); - } - return result; - } - - private void assertFrozen() { - if (!frozen) { - throw new AssertionError("not frozen"); - } - } - - private StoreQuery snapshot() { - if (frozen) { - return this; - } - - return new StoreQueryImpl(); - } - - private void checkFrozen() { - if (frozen) { - throw new SearchException("Query is frozen and cannot be mutated"); - } - } - - /** - * {@inheritDoc} - */ - public String[] getTargets() { - return this.targets; - } - - /** - * {@inheritDoc} - */ - @Override - public void targets(final String[] targets) { - this.targets = targets; - } - - /** - * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder - */ - private class StoreQueryImpl implements StoreQuery { - private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy(); - private final boolean copiedIncludeKeys = includeKeys; - private final boolean copiedIncludeValues = includeValues; - private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes)); - private final int copiedMaxResults = maxResults; - private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings)); - private final List copiedAggregators = Collections.unmodifiableList(aggregators); - private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators)); - private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes)); - private final ExecutionHints execHints = hints; - - public Criteria getCriteria() { - return copiedCriteria; - } - - public boolean requestsKeys() { - return copiedIncludeKeys; - } - - public boolean requestsValues() { - return copiedIncludeValues; - } - - public Cache getCache() { - return cache; - } - - public Set
TERRACOTTA
- * This is the Ehcache specific equivalent to Hibernate's ReadOnlyCache. - * - * @author Chris Dennis - */ -@Deprecated -public class EhcacheReadOnlyCache extends AbstractEhcacheConcurrencyStrategy { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheReadOnlyCache.class); - - /** - * {@inheritDoc} - */ - public Object get(Object key, long timestamp) throws CacheException { - return cache.get(key); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public SoftLock lock(Object key, Object version) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - public boolean put(Object key, Object value, long timestamp, Object version, - Comparator versionComparator, boolean minimalPut) throws CacheException { - if (minimalPut && cache.get(key) != null) { - return false; - } else { - cache.put(key, value); - return true; - } - } - - /** - * Logs an error since items in a read-only cache should not be mutated. - */ - public void release(Object key, SoftLock lock) { - LOG.error("Application attempted to edit read only item: " + key); - //throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean afterUpdate(Object key, Object value, Object version, SoftLock lock) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * Inserts the specified item into the cache. - */ - public boolean afterInsert(Object key, Object value, Object version) throws CacheException { - cache.update(key, value); - return true; - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public void evict(Object key) throws CacheException { - } - - /** - * A No-Op, since we are an asynchronous cache concurrency strategy. - */ - public boolean insert(Object key, Object value, Object currentVersion) { - return false; - } - - /** - * Throws UnsupportedOperationException since items in a read-only cache should not be mutated. - * - * @throws UnsupportedOperationException always - */ - public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws UnsupportedOperationException { - LOG.error("Application attempted to edit read only item: " + key); - throw new UnsupportedOperationException("Can't write to a readonly object"); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return cache + "(read-only)"; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/search/expression/ILike.java (revision 0) @@ -1,163 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.expression; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; -import java.util.regex.Pattern; - -import net.sf.ehcache.Element; -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.attribute.AttributeExtractor; - -/** - * A regular expression criteria that matches attribute string values. For non java.lang.String attributes, - * the toString() form is used in the comparison. - * - * Expressions are always case insensitive - * - * The following special characters are supported: - *
java.lang.String attributes
toString()
- * - * @author teck - */ -public class ILike extends BaseCriteria { - - private final String attributeName; - private final String regex; - private final Pattern pattern; - - /** - * Construct a "like" criteria for the given expression - * - * @param attributeName attribute name - * @param regex expression - */ - public ILike(String attributeName, String regex) { - if ((attributeName == null) || (regex == null)) { - throw new SearchException("Both the attribute name and regex must be non null."); - } - - this.attributeName = attributeName; - this.regex = regex; - this.pattern = convertRegex(regex.trim()); - } - - /** - * Return attribute name. - * - * @return String attribute name - */ - public String getAttributeName() { - return attributeName; - } - - /** - * Return regex string. - * - * @return String regex. - */ - public String getRegex() { - return regex; - } - - private static Pattern convertRegex(final String expr) { - if (expr.length() == 0) { - throw new SearchException("Zero length regex"); - } - - StringBuilder javaRegex = new StringBuilder("^"); - - boolean escape = false; - for (int i = 0; i < expr.length(); i++) { - char ch = expr.charAt(i); - - if (escape) { - switch (ch) { - case '\\': - case '?': - case '*': { - javaRegex.append(Pattern.quote(lowerCase(ch))); - break; - } - - default: { - throw new SearchException("Illegal escape character (" + ch + ") in regex: " + expr); - } - } - - escape = false; - } else { - switch (ch) { - case '\\': { - escape = true; - break; - } - case '?': { - javaRegex.append("."); - break; - } - case '*': { - javaRegex.append(".*"); - break; - } - default: { - javaRegex.append(Pattern.quote(lowerCase(ch))); - } - } - } - } - - javaRegex.append("$"); - - return Pattern.compile(javaRegex.toString(), Pattern.DOTALL); - } - - private static String lowerCase(char ch) { - // heeding the advice in Character.toLowerCase() and using String.toLowerCase() instead here - return Character.toString(ch).toLowerCase(); - } - - /** - * {@inheritDoc} - */ - public boolean execute(Element e, Map attributeExtractors) { - Object value = getExtractor(attributeName, attributeExtractors).attributeFor(e, attributeName); - if (value == null) { - return false; - } - - String asString = value.toString().toLowerCase(); - - return pattern.matcher(asString).matches(); - } - - @Override - public Set> getAttributes() { - return Collections.>singleton(new Attribute(attributeName)); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/writebehind/KeyBasedOperationWrapper.java (revision 0) @@ -1,24 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.writebehind; - -import net.sf.ehcache.writer.writebehind.operations.KeyBasedOperation; - -public class KeyBasedOperationWrapper implements KeyBasedOperation { - private final Object key; - private final long creationTime; - - public KeyBasedOperationWrapper(Object key, long creationTime) { - this.key = key; - this.creationTime = creationTime; - } - - public Object getKey() { - return key; - } - - public long getCreationTime() { - return creationTime; - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/hibernate/domain/Person.java (revision 0) @@ -1,108 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.hibernate.domain; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class Person { - - private Long id; - private int age; - private String firstname; - private String lastname; - private List events = new ArrayList(); // list semantics, e.g., indexed - private Set emailAddresses = new HashSet(); - private Set phoneNumbers = new HashSet(); - private List talismans = new ArrayList(); // a Bag of good-luck charms. - - public Person() { - // - } - - public List getEvents() { - return events; - } - - protected void setEvents(List events) { - this.events = events; - } - - public void addToEvent(Event event) { - this.getEvents().add(event); - event.getParticipants().add(this); - } - - public void removeFromEvent(Event event) { - this.getEvents().remove(event); - event.getParticipants().remove(this); - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLastname() { - return lastname; - } - - public void setLastname(String lastname) { - this.lastname = lastname; - } - - public Set getEmailAddresses() { - return emailAddresses; - } - - public void setEmailAddresses(Set emailAddresses) { - this.emailAddresses = emailAddresses; - } - - public Set getPhoneNumbers() { - return phoneNumbers; - } - - public void setPhoneNumbers(Set phoneNumbers) { - this.phoneNumbers = phoneNumbers; - } - - public void addTalisman(String name) { - talismans.add(name); - } - - public List getTalismans() { - return talismans; - } - - public void setTalismans(List talismans) { - this.talismans = talismans; - } - - public String toString() { - return getFirstname() + " " + getLastname(); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/hibernate/regions/EhcacheEntityRegion.java (revision 0) @@ -1,61 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.regions; - -import java.util.Properties; - -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.hibernate.strategy.EhcacheAccessStrategyFactory; - -import org.hibernate.cache.CacheDataDescription; -import org.hibernate.cache.CacheException; -import org.hibernate.cache.EntityRegion; -import org.hibernate.cache.access.AccessType; -import org.hibernate.cache.access.EntityRegionAccessStrategy; -import org.hibernate.cfg.Settings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * An entity region specific wrapper around an Ehcache instance. - * - * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access - * is not supported. - * - * @author Chris Dennis - * @author Abhishek Sanoujam - */ -public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class); - - /** - * Constructs an EhcacheEntityRegion around the given underlying cache. - * - * @param accessStrategyFactory - */ - public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings, - CacheDataDescription metadata, Properties properties) { - super(accessStrategyFactory, underlyingCache, settings, metadata, properties); - } - - /** - * {@inheritDoc} - */ - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType); - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0) @@ -1,162 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2; -import net.sf.ehcache.management.sampled.CacheSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntityV2; - -/** - * A builder for {@link CacheStatisticSampleEntityV2} resource objects. - * - * @author brandony - */ -final class CacheStatisticSampleEntityBuilderV2 { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class); - - private static final String SAMPLE_SUFFIX = "Sample"; - - private final Set sampleNames; - - private final Map> samplersByCMName = new HashMap>(); - - static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) { - return new CacheStatisticSampleEntityBuilderV2(statisticSampleName); - } - - private CacheStatisticSampleEntityBuilderV2(Set sampleNames) { - this.sampleNames = sampleNames; - } - - CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler, - String cacheManagerName) { - addSampler(sampler, cacheManagerName); - return this; - } - - Collection build() { - Collection csses = new ArrayList(); - - for (Map.Entry> entry : samplersByCMName.entrySet()) { - for (CacheSampler sampler : entry.getValue()) { - if (sampleNames == null) { - for (Method m : CacheSampler.class.getMethods()) { - if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } else { - for (String sampleName : sampleNames) { - Method sampleMethod; - try { - sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX); - } catch (NoSuchMethodException e) { - LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName); - continue; - } - - if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } - } - } - - return csses; - } - - private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod, - CacheSampler sampler, - String cmName) { - SampledCounter sCntr; - try { - sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler)); - } catch (IllegalAccessException e) { - LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.", - sampleMethod.getName()); - sCntr = null; - } catch (InvocationTargetException e) { - LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e); - sCntr = null; - } - - if (sCntr != null) { - CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2(); - csse.setCacheManagerName(cmName); - csse.setName(sampler.getCacheName()); - csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID); - // csse.setVersion(this.getClass().getPackage().getImplementationVersion()); - csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, "")); - - TimeStampedCounterValue[] tscvs; - if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) { - tscvs = new TimeStampedCounterValue[0]; - } else { - tscvs = sCntr.getAllSampleValues(); - } - - Map statValueByTime = new TreeMap(); - csse.setStatValueByTimeMillis(statValueByTime); - - for (TimeStampedCounterValue tscv : tscvs) { - statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue()); - } - return csse; - } - - return null; - } - - private Set getExcludedMethodNames(CacheSampler sampler) { - if (sampler.isLocalHeapCountBased()) { - return Collections.singleton("getLocalHeapSizeInBytesSample"); - } - return Collections.emptySet(); - } - - private void addSampler(CacheSampler sampler, - String cacheManagerName) { - if (sampler == null) { - throw new IllegalArgumentException("sampler == null"); - } - - if (cacheManagerName == null) { - throw new IllegalArgumentException("cacheManagerName == null"); - } - - Set samplers = samplersByCMName.get(cacheManagerName); - - if (samplers == null) { - samplers = new HashSet(); - samplersByCMName.put(cacheManagerName, samplers); - } - - samplers.add(sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0) @@ -1,60 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -@Category(CheckShorts.class) -public class DecoratedCacheConfigTest { - - private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache", - "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"}); - - @Test - public void testDecoratedCacheConfig() { - CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource( - "ehcache-decorator-noname-test.xml")); - try { - List names = new ArrayList(Arrays.asList(cm.getCacheNames())); - names.removeAll(ALL_CACHE_NAMES); - Assert.assertEquals("This list should be empty - " + names, 0, names.size()); - // System.out.println("Original config: " + cm.getOriginalConfigurationText()); - String text = cm.getActiveConfigurationText(); - // System.out.println("Cache manager config: " + text); - for (String name : ALL_CACHE_NAMES) { - Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\"")); - String cacheConfigTest = cm.getActiveConfigurationText(name); - // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest); - Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ", - cacheConfigTest.contains("name=\"" + name + "\"")); - } - - } finally { - cm.shutdown(); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/resources/serializedforms/SerializationCopyStrategySerializationTest.testBasic.ser =================================================================== diff -u -N -r10926 -r10963 Binary files differ Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0) @@ -1,149 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.util.Random; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - private static final int NUM_OF_ELEMENTS = 1000; - private static final int NUM_OF_THREADS = 10; - private static final int WRITE_PERCENTAGE = 5; - - public L1BMOnHeapReadWriteTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class); - } - - public static class L1BMOnHeapReadWriteTestApp extends ClientBase { - private final ToolkitBarrier barrier; - - public L1BMOnHeapReadWriteTestApp(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new L1BMOnHeapReadWriteTestApp(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - boolean shouldWait = true; - Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true); - testL1BigMemorySanity(eventualWithStatsCache, shouldWait); - eventualWithStatsCache.removeAll(); - - Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false); - testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait); - eventualWithoutStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true); - testL1BigMemorySanity(strongWithStatsCache, shouldWait); - strongWithStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false); - testL1BigMemorySanity(strongWithoutStatsCache, shouldWait); - strongWithoutStatsCache.removeAll(); - } - - private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException, - BrokenBarrierException { - int index = barrier.await(); - if (index == 0) { - System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache"); - for (int i = 0; i < NUM_OF_ELEMENTS; i++) { - cache.put(new Element("key" + i, "val" + i)); - } - System.out.println("XXXXX done with putting " + cache.getSize() + " entries"); - } - barrier.await(); - if (shouldWait) { - while (cache.getSize() != NUM_OF_ELEMENTS) { - Thread.sleep(1000); - } - } - Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize()); - System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: " - + cache.getStatistics().getLocalHeapSize()); - if (index == 0) { - Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0); - } else { - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize()); - } - - System.out.println("XXXXX starting test threads...."); - Thread ths[] = new Thread[NUM_OF_THREADS]; - for (int i = 0; i < NUM_OF_THREADS; i++) { - ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i); - ths[i].start(); - } - - for (Thread th : ths) { - th.join(); - } - barrier.await(); - System.out.println("XXXXXX done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxBytesLocalHeap(10485760L); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - return cache; - } - - private static class TestThread implements Runnable { - private final long TIME_TO_RUN = 1 * 60 * 1000; - private final Cache cache; - private final int threadIndex; - private final int clientIndex; - - public TestThread(Cache cache, int threadIndex, int clientIndex) { - this.cache = cache; - this.threadIndex = threadIndex; - this.clientIndex = clientIndex; - } - - @Override - public void run() { - System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex); - long start = System.currentTimeMillis(); - Random rand = new Random(start); - while (System.currentTimeMillis() - start < TIME_TO_RUN) { - if (rand.nextInt(100) < WRITE_PERCENTAGE) { - this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS))); - } else { - String key = "key" + rand.nextInt(NUM_OF_ELEMENTS); - Assert.assertNotNull("value for " + key + " is null", this.cache.get(key)); - } - } - } - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0) @@ -1,32 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.wan; - -/** - * @author Eugene Shelestovich - */ -public interface Watchable { - - /** - * - */ - void goLive(); - - void die(); - - /** - * Checks whether or not a given Watchable is alive. - * - * @return {@code true} if a given Watchable is alive, {@code false} otherwise - */ - boolean probeLiveness(); - - /** - * Returns a name which uniquely identifies the Watchable. - * - * @return unique name - */ - String name(); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0) @@ -1,147 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs.blocking; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - - -/** - * Test cases for the {@link UpdatingSelfPopulatingCache}. - * - * @author Greg Luck - * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $ - */ -public class UpdatingSelfPopulatingCacheTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private CacheManager cacheManager; - private Cache cache; - - @Before - public void setUp() throws Exception { - Configuration configuration = new Configuration(); - configuration.name("upSelfPopCM") - .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath())) - .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2) - .timeToLiveSeconds(5) - .overflowToDisk(true) - .diskPersistent(true)); - cacheManager = CacheManager.newInstance(configuration); - cache = cacheManager.getCache("cache"); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - /** - * Tests fetching an entry, and then an update. - */ - @Test - public void testFetchAndUpdate() throws Exception { - final Object value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - - //test null - Element element = selfPopulatingCache.get(null); - - // Lookup - element = selfPopulatingCache.get("key"); - assertThat(element.getObjectValue(), sameInstance(value)); - assertThat(factory.getCount(), is(2)); - - Object actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(3)); - - actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(4)); - } - - /** - * Tests when fetch fails. - */ - @Test - public void testFetchFail() throws Exception { - final Exception exception = new Exception("Failed."); - final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() { - public Object createEntry(final Object key) - throws Exception { - throw exception; - } - - public void updateEntryValue(Object key, Object value) - throws Exception { - throw exception; - } - }; - - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Lookup - try { - selfPopulatingCache.get("key"); - fail(); - } catch (final Exception e) { - // Check the error - assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage()); - } - } - - /** - * Tests refreshing the entries. - */ - @Test - public void testRefresh() throws Exception { - final String value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Refresh - try { - selfPopulatingCache.refresh(); - fail(); - } catch (CacheException e) { - //expected. - assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 0) @@ -1,34 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import java.util.Map; - -import javax.management.ObjectName; - -/** - * @author Abhishek Sanoujam - */ -public interface DSOMBean { - - long getGlobalServerMapGetSizeRequestsCount(); - - long getGlobalServerMapGetValueRequestsCount(); - - long getGlobalServerMapGetSizeRequestsRate(); - - long getGlobalServerMapGetValueRequestsRate(); - - long getReadOperationRate(); - - Map getServerMapGetSizeRequestsCount(); - - Map getServerMapGetValueRequestsCount(); - - Map getServerMapGetSizeRequestsRate(); - - Map getServerMapGetValueRequestsRate(); - - Void dumpClusterState(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0) @@ -1,87 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.statistics.extended; - -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.StatisticArchive; -import org.terracotta.statistics.archive.StatisticSampler; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class SampledStatistic. - * - * @param the generic type - * @author cdennis - */ -class SampledStatistic { - - /** The sampler. */ - private final StatisticSampler sampler; - - /** The history. */ - private final StatisticArchive history; - - /** - * Instantiates a new sampled statistic. - * - * @param statistic the statistic - * @param executor the executor - * @param historySize the history size - * @param periodNanos the period nanos - */ - public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) { - this.history = new StatisticArchive(historySize); - this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history); - } - - /** - * Start sampling. - */ - public void startSampling() { - sampler.start(); - } - - /** - * Stop sampling. - */ - public void stopSampling() { - sampler.stop(); - history.clear(); - } - - /** - * History. - * - * @return the list - */ - public List> history() { - return history.getArchive(); - } - - /** - * Adjust. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void adjust(int historySize, long historyNanos) { - history.setCapacity(historySize); - sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.transaction.SoftLockID; - -/** - * @author Alex Snaps - */ -public class TxCopyStrategyHandler extends CopyStrategyHandler { - - /** - * Creates a TxCopyStrategyHandler based on the copy configuration - * - * @param copyOnRead copy on read flag - * @param copyOnWrite copy on write flag - * @param copyStrategy the copy strategy to use - * @param loader - */ - public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) { - super(copyOnRead, copyOnWrite, copyStrategy, loader); - } - - @Override - public Element copyElementForReadIfNeeded(final Element element) { - final Object objectValue = element.getObjectValue(); - if (objectValue instanceof SoftLockID) { - return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement()); - } - return super.copyElementForReadIfNeeded(element); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0) @@ -1,40 +0,0 @@ -RULE trace RemoteTransactionManagerImpl commitWithoutThrottling -CLASS RemoteTransactionManagerImpl -METHOD commitWithoutThrottling -AT ENTRY -IF true -DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterEntry -CLASS ClusteredStore -METHOD putWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterExit -CLASS ClusteredStore -METHOD putWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterEntry -CLASS ClusteredStore -METHOD removeWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterExit -CLASS ClusteredStore -METHOD removeWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 0) @@ -1,48 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.bootstrap; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; - -/** - * @author Greg Luck - * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public interface BootstrapCacheLoader { - - /** - * Instructs the loader to load the given cache - * @param cache cache to load - */ - void load(Ehcache cache) throws CacheException; - - /** - * - * @return true if this bootstrap loader is asynchronous - */ - boolean isAsynchronous(); - - /** - * Clones the loader - * - * @return clone of this instance - * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface. - */ - Object clone() throws CloneNotSupportedException; - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0) @@ -1,90 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.local; - -import net.sf.ehcache.transaction.TransactionID; -import net.sf.ehcache.transaction.TransactionIDFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * The local transactions mode recovery manager which is used to trigger full recovery of all - * caches configured with local transaction mode. - * - * @author Ludovic Orban - */ -public class LocalRecoveryManager { - - private final TransactionIDFactory transactionIdFactory; - private final List localTransactionStores = new CopyOnWriteArrayList(); - private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet(); - - /** - * Create a LocalRecoveryManager instance - * @param transactionIdFactory the TransactionIDFactory - */ - public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) { - this.transactionIdFactory = transactionIdFactory; - } - - /** - * Register a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void register(LocalTransactionStore localTransactionStore) { - localTransactionStores.add(localTransactionStore); - } - - /** - * Unregister a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void unregister(LocalTransactionStore localTransactionStore) { - localTransactionStores.remove(localTransactionStore); - } - - /** - * Run recovery on all registered local transaction stores. The latter - * are used internally by caches when they're configured with local transaction mode. - * @return the set of recovered TransactionIDs - */ - public Set recover() { - Set recovered = new HashSet(); - // first ask all stores to cleanup their soft locks - for (LocalTransactionStore localTransactionStore : localTransactionStores) { - recovered.addAll(localTransactionStore.recover()); - } - // then clear the transaction ID - for (TransactionID transactionId : recovered) { - transactionIdFactory.clear(transactionId); - } - - previouslyRecoveredTransactionIDs = recovered; - return recovered; - } - - /** - * Get the set of transaction IDs collected by the previous recover() call - * @return the set of previously recovered TransactionIDs - */ - public Set getPreviouslyRecoveredTransactionIDs() { - return previouslyRecoveredTransactionIDs; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 0) @@ -1,54 +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; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentBLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentBLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentBLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderB"; - } - - /** - * @param arg0 - * @return - * @throws CacheException - */ - public Object load(Object arg0) throws CacheException { - LOG.info("Loading Component B..."); - String key = (String) arg0; - return new ComponentB(key); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0) @@ -1,233 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.bulkops; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; - -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.TimeUnit; - -public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) { - super(testConfig, App.class, App.class); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG); - testBulkOpsSanity(dcv2StrongSerialization); - barrier.await(); - - Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL); - testBulkOpsSanity(dcv2EventualSerialization); - barrier.await(); - - barrier.await(); - - } - - private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException { - int index = barrier.await(); - int numOfElements = 100; - Set elements = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i))); - } - if (index == 0) { - cache.putAll(elements); - } - - barrier.await(); - while (cache.getSize() != numOfElements) { - Thread.sleep(1000); - } - Assert.assertEquals(numOfElements, cache.getSize()); - - Set keySet1 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - keySet1.add(new Key("key" + i, i)); - } - - Map rv = cache.getAll(keySet1); - Assert.assertEquals(numOfElements, rv.size()); - - Collection values = new HashSet(); - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - values.add(entry.getValue()); - } - - for (Element element : elements) { - Assert.assertTrue(values.contains(element)); - } - - Set keySet2 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - if (i % 2 == 0) { - keySet2.add(new Key("key" + i, i)); - } - } - - rv = cache.getAll(keySet2); - Assert.assertEquals(keySet2.size(), rv.size()); - - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.removeAll(keySet2); - System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - // sleep for 60 seconds for eventual caches - if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) { - Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS)); - } - } - index = barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client"); - for (Object key : keySet2) { - Assert.assertNull(cache.get(key)); - } - System.out.println("client " + index + " done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxElementsInMemory(100000); - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(100000); - cacheConfiguration.setTimeToIdleSeconds(200000); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency); - return cache; - } - } - - private static class Key implements Serializable { - private final String stringKey; - private final int intKey; - - public Key(String stringKey, int intKey) { - super(); - this.stringKey = stringKey; - this.intKey = intKey; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intKey; - result = prime * result + ((stringKey == null) ? 0 : stringKey.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Key other = (Key) obj; - if (intKey != other.intKey) return false; - if (stringKey == null) { - if (other.stringKey != null) return false; - } else if (!stringKey.equals(other.stringKey)) return false; - return true; - } - - @Override - public String toString() { - return stringKey; - } - - } - - private static class Value implements Serializable { - private final String keyVal; - private final int intVal; - - public Value(String keyVal, int intVal) { - this.keyVal = keyVal; - this.intVal = intVal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intVal; - result = prime * result + ((keyVal == null) ? 0 : keyVal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Value other = (Value) obj; - if (intVal != other.intVal) return false; - if (keyVal == null) { - if (other.keyVal != null) return false; - } else if (!keyVal.equals(other.keyVal)) return false; - return true; - } - - @Override - public String toString() { - return keyVal; - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0) @@ -1,21 +0,0 @@ -package org.terracotta.ehcache.tests.servermap; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase { - - public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) { - super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig, - ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class); - testConfig.setDgcEnabled(true); - testConfig.setDgcIntervalInSec(60); - testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true"); - - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000"); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 0) @@ -1,368 +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.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.properties.TCPropertiesConsts; -import com.tc.test.config.model.TestConfig; - -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.SECONDS; - -/** - * @author cdennis - */ -public class DynamicCacheConfigurationTest extends AbstractCacheTestBase { - public DynamicCacheConfigurationTest(TestConfig testConfig) { - super(testConfig, App.class); - testConfig.addTcProperty(TCPropertiesConsts.L2_SERVERMAP_EVICTION_CLIENTOBJECT_REFERENCES_REFRESH_INTERVAL, "5000"); - testConfig.addTcProperty(TCPropertiesConsts.EHCACHE_EVICTOR_LOGGING_ENABLED, "true"); - } - - public static class App extends ClientBase { - private static final double TOLERANCE = 0.1; - - 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 { - testTTIChange(cacheManager); - testTTLChange(cacheManager); - testDiskCapacityChange(cacheManager); - testMemoryCapacityChange(cacheManager); - testTTIChangeWithCustomElements(cacheManager); - testTTLChangeWithCustomElements(cacheManager); - } - - private Cache createCache(String cacheName, int maxMemory, boolean eternal, long ttl, long tti) { - return new Cache(new CacheConfiguration(cacheName, maxMemory) - .eternal(eternal) - .timeToLiveSeconds(ttl) - .timeToIdleSeconds(tti) - .clearOnFlush(true) - .terracotta(new TerracottaConfiguration().clustered(true).consistency(Consistency.STRONG) - .coherentReads(true).orphanEviction(true).orphanEvictionPeriod(4).localKeyCache(false) - .localKeyCacheSize(0).copyOnRead(false)).logging(true)); - } - - private void testTTIChange(CacheManager manager) throws InterruptedException { - Cache cache = createCache("testTTIChange", 10, false, 0, 10); - manager.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - cache.get("key2"); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - long currentTime = System.currentTimeMillis(); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("key1")); - if (System.currentTimeMillis() - currentTime < 20000 ) { - Assert.assertNotNull(cache.get("key2")); - } else { - Assert.assertNull(cache.get("key2")); - } - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - private void testTTLChange(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChange", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("key1")); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("key1")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - public void testTTIChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTIChangeWithCustomElements", 10, false, 0, 10); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("short")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - public void testTTLChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChangeWithCustomElements", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - private void testMemoryCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testMemoryCapacityChange", 100, true, 0, 0); - cache.getCacheConfiguration().getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG); - cm.addCache(cache); - - int i = 0; - for (; i < 150; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(200); - - for (; i < 250; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100, 200); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(50); - - for (; i < 350; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 50); - - cache.removeAll(); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int lowerBound, final int upperBound) - throws Exception { - final int min = (int) ((1 - TOLERANCE) * lowerBound); - final int max = (int) ((1 + TOLERANCE) * upperBound); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - if (cache.getStatistics().getLocalHeapSize() <= max && cache.getStatistics().getLocalHeapSize() >= min) { - return true; - } - System.out.println("Still waiting for memory store size to fall in bounds [" + lowerBound + ", " + upperBound - + "] current=" + cache.getStatistics().getLocalHeapSize()); - return false; - } - }); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int upperBound) throws Exception { - waitForCacheMemoryStoreSize(cache, 0, upperBound); - } - - public void testDiskCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testDiskCapacityChange", 10, true, 0, 0); - cache.getCacheConfiguration().maxEntriesLocalHeap(1).maxEntriesInCache(100).getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG).concurrency(16); - cm.addCache(cache); - - testCacheDiskCapacity(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesInCache(200); - - testCacheDiskCapacity(cache, 200); - - cache.getCacheConfiguration().setMaxEntriesInCache(50); - - testCacheDiskCapacity(cache, 50); - - cache.removeAll(); - } - - private void testCacheDiskCapacity(final Cache cache, final int capacity) throws Exception { - for (int i = 0; i < 1000; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - System.out.println("Waiting on capacoty of " + capacity); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - System.out.println("Current cache size " + cache.getSize()); - Assert.assertTrue(cache.getSize() > capacity * .85); - return cache.getSize() >= capacity * 0.9 && cache.getSize() <= capacity * 1.1; - } - }); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0) @@ -1,161 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.parser; - -import net.sf.ehcache.search.expression.And; -import net.sf.ehcache.search.expression.EqualTo; -import net.sf.ehcache.search.expression.GreaterThan; -import net.sf.ehcache.search.expression.GreaterThanOrEqual; -import net.sf.ehcache.search.expression.ILike; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.LessThanOrEqual; -import net.sf.ehcache.search.expression.Not; -import net.sf.ehcache.search.expression.NotEqualTo; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.parser.MCriteria.Between; -import net.sf.ehcache.search.parser.MCriteria.Simple; -import net.sf.ehcache.search.parser.MValue.MInt; - -import org.junit.Assert; -import org.junit.Test; - -public class MCriteriaTest { - - private final ClassLoader loader = getClass().getClassLoader(); - - @Test - public void testSimpleModelCriteria() throws CustomParseException { - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj); - EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj); - NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj); - GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj); - GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj); - LessThan crit = (LessThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj); - LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - } - - void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) { - Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max); - net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), name); - Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader)); - Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader)); - Assert.assertEquals(crit.isMinInclusive(), min); - Assert.assertEquals(crit.isMaxInclusive(), max); - } - - @Test - public void testBetween() throws CustomParseException { - MInt obj1 = new MValue.MInt(null, "0"); - MInt obj2 = new MValue.MInt(null, "110"); - checkBetween("foo", obj1, false, obj2, false); - checkBetween("foo", obj1, true, obj2, false); - checkBetween("foo", obj1, false, obj2, true); - checkBetween("foo", obj1, true, obj2, true); - } - - @Test - public void testIlike() { - MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo"); - ILike crit = (ILike)ilike.asEhcacheObject(loader); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testLike() { - MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo"); - ILike crit = (ILike)like.asEhcacheObject(loader); - Assert.assertEquals(like.getLikeRegex(), "foo.%foo"); - Assert.assertEquals(like.getILikeRegex(), "foo.*foo"); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testNot() throws CustomParseException { - MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1")); - MCriteria.Not not = new MCriteria.Not(simple); - Not crit = (Not)not.asEhcacheObject(loader); - @SuppressWarnings("unused") - EqualTo inner = (EqualTo)crit.getCriteria(); - Assert.assertTrue(true); // the casts are sufficient for the test. - } - - @Test - public void testAnd() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5")); - - MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3); - And crit = (And)and.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof And); - And crit2 = (And)crit.getCriterion()[1]; - Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan); - Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo); - - } - - @Test - public void testOr() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2); - - Or crit = (Or)or.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - -import net.sf.ehcache.Ehcache; - -public interface AsyncCoordinatorFactory { - AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config); - - boolean destroy(String cacheManagerName, String cacheName); -} Index: rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,342 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error -org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 0) @@ -1,194 +0,0 @@ -/** - * All content copyright 2010 (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package net.sf.ehcache.servermaplocalcache; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListenerAdapter; - -public class ServerMapLocalCache { - - private final static int CONCURRENCY = 256; - private volatile TCObjectSelfStore tcoSelfStore; - private volatile Cache ehcache; - private final ReentrantReadWriteLock[] locks = new ReentrantReadWriteLock[CONCURRENCY]; - private final Object localSync = new Object(); - private static final ExecutorService evictionHandlerStage = Executors.newFixedThreadPool(4, new ThreadFactory() { - private final AtomicInteger count = new AtomicInteger(); - - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "eviction_handler_stage_thread_" + count.incrementAndGet()); - t.setDaemon(true); - return t; - } - }); - - public ServerMapLocalCache(TCObjectSelfStore tcoSelfStore, Cache ehcache) { - this.tcoSelfStore = tcoSelfStore; - this.ehcache = ehcache; - ehcache.getCacheEventNotificationService().registerListener(new EvictionListener(this)); - for (int i = 0; i < CONCURRENCY; i++) { - locks[i] = new ReentrantReadWriteLock(); - } - } - - private ReentrantReadWriteLock getLock(Object key) { - return locks[Math.abs(key.hashCode() % CONCURRENCY)]; - } - - public void put(TCObjectSelf tcoSelf) { - synchronized (localSync) { - tcoSelfStore.addTCObjectSelf(tcoSelf); - addToCache(tcoSelf); - } - } - - public TCObjectSelf getFromTCObjectSelfStore(Long oid) { - synchronized (localSync) { - return tcoSelfStore.getById(oid); - } - } - - // public void remove(String key) { - // synchronized (localSync) { - // removeFromCache(key); - // } - // } - // - // private void removeFromCache(String key) { - // WriteLock writeLock = getLock(key).writeLock(); - // writeLock.lock(); - // try { - // // remove key-value mapping: key->value - // Element element = ehcache.removeAndReturnElement(key); - // if (element != null) { - // TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - // if (tcoSelf != null) { - // handleKeyValueMappingRemoved(key, tcoSelf); - // } - // } - // - // } finally { - // writeLock.unlock(); - // } - // } - - private void handleKeyValueMappingRemoved(String key, TCObjectSelf tcoSelf) { - // remote remove - tcoSelfStore.removeTCObjectSelf(tcoSelf); - if (tcoSelf != null) { - // clean up meta-mapping: id->key - ehcache.remove(tcoSelf.getOid()); - } - } - - private void addToCache(TCObjectSelf tcoSelf) { - ReentrantReadWriteLock lock = getLock(tcoSelf.getKey()); - lock.writeLock().lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Add to cache: " + tcoSelf); - } - - // add meta mapping: oid->key - ehcache.put(new Element(tcoSelf.getOid(), tcoSelf.getKey())); - - // add the key->value mapping - ehcache.put(new Element(tcoSelf.getKey(), tcoSelf)); - - } finally { - lock.writeLock().unlock(); - } - } - - public void entryEvicted(Object objectKey, Object objectValue) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Entry evicted; evictedKey: " + objectKey + ", evictedValue: " + objectValue); - } - if (objectValue instanceof TCObjectSelf) { - // key-value mapping evicted - keyValueMappingEvicted((String) objectKey, (TCObjectSelf) objectValue); - } else { - // oid-> key mapping removed - objectIdMappingEvicted((Long) objectKey, (String) objectValue); - } - } - - private void objectIdMappingEvicted(Long oid, String key) { - WriteLock writeLock = getLock(key).writeLock(); - writeLock.lock(); - Element element = null; - try { - element = ehcache.get(key); - if (element != null) { - TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - if (tcoSelf != null && tcoSelf.getOid() == oid) { - // clean up key-value mapping - ehcache.remove(key); - tcoSelfStore.removeTCObjectSelf(tcoSelf); - } - } - } finally { - writeLock.unlock(); - } - if (DebugUtil.DEBUG) { - DebugUtil.debug("[objectIdEvicted] oid: " + oid + ", key: " + key + ", was mapped to value: " - + (element == null ? "null" : element.getObjectValue())); - } - } - - private void keyValueMappingEvicted(String objectKey, TCObjectSelf objectValue) { - WriteLock writeLock = getLock(objectKey).writeLock(); - writeLock.lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[keyValueMappingEvicted] key: " + objectKey + ", value: " + objectValue); - } - handleKeyValueMappingRemoved(objectKey, objectValue); - } finally { - writeLock.unlock(); - } - } - - private static class EvictionListener extends CacheEventListenerAdapter { - private final ServerMapLocalCache serverMapLocalCache; - - public EvictionListener(ServerMapLocalCache serverMapLocalCache) { - this.serverMapLocalCache = serverMapLocalCache; - } - - @Override - public void notifyElementExpired(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementExpired] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - - @Override - public void notifyElementEvicted(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementEvicted] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to LiveCacheStatistics and its implementation. - - - Index: rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 0) @@ -1,45 +0,0 @@ - - distribution - - tar.gz - - - - - - - - - - - - ${basedir}/src - /src - - - ${project.build.directory}/${project.name} - - **/ehcache*.jar - **/terracotta-toolkit*-runtime*.jar - - /webapps/${project.name} - - - ${basedir}/src/assemble - - README.* - - / - - - ${basedir}/src/assemble/jetty6.1 - /jetty6.1 - - - ${basedir}/src/assemble/bin - /bin - 0755 - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 0) @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 0) @@ -1,28 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class VersionedItem extends Item { - private Long version; - - public Long getVersion() { - return version; - } - - public void setVersion(Long version) { - this.version = version; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0) @@ -1,309 +0,0 @@ -package net.sf.ehcache.constructs.eventual; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * StronglyConsistentCacheAccessorTest - */ -@Category(CheckShorts.class) -public class StronglyConsistentCacheAccessorTest { - - @Test - public void refusesStandaloneCache() { - try { - new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600)); - fail("Underlying cache not clustered and eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void refusesClusteredButNoEventualCache() { - TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG); - - try { - new StronglyConsistentCacheAccessor(underlyingCache); - fail("Underlying cache clustered but not eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void acceptClusteredAndEventualUnderlyingCache() { - Ehcache underlyingCache = buildMockCache(); - - new StronglyConsistentCacheAccessor(underlyingCache); - } - - @Test - public void testPutIfAbsent() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.putIfAbsent(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.putIfAbsent(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.putIfAbsent(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testSingleArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.replace(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.replace(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.replace(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testTwoArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false)); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true)); - - try { - cacheAccessor.replace(new Element(null, null), new Element("key", "other")); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - - try { - cacheAccessor.replace(new Element("key", "other"), new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testRemoveElement() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element); - when(underlyingCache.remove((Object)"key")).thenReturn(true); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.removeElement(element), is(false)); - assertThat(cacheAccessor.removeElement(element), is(true)); - - try { - cacheAccessor.removeElement(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void putMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - String put = "put"; - Set putMethods = getMethodsMatching(put); - for (Method putMethod : putMethods) { - int paramLength = putMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + putMethod.getName()); - putMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void replaceMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - Set replaceMethods = getMethodsMatching("replace"); - for (Method replaceMethod : replaceMethods) { - int paramLength = replaceMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) { - params[1] = element; - } - System.out.println("Invoking " + replaceMethod.getName()); - replaceMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void removeMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "someValue"); - - String remove = "remove"; - Set removeMethods = getMethodsMatching(remove, "Property"); - for (Method removeMethod : removeMethods) { - System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")"); - int paramLength = removeMethod.getParameterTypes().length; - if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) { - continue; - } - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = element; - } else { - params[0] = key; - } - if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params)); - removeMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void getMethodsDoReadLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "key"; - String get = "get"; - Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid"); - for (Method getMethod : getMethods) { - System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")"); - int paramLength = getMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else { - params[0] = key; - } - - System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params)); - getMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireReadLockOnKey(key); - verify(ehcache).releaseReadLockOnKey(key); - reset(ehcache); - } - } - - private Set getMethodsMatching(String put, String... excludes) { - Set results = new HashSet(); - Method[] methods = Ehcache.class.getMethods(); - for (Method method : methods) { - if (method.getName().contains(put)) { - boolean exclude = false; - for (String exclusion : excludes) { - if (method.getName().contains(exclusion)) { - exclude = true; - } - } - if (!exclude) { - results.add(method); - } - } - } - return results; - } - - private Ehcache buildMockCache() {TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(cacheConfiguration.getElementValueComparatorConfiguration()).thenReturn(new ElementValueComparatorConfiguration()); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.EVENTUAL); - return underlyingCache; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0) @@ -1,440 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Direction; -import net.sf.ehcache.search.ExecutionHints; -import net.sf.ehcache.search.Query; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.expression.AlwaysMatch; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.store.StoreQuery; - -/** - * Query builder implementation. Instances are bound to a specific cache - * - * @author teck - */ -class CacheQuery implements Query, StoreQuery { - - private volatile boolean frozen; - private volatile boolean includeKeys; - private volatile boolean includeValues; - private volatile int maxResults = -1; - private String[] targets; - - private final List orderings = Collections.synchronizedList(new ArrayList()); - private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>()); - private final List criteria = Collections.synchronizedList(new ArrayList()); - private final List aggregators = Collections.synchronizedList(new ArrayList()); - private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>()); - - private final Cache cache; - private volatile ExecutionHints hints; - - /** - * Create a new builder instance - * - * @param cache - */ - public CacheQuery(Cache cache) { - this.cache = cache; - } - - /** - * {@inheritDoc} - */ - public Query includeKeys() { - checkFrozen(); - this.includeKeys = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeValues() { - checkFrozen(); - this.includeValues = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAttribute(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - - this.includedAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException { - checkFrozen(); - - if (aggregators == null) { - throw new NullPointerException(); - } - - for (Aggregator aggregator : aggregators) { - if (aggregator == null) { - throw new NullPointerException("null aggregator"); - } - - this.aggregators.add(aggregator); - } - - return this; - } - - /** - * {@inheritDoc} - */ - public Query addOrderBy(Attribute> attribute, Direction direction) { - checkFrozen(); - this.orderings.add(new OrderingImpl(attribute, direction)); - return this; - } - - /** - * {@inheritDoc} - */ - public Query addGroupBy(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - groupByAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query maxResults(int maxResults) { - checkFrozen(); - this.maxResults = maxResults; - return this; - } - - /** - * {@inheritDoc} - */ - public Query addCriteria(Criteria criteria) { - checkFrozen(); - - if (criteria == null) { - throw new NullPointerException("null criteria"); - } - - this.criteria.add(criteria); - return this; - } - - /** - * {@inheritDoc} - */ - public Results execute() throws SearchException { - return cache.executeQuery(snapshot()); - } - - /** - * {@inheritDoc} - */ - public Results execute(ExecutionHints params) throws SearchException { - this.hints = params; - return cache.executeQuery(snapshot()); - } - - - /** - * {@inheritDoc} - */ - public Query end() { - frozen = true; - return this; - } - - /** - * {@inheritDoc} - */ - public List getOrdering() { - assertFrozen(); - return Collections.unmodifiableList(orderings); - } - - /** - * {@inheritDoc} - */ - public Criteria getCriteria() { - assertFrozen(); - return getEffectiveCriteriaCopy(); - } - - /** - * {@inheritDoc} - */ - public boolean requestsKeys() { - assertFrozen(); - return includeKeys; - } - - /** - * {@inheritDoc} - */ - public boolean requestsValues() { - assertFrozen(); - return includeValues; - } - - /** - * {@inheritDoc} - */ - public Cache getCache() { - assertFrozen(); - return cache; - } - - /** - * {@inheritDoc} - */ - public Set> requestedAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.includedAttributes); - } - - /** - * {@inheritDoc} - */ - public Set> groupByAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.groupByAttributes); - } - - /** - * {@inheritDoc} - */ - public int maxResults() { - assertFrozen(); - return maxResults; - } - - - /** - * {@inheritDoc} - */ - @Override - public ExecutionHints getExecutionHints() { - assertFrozen(); - return hints; - } - - /** - * {@inheritDoc} - */ - public List getAggregators() { - return Collections.unmodifiableList(this.aggregators); - } - - /** - * {@inheritDoc} - */ - public List> getAggregatorInstances() { - assertFrozen(); - return Collections.unmodifiableList(createAggregatorInstances(aggregators)); - } - - private static List> createAggregatorInstances(List aggregators) { - List> rv = new ArrayList>(aggregators.size()); - for (Aggregator aggregator : aggregators) { - rv.add(aggregator.createInstance()); - } - - return rv; - } - - private Criteria getEffectiveCriteriaCopy() { - Criteria result = new AlwaysMatch(); - for (Criteria c : criteria) { - result = result.and(c); - } - return result; - } - - private void assertFrozen() { - if (!frozen) { - throw new AssertionError("not frozen"); - } - } - - private StoreQuery snapshot() { - if (frozen) { - return this; - } - - return new StoreQueryImpl(); - } - - private void checkFrozen() { - if (frozen) { - throw new SearchException("Query is frozen and cannot be mutated"); - } - } - - /** - * {@inheritDoc} - */ - public String[] getTargets() { - return this.targets; - } - - /** - * {@inheritDoc} - */ - @Override - public void targets(final String[] targets) { - this.targets = targets; - } - - /** - * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder - */ - private class StoreQueryImpl implements StoreQuery { - private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy(); - private final boolean copiedIncludeKeys = includeKeys; - private final boolean copiedIncludeValues = includeValues; - private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes)); - private final int copiedMaxResults = maxResults; - private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings)); - private final List copiedAggregators = Collections.unmodifiableList(aggregators); - private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators)); - private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes)); - private final ExecutionHints execHints = hints; - - public Criteria getCriteria() { - return copiedCriteria; - } - - public boolean requestsKeys() { - return copiedIncludeKeys; - } - - public boolean requestsValues() { - return copiedIncludeValues; - } - - public Cache getCache() { - return cache; - } - - public Set
- * This implementation returns Ehcache specific access strategy instances for all the non-transactional access types. Transactional access - * is not supported. - * - * @author Chris Dennis - * @author Abhishek Sanoujam - */ -public class EhcacheEntityRegion extends EhcacheTransactionalDataRegion implements EntityRegion { - - private static final Logger LOG = LoggerFactory.getLogger(EhcacheEntityRegion.class); - - /** - * Constructs an EhcacheEntityRegion around the given underlying cache. - * - * @param accessStrategyFactory - */ - public EhcacheEntityRegion(EhcacheAccessStrategyFactory accessStrategyFactory, Ehcache underlyingCache, Settings settings, - CacheDataDescription metadata, Properties properties) { - super(accessStrategyFactory, underlyingCache, settings, metadata, properties); - } - - /** - * {@inheritDoc} - */ - public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException { - return accessStrategyFactory.createEntityRegionAccessStrategy(this, accessType); - } -} Index: rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/management-ehcache-impl/management-ehcache-impl-v2/src/main/java/net/sf/ehcache/management/service/impl/CacheStatisticSampleEntityBuilderV2.java (revision 0) @@ -1,162 +0,0 @@ -/* - * All content copyright (c) 2003-2012 Terracotta, Inc., except as may otherwise be noted in a separate copyright - * notice. All rights reserved. - */ -package net.sf.ehcache.management.service.impl; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import net.sf.ehcache.management.resource.CacheStatisticSampleEntityV2; -import net.sf.ehcache.management.sampled.CacheSampler; -import net.sf.ehcache.management.service.AccessorPrefix; -import net.sf.ehcache.util.counter.sampled.SampledCounter; -import net.sf.ehcache.util.counter.sampled.TimeStampedCounterValue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.terracotta.management.resource.AgentEntityV2; - -/** - * A builder for {@link CacheStatisticSampleEntityV2} resource objects. - * - * @author brandony - */ -final class CacheStatisticSampleEntityBuilderV2 { - private static final Logger LOG = LoggerFactory.getLogger(CacheStatisticSampleEntityBuilderV2.class); - - private static final String SAMPLE_SUFFIX = "Sample"; - - private final Set sampleNames; - - private final Map> samplersByCMName = new HashMap>(); - - static CacheStatisticSampleEntityBuilderV2 createWith(Set statisticSampleName) { - return new CacheStatisticSampleEntityBuilderV2(statisticSampleName); - } - - private CacheStatisticSampleEntityBuilderV2(Set sampleNames) { - this.sampleNames = sampleNames; - } - - CacheStatisticSampleEntityBuilderV2 add(CacheSampler sampler, - String cacheManagerName) { - addSampler(sampler, cacheManagerName); - return this; - } - - Collection build() { - Collection csses = new ArrayList(); - - for (Map.Entry> entry : samplersByCMName.entrySet()) { - for (CacheSampler sampler : entry.getValue()) { - if (sampleNames == null) { - for (Method m : CacheSampler.class.getMethods()) { - if (AccessorPrefix.isAccessor(m.getName()) && SampledCounter.class.isAssignableFrom(m.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(m, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } else { - for (String sampleName : sampleNames) { - Method sampleMethod; - try { - sampleMethod = CacheSampler.class.getMethod(AccessorPrefix.get + sampleName + SAMPLE_SUFFIX); - } catch (NoSuchMethodException e) { - LOG.warn("A statistic sample with the name '{}' does not exist.", sampleName); - continue; - } - - if (SampledCounter.class.isAssignableFrom(sampleMethod.getReturnType())) { - CacheStatisticSampleEntityV2 csse = makeStatResource(sampleMethod, sampler, entry.getKey()); - if (csse != null) { - csses.add(csse); - } - } - } - } - } - } - - return csses; - } - - private CacheStatisticSampleEntityV2 makeStatResource(Method sampleMethod, - CacheSampler sampler, - String cmName) { - SampledCounter sCntr; - try { - sCntr = SampledCounter.class.cast(sampleMethod.invoke(sampler)); - } catch (IllegalAccessException e) { - LOG.warn("Failed to invoke method '{}' while constructing entity due to access restriction.", - sampleMethod.getName()); - sCntr = null; - } catch (InvocationTargetException e) { - LOG.warn(String.format("Failed to invoke method %s while constructing entity.", sampleMethod.getName()), e); - sCntr = null; - } - - if (sCntr != null) { - CacheStatisticSampleEntityV2 csse = new CacheStatisticSampleEntityV2(); - csse.setCacheManagerName(cmName); - csse.setName(sampler.getCacheName()); - csse.setAgentId(AgentEntityV2.EMBEDDED_AGENT_ID); - // csse.setVersion(this.getClass().getPackage().getImplementationVersion()); - csse.setStatName(AccessorPrefix.trimPrefix(sampleMethod.getName()).replace(SAMPLE_SUFFIX, "")); - - TimeStampedCounterValue[] tscvs; - if (getExcludedMethodNames(sampler).contains(sampleMethod.getName())) { - tscvs = new TimeStampedCounterValue[0]; - } else { - tscvs = sCntr.getAllSampleValues(); - } - - Map statValueByTime = new TreeMap(); - csse.setStatValueByTimeMillis(statValueByTime); - - for (TimeStampedCounterValue tscv : tscvs) { - statValueByTime.put(tscv.getTimestamp(), tscv.getCounterValue()); - } - return csse; - } - - return null; - } - - private Set getExcludedMethodNames(CacheSampler sampler) { - if (sampler.isLocalHeapCountBased()) { - return Collections.singleton("getLocalHeapSizeInBytesSample"); - } - return Collections.emptySet(); - } - - private void addSampler(CacheSampler sampler, - String cacheManagerName) { - if (sampler == null) { - throw new IllegalArgumentException("sampler == null"); - } - - if (cacheManagerName == null) { - throw new IllegalArgumentException("cacheManagerName == null"); - } - - Set samplers = samplersByCMName.get(cacheManagerName); - - if (samplers == null) { - samplers = new HashSet(); - samplersByCMName.put(cacheManagerName, samplers); - } - - samplers.add(sampler); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/config/generator/DecoratedCacheConfigTest.java (revision 0) @@ -1,60 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.config.generator; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import junit.framework.Assert; -import net.sf.ehcache.CacheManager; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -@Category(CheckShorts.class) -public class DecoratedCacheConfigTest { - - private static final List ALL_CACHE_NAMES = Arrays.asList(new String[] {"noDecoratorCache", "oneDecoratorCache", - "oneDecoratorCacheFirst", "twoDecoratorCache", "twoDecoratorCacheSecond", "twoDecoratorCacheFirst"}); - - @Test - public void testDecoratedCacheConfig() { - CacheManager cm = CacheManager.newInstance(DecoratedCacheConfigTest.class.getClassLoader().getResource( - "ehcache-decorator-noname-test.xml")); - try { - List names = new ArrayList(Arrays.asList(cm.getCacheNames())); - names.removeAll(ALL_CACHE_NAMES); - Assert.assertEquals("This list should be empty - " + names, 0, names.size()); - // System.out.println("Original config: " + cm.getOriginalConfigurationText()); - String text = cm.getActiveConfigurationText(); - // System.out.println("Cache manager config: " + text); - for (String name : ALL_CACHE_NAMES) { - Assert.assertTrue("Config not generated for cache name: " + name, text.contains("name=\"" + name + "\"")); - String cacheConfigTest = cm.getActiveConfigurationText(name); - // System.out.println("Config for cache: '"+name+"': " + cacheConfigTest); - Assert.assertTrue("Config not generated for cache name: " + name + ", with explicit call: ", - cacheConfigTest.contains("name=\"" + name + "\"")); - } - - } finally { - cm.shutdown(); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache/src/test/resources/serializedforms/SerializationCopyStrategySerializationTest.testBasic.ser =================================================================== diff -u -N -r10926 -r10963 Binary files differ Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/l1bm/L1BMOnHeapReadWriteTest.java (revision 0) @@ -1,149 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.l1bm; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.util.Random; -import java.util.concurrent.BrokenBarrierException; - -import junit.framework.Assert; - -public class L1BMOnHeapReadWriteTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - private static final int NUM_OF_ELEMENTS = 1000; - private static final int NUM_OF_THREADS = 10; - private static final int WRITE_PERCENTAGE = 5; - - public L1BMOnHeapReadWriteTest(TestConfig testConfig) { - super(testConfig, L1BMOnHeapReadWriteTestApp.class, L1BMOnHeapReadWriteTestApp.class); - } - - public static class L1BMOnHeapReadWriteTestApp extends ClientBase { - private final ToolkitBarrier barrier; - - public L1BMOnHeapReadWriteTestApp(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new L1BMOnHeapReadWriteTestApp(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - boolean shouldWait = true; - Cache eventualWithStatsCache = createCache("eventualWithStatsCache", cacheManager, "EVENTUAL", true); - testL1BigMemorySanity(eventualWithStatsCache, shouldWait); - eventualWithStatsCache.removeAll(); - - Cache eventualWithoutStatsCache = createCache("eventualWithoutStatsCache", cacheManager, "EVENTUAL", false); - testL1BigMemorySanity(eventualWithoutStatsCache, shouldWait); - eventualWithoutStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithStatsCache = createCache("strongWithStatsCache", cacheManager, "STRONG", true); - testL1BigMemorySanity(strongWithStatsCache, shouldWait); - strongWithStatsCache.removeAll(); - - shouldWait = false; - Cache strongWithoutStatsCache = createCache("strongWithoutStatsCache", cacheManager, "STRONG", false); - testL1BigMemorySanity(strongWithoutStatsCache, shouldWait); - strongWithoutStatsCache.removeAll(); - } - - private void testL1BigMemorySanity(Cache cache, boolean shouldWait) throws InterruptedException, - BrokenBarrierException { - int index = barrier.await(); - if (index == 0) { - System.out.println("XXXXXX putting " + NUM_OF_ELEMENTS + " in the cache"); - for (int i = 0; i < NUM_OF_ELEMENTS; i++) { - cache.put(new Element("key" + i, "val" + i)); - } - System.out.println("XXXXX done with putting " + cache.getSize() + " entries"); - } - barrier.await(); - if (shouldWait) { - while (cache.getSize() != NUM_OF_ELEMENTS) { - Thread.sleep(1000); - } - } - Assert.assertEquals(NUM_OF_ELEMENTS, cache.getSize()); - System.out.println("XXXXXX client " + index + " cache size: " + cache.getSize() + " local: " - + cache.getStatistics().getLocalHeapSize()); - if (index == 0) { - Assert.assertTrue(cache.getStatistics().getLocalHeapSize() > 0); - } else { - Assert.assertEquals(0, cache.getStatistics().getLocalHeapSize()); - } - - System.out.println("XXXXX starting test threads...."); - Thread ths[] = new Thread[NUM_OF_THREADS]; - for (int i = 0; i < NUM_OF_THREADS; i++) { - ths[i] = new Thread(new TestThread(cache, i, index), "testThread" + i); - ths[i].start(); - } - - for (Thread th : ths) { - th.join(); - } - barrier.await(); - System.out.println("XXXXXX done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, String consistency, boolean isWithStats) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxBytesLocalHeap(10485760L); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - return cache; - } - - private static class TestThread implements Runnable { - private final long TIME_TO_RUN = 1 * 60 * 1000; - private final Cache cache; - private final int threadIndex; - private final int clientIndex; - - public TestThread(Cache cache, int threadIndex, int clientIndex) { - this.cache = cache; - this.threadIndex = threadIndex; - this.clientIndex = clientIndex; - } - - @Override - public void run() { - System.out.println("XXXXX client[" + clientIndex + "] started thread " + threadIndex); - long start = System.currentTimeMillis(); - Random rand = new Random(start); - while (System.currentTimeMillis() - start < TIME_TO_RUN) { - if (rand.nextInt(100) < WRITE_PERCENTAGE) { - this.cache.put(new Element("key" + rand.nextInt(NUM_OF_ELEMENTS), "val" + rand.nextInt(NUM_OF_ELEMENTS))); - } else { - String key = "key" + rand.nextInt(NUM_OF_ELEMENTS); - Assert.assertNotNull("value for " + key + " is null", this.cache.get(key)); - } - } - } - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/servermap/servermap-l2-eviction-reaches-one-l1-test.xml (revision 0) @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/wan/Watchable.java (revision 0) @@ -1,32 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ - -package org.terracotta.modules.ehcache.wan; - -/** - * @author Eugene Shelestovich - */ -public interface Watchable { - - /** - * - */ - void goLive(); - - void die(); - - /** - * Checks whether or not a given Watchable is alive. - * - * @return {@code true} if a given Watchable is alive, {@code false} otherwise - */ - boolean probeLiveness(); - - /** - * Returns a name which uniquely identifies the Watchable. - * - * @return unique name - */ - String name(); -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/basic-writebehind-test.xml (revision 0) @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/blocking/UpdatingSelfPopulatingCacheTest.java (revision 0) @@ -1,147 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.constructs.blocking; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheException; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import net.sf.ehcache.config.DiskStoreConfiguration; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.sameInstance; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - - -/** - * Test cases for the {@link UpdatingSelfPopulatingCache}. - * - * @author Greg Luck - * @version $Id: UpdatingSelfPopulatingCacheTest.java 8281 2013-10-04 08:41:51Z ljacomet $ - */ -public class UpdatingSelfPopulatingCacheTest { - - @Rule - public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - private CacheManager cacheManager; - private Cache cache; - - @Before - public void setUp() throws Exception { - Configuration configuration = new Configuration(); - configuration.name("upSelfPopCM") - .diskStore(new DiskStoreConfiguration().path(temporaryFolder.newFolder().getAbsolutePath())) - .addCache(new CacheConfiguration("cache", 1).timeToIdleSeconds(2) - .timeToLiveSeconds(5) - .overflowToDisk(true) - .diskPersistent(true)); - cacheManager = CacheManager.newInstance(configuration); - cache = cacheManager.getCache("cache"); - } - - @After - public void tearDown() { - cacheManager.shutdown(); - } - - /** - * Tests fetching an entry, and then an update. - */ - @Test - public void testFetchAndUpdate() throws Exception { - final Object value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - - //test null - Element element = selfPopulatingCache.get(null); - - // Lookup - element = selfPopulatingCache.get("key"); - assertThat(element.getObjectValue(), sameInstance(value)); - assertThat(factory.getCount(), is(2)); - - Object actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(3)); - - actualValue = selfPopulatingCache.get("key").getObjectValue(); - assertThat(actualValue, sameInstance(value)); - assertThat(factory.getCount(), is(4)); - } - - /** - * Tests when fetch fails. - */ - @Test - public void testFetchFail() throws Exception { - final Exception exception = new Exception("Failed."); - final UpdatingCacheEntryFactory factory = new UpdatingCacheEntryFactory() { - public Object createEntry(final Object key) - throws Exception { - throw exception; - } - - public void updateEntryValue(Object key, Object value) - throws Exception { - throw exception; - } - }; - - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Lookup - try { - selfPopulatingCache.get("key"); - fail(); - } catch (final Exception e) { - // Check the error - assertEquals("Could not update object for cache entry with key \"key\".", e.getMessage()); - } - } - - /** - * Tests refreshing the entries. - */ - @Test - public void testRefresh() throws Exception { - final String value = "value"; - final CountingCacheEntryFactory factory = new CountingCacheEntryFactory(value); - UpdatingSelfPopulatingCache selfPopulatingCache = new UpdatingSelfPopulatingCache(cache, factory); - - // Refresh - try { - selfPopulatingCache.refresh(); - fail(); - } catch (CacheException e) { - //expected. - assertEquals("UpdatingSelfPopulatingCache objects should not be refreshed.", e.getMessage()); - } - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/mbean/DSOMBean.java (revision 0) @@ -1,34 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.ehcache.tests.mbean; - -import java.util.Map; - -import javax.management.ObjectName; - -/** - * @author Abhishek Sanoujam - */ -public interface DSOMBean { - - long getGlobalServerMapGetSizeRequestsCount(); - - long getGlobalServerMapGetValueRequestsCount(); - - long getGlobalServerMapGetSizeRequestsRate(); - - long getGlobalServerMapGetValueRequestsRate(); - - long getReadOperationRate(); - - Map getServerMapGetSizeRequestsCount(); - - Map getServerMapGetValueRequestsCount(); - - Map getServerMapGetSizeRequestsRate(); - - Map getServerMapGetValueRequestsRate(); - - Void dumpClusterState(); -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/extended/SampledStatistic.java (revision 0) @@ -1,87 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.statistics.extended; - -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import org.terracotta.statistics.ValueStatistic; -import org.terracotta.statistics.archive.StatisticArchive; -import org.terracotta.statistics.archive.StatisticSampler; -import org.terracotta.statistics.archive.Timestamped; - -/** - * The Class SampledStatistic. - * - * @param the generic type - * @author cdennis - */ -class SampledStatistic { - - /** The sampler. */ - private final StatisticSampler sampler; - - /** The history. */ - private final StatisticArchive history; - - /** - * Instantiates a new sampled statistic. - * - * @param statistic the statistic - * @param executor the executor - * @param historySize the history size - * @param periodNanos the period nanos - */ - public SampledStatistic(ValueStatistic statistic, ScheduledExecutorService executor, int historySize, long periodNanos) { - this.history = new StatisticArchive(historySize); - this.sampler = new StatisticSampler(executor, periodNanos, TimeUnit.NANOSECONDS, statistic, history); - } - - /** - * Start sampling. - */ - public void startSampling() { - sampler.start(); - } - - /** - * Stop sampling. - */ - public void stopSampling() { - sampler.stop(); - history.clear(); - } - - /** - * History. - * - * @return the list - */ - public List> history() { - return history.getArchive(); - } - - /** - * Adjust. - * - * @param historySize the history size - * @param historyNanos the history nanos - */ - void adjust(int historySize, long historyNanos) { - history.setCapacity(historySize); - sampler.setPeriod(historyNanos, TimeUnit.NANOSECONDS); - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/store/TxCopyStrategyHandler.java (revision 0) @@ -1,49 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.store; - -import net.sf.ehcache.Element; -import net.sf.ehcache.store.compound.ReadWriteCopyStrategy; -import net.sf.ehcache.transaction.SoftLockID; - -/** - * @author Alex Snaps - */ -public class TxCopyStrategyHandler extends CopyStrategyHandler { - - /** - * Creates a TxCopyStrategyHandler based on the copy configuration - * - * @param copyOnRead copy on read flag - * @param copyOnWrite copy on write flag - * @param copyStrategy the copy strategy to use - * @param loader - */ - public TxCopyStrategyHandler(final boolean copyOnRead, final boolean copyOnWrite, - final ReadWriteCopyStrategy copyStrategy, final ClassLoader loader) { - super(copyOnRead, copyOnWrite, copyStrategy, loader); - } - - @Override - public Element copyElementForReadIfNeeded(final Element element) { - final Object objectValue = element.getObjectValue(); - if (objectValue instanceof SoftLockID) { - return super.copyElementForReadIfNeeded(((SoftLockID)objectValue).getOldElement()); - } - return super.copyElementForReadIfNeeded(element); - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/byteman/writeBehindAtomicity.btm (revision 0) @@ -1,40 +0,0 @@ -RULE trace RemoteTransactionManagerImpl commitWithoutThrottling -CLASS RemoteTransactionManagerImpl -METHOD commitWithoutThrottling -AT ENTRY -IF true -DO traceln("COMMITTRANSACTION :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterEntry -CLASS ClusteredStore -METHOD putWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION putWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore putWithWriterExit -CLASS ClusteredStore -METHOD putWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION putWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterEntry -CLASS ClusteredStore -METHOD removeWithWriter -AT ENTRY -IF true -DO traceln("BEGINOPERATION removeWithWriterThread :" + Thread.currentThread().getName()); -ENDRULE - -RULE trace ClusteredStore removeWithWriterExit -CLASS ClusteredStore -METHOD removeWithWriter -AT EXIT -IF true -DO traceln("ENDOPERATION removeWithWriter Thread :" + Thread.currentThread().getName()); -ENDRULE - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/bootstrap/BootstrapCacheLoader.java (revision 0) @@ -1,48 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.bootstrap; - -import net.sf.ehcache.CacheException; -import net.sf.ehcache.Ehcache; - -/** - * @author Greg Luck - * @version $Id: BootstrapCacheLoader.java 10789 2018-04-26 02:08:13Z adahanne $ - */ -public interface BootstrapCacheLoader { - - /** - * Instructs the loader to load the given cache - * @param cache cache to load - */ - void load(Ehcache cache) throws CacheException; - - /** - * - * @return true if this bootstrap loader is asynchronous - */ - boolean isAsynchronous(); - - /** - * Clones the loader - * - * @return clone of this instance - * @throws CloneNotSupportedException if the object's class does not support the {@code Cloneable} interface. - */ - Object clone() throws CloneNotSupportedException; - -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/transaction/local/LocalRecoveryManager.java (revision 0) @@ -1,90 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.transaction.local; - -import net.sf.ehcache.transaction.TransactionID; -import net.sf.ehcache.transaction.TransactionIDFactory; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * The local transactions mode recovery manager which is used to trigger full recovery of all - * caches configured with local transaction mode. - * - * @author Ludovic Orban - */ -public class LocalRecoveryManager { - - private final TransactionIDFactory transactionIdFactory; - private final List localTransactionStores = new CopyOnWriteArrayList(); - private volatile Set previouslyRecoveredTransactionIDs = Collections.emptySet(); - - /** - * Create a LocalRecoveryManager instance - * @param transactionIdFactory the TransactionIDFactory - */ - public LocalRecoveryManager(TransactionIDFactory transactionIdFactory) { - this.transactionIdFactory = transactionIdFactory; - } - - /** - * Register a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void register(LocalTransactionStore localTransactionStore) { - localTransactionStores.add(localTransactionStore); - } - - /** - * Unregister a LocalTransactionStore from the recovery manager - * @param localTransactionStore the LocalTransactionStore - */ - void unregister(LocalTransactionStore localTransactionStore) { - localTransactionStores.remove(localTransactionStore); - } - - /** - * Run recovery on all registered local transaction stores. The latter - * are used internally by caches when they're configured with local transaction mode. - * @return the set of recovered TransactionIDs - */ - public Set recover() { - Set recovered = new HashSet(); - // first ask all stores to cleanup their soft locks - for (LocalTransactionStore localTransactionStore : localTransactionStores) { - recovered.addAll(localTransactionStore.recover()); - } - // then clear the transaction ID - for (TransactionID transactionId : recovered) { - transactionIdFactory.clear(transactionId); - } - - previouslyRecoveredTransactionIDs = recovered; - return recovered; - } - - /** - * Get the set of transaction IDs collected by the previous recover() call - * @return the set of previously recovered TransactionIDs - */ - public Set getPreviouslyRecoveredTransactionIDs() { - return previouslyRecoveredTransactionIDs; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/loader/ComponentBLoader.java (revision 0) @@ -1,54 +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; - - -/** - * Written for Dead-lock poc - * - * @author Greg Luck - * @version $Id: ComponentBLoader.java 5594 2012-05-07 16:04:31Z cdennis $ - */ -public class ComponentBLoader extends BaseComponentLoader { - - private static final Logger LOG = LoggerFactory.getLogger(ComponentBLoader.class.getName()); - - /** - * @return - */ - public String getName() { - return "LoaderB"; - } - - /** - * @param arg0 - * @return - * @throws CacheException - */ - public Object load(Object arg0) throws CacheException { - LOG.info("Loading Component B..."); - String key = (String) arg0; - return new ComponentB(key); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/bulkops/BulkOpsBasicSerializationSanityTest.java (revision 0) @@ -1,233 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.bulkops; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; - -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.toolkit.Toolkit; -import org.terracotta.toolkit.concurrent.ToolkitBarrier; - -import com.tc.test.config.model.TestConfig; - -import java.io.Serializable; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.TimeUnit; - -public class BulkOpsBasicSerializationSanityTest extends AbstractCacheTestBase { - private static final int NODE_COUNT = 2; - - public BulkOpsBasicSerializationSanityTest(TestConfig testConfig) { - super(testConfig, App.class, App.class); - } - - public static class App extends ClientBase { - private final ToolkitBarrier barrier; - - public App(String[] args) { - super(args); - this.barrier = getClusteringToolkit().getBarrier("test-barrier", NODE_COUNT); - } - - public static void main(String[] args) { - new App(args).run(); - } - - @Override - protected void runTest(Cache cache, Toolkit clusteringToolkit) throws Throwable { - Cache dcv2StrongSerialization = createCache("dcv2StrongSerialization", cacheManager, Consistency.STRONG); - testBulkOpsSanity(dcv2StrongSerialization); - barrier.await(); - - Cache dcv2EventualSerialization = createCache("dcv2EventualSerialization", cacheManager, Consistency.EVENTUAL); - testBulkOpsSanity(dcv2EventualSerialization); - barrier.await(); - - barrier.await(); - - } - - private void testBulkOpsSanity(Cache cache) throws InterruptedException, BrokenBarrierException { - int index = barrier.await(); - int numOfElements = 100; - Set elements = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - elements.add(new Element(new Key("key" + i, i), new Value("val" + i, i))); - } - if (index == 0) { - cache.putAll(elements); - } - - barrier.await(); - while (cache.getSize() != numOfElements) { - Thread.sleep(1000); - } - Assert.assertEquals(numOfElements, cache.getSize()); - - Set keySet1 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - keySet1.add(new Key("key" + i, i)); - } - - Map rv = cache.getAll(keySet1); - Assert.assertEquals(numOfElements, rv.size()); - - Collection values = new HashSet(); - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - values.add(entry.getValue()); - } - - for (Element element : elements) { - Assert.assertTrue(values.contains(element)); - } - - Set keySet2 = new HashSet(); - for (int i = 0; i < numOfElements; i++) { - if (i % 2 == 0) { - keySet2.add(new Key("key" + i, i)); - } - } - - rv = cache.getAll(keySet2); - Assert.assertEquals(keySet2.size(), rv.size()); - - for (Entry entry : rv.entrySet()) { - Assert.assertTrue(elements.contains(entry.getValue())); - } - - Assert.assertEquals(keySet2, rv.keySet()); - System.out.println("verified by client now waiting for others..."); - barrier.await(); - - if (index != 0) { - cache.removeAll(keySet2); - System.out.println("client " + index + " removed " + keySet2.size() + " keys from " + cache.getName() - + ". Now waiting for others..."); - // sleep for 60 seconds for eventual caches - if (cache.getCacheConfiguration().getTerracottaConfiguration().getConsistency() == Consistency.EVENTUAL) { - Thread.sleep(TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS)); - } - } - index = barrier.await(); - while (cache.getSize() != numOfElements - keySet2.size()) { - Thread.sleep(1000); - } - - Assert.assertEquals(numOfElements - keySet2.size(), cache.getSize()); - System.out.println("client " + index + "now checking removed in " + cache.getName() + " by client"); - for (Object key : keySet2) { - Assert.assertNull(cache.get(key)); - } - System.out.println("client " + index + " done with " + cache.getName()); - } - - private Cache createCache(String cacheName, CacheManager cm, Consistency consistency) { - CacheConfiguration cacheConfiguration = new CacheConfiguration(); - cacheConfiguration.setName(cacheName); - cacheConfiguration.setMaxElementsInMemory(100000); - cacheConfiguration.setEternal(false); - cacheConfiguration.setTimeToLiveSeconds(100000); - cacheConfiguration.setTimeToIdleSeconds(200000); - - TerracottaConfiguration tcConfiguration = new TerracottaConfiguration(); - tcConfiguration.setConsistency(consistency); - cacheConfiguration.addTerracotta(tcConfiguration); - - Cache cache = new Cache(cacheConfiguration); - cm.addCache(cache); - System.out.println("\n\ncache " + cacheName + " created with consistency " + consistency); - return cache; - } - } - - private static class Key implements Serializable { - private final String stringKey; - private final int intKey; - - public Key(String stringKey, int intKey) { - super(); - this.stringKey = stringKey; - this.intKey = intKey; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intKey; - result = prime * result + ((stringKey == null) ? 0 : stringKey.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Key other = (Key) obj; - if (intKey != other.intKey) return false; - if (stringKey == null) { - if (other.stringKey != null) return false; - } else if (!stringKey.equals(other.stringKey)) return false; - return true; - } - - @Override - public String toString() { - return stringKey; - } - - } - - private static class Value implements Serializable { - private final String keyVal; - private final int intVal; - - public Value(String keyVal, int intVal) { - this.keyVal = keyVal; - this.intVal = intVal; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + intVal; - result = prime * result + ((keyVal == null) ? 0 : keyVal.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Value other = (Value) obj; - if (intVal != other.intVal) return false; - if (keyVal == null) { - if (other.keyVal != null) return false; - } else if (!keyVal.equals(other.keyVal)) return false; - return true; - } - - @Override - public String toString() { - return keyVal; - } - - } -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/ehcache/tests/servermap/ServerMapL2EvictionReachesOneL1Test.java (revision 0) @@ -1,21 +0,0 @@ -package org.terracotta.ehcache.tests.servermap; - -import org.terracotta.ehcache.tests.AbstractCacheTestBase; - -import com.tc.test.config.model.TestConfig; - -public class ServerMapL2EvictionReachesOneL1Test extends AbstractCacheTestBase { - - public ServerMapL2EvictionReachesOneL1Test(TestConfig testConfig) { - super("/servermap/servermap-l2-eviction-reaches-one-l1-test.xml", testConfig, - ServerMapL2EvictionReachesOneL1TestClient.class, ServerMapL2EvictionReachesOneL1Verifier.class); - testConfig.setDgcEnabled(true); - testConfig.setDgcIntervalInSec(60); - testConfig.addTcProperty("ehcache.evictor.logging.enabled", "true"); - - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.cachemanager.enabled=false"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.ehcache.evictor.logging.enabled=true"); - testConfig.getClientConfig().addExtraClientJvmArg("-Dcom.tc.l1.lockmanager.timeout.interval=60000"); - } - -} Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/java/org/terracotta/modules/ehcache/store/DynamicCacheConfigurationTest.java (revision 0) @@ -1,368 +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.CacheManager; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration.Consistency; -import org.junit.Assert; -import org.terracotta.ehcache.tests.AbstractCacheTestBase; -import org.terracotta.ehcache.tests.ClientBase; -import org.terracotta.test.util.WaitUtil; -import org.terracotta.toolkit.Toolkit; - -import com.tc.properties.TCPropertiesConsts; -import com.tc.test.config.model.TestConfig; - -import java.util.concurrent.Callable; - -import static java.util.concurrent.TimeUnit.SECONDS; - -/** - * @author cdennis - */ -public class DynamicCacheConfigurationTest extends AbstractCacheTestBase { - public DynamicCacheConfigurationTest(TestConfig testConfig) { - super(testConfig, App.class); - testConfig.addTcProperty(TCPropertiesConsts.L2_SERVERMAP_EVICTION_CLIENTOBJECT_REFERENCES_REFRESH_INTERVAL, "5000"); - testConfig.addTcProperty(TCPropertiesConsts.EHCACHE_EVICTOR_LOGGING_ENABLED, "true"); - } - - public static class App extends ClientBase { - private static final double TOLERANCE = 0.1; - - 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 { - testTTIChange(cacheManager); - testTTLChange(cacheManager); - testDiskCapacityChange(cacheManager); - testMemoryCapacityChange(cacheManager); - testTTIChangeWithCustomElements(cacheManager); - testTTLChangeWithCustomElements(cacheManager); - } - - private Cache createCache(String cacheName, int maxMemory, boolean eternal, long ttl, long tti) { - return new Cache(new CacheConfiguration(cacheName, maxMemory) - .eternal(eternal) - .timeToLiveSeconds(ttl) - .timeToIdleSeconds(tti) - .clearOnFlush(true) - .terracotta(new TerracottaConfiguration().clustered(true).consistency(Consistency.STRONG) - .coherentReads(true).orphanEviction(true).orphanEvictionPeriod(4).localKeyCache(false) - .localKeyCacheSize(0).copyOnRead(false)).logging(true)); - } - - private void testTTIChange(CacheManager manager) throws InterruptedException { - Cache cache = createCache("testTTIChange", 10, false, 0, 10); - manager.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - cache.get("key2"); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - long currentTime = System.currentTimeMillis(); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("key1")); - if (System.currentTimeMillis() - currentTime < 20000 ) { - Assert.assertNotNull(cache.get("key2")); - } else { - Assert.assertNull(cache.get("key2")); - } - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - private void testTTLChange(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChange", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("key1")); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("key1", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNotNull(cache.get("key2")); - - SECONDS.sleep(8); - - Assert.assertNotNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("key1")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("key1", new byte[0])); - cache.put(new Element("key2", new byte[0])); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("key1")); - Assert.assertNull(cache.get("key2")); - - cache.removeAll(); - } - - public void testTTIChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTIChangeWithCustomElements", 10, false, 0, 10); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("short")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(15); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(25); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToIdleSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - public void testTTLChangeWithCustomElements(CacheManager cm) throws InterruptedException { - Cache cache = createCache("testTTLChangeWithCustomElements", 10, false, 10, 0); - cm.addCache(cache); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("eternal", new byte[0], true, 0, 0)); - cache.put(new Element("short", new byte[0], false, 1, 1)); - cache.put(new Element("long", new byte[0], true, 100, 100)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(20); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(6); - - Assert.assertNotNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - SECONDS.sleep(10); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.getCacheConfiguration().setTimeToLiveSeconds(4); - - cache.put(new Element("default", new byte[0])); - cache.put(new Element("short", new byte[0], false, 1, 1)); - - SECONDS.sleep(8); - - Assert.assertNull(cache.get("default")); - Assert.assertNotNull(cache.get("eternal")); - Assert.assertNull(cache.get("short")); - Assert.assertNotNull(cache.get("long")); - - cache.removeAll(); - } - - private void testMemoryCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testMemoryCapacityChange", 100, true, 0, 0); - cache.getCacheConfiguration().getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG); - cm.addCache(cache); - - int i = 0; - for (; i < 150; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(200); - - for (; i < 250; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 100, 200); - - cache.getCacheConfiguration().setMaxEntriesLocalHeap(50); - - for (; i < 350; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - - waitForCacheMemoryStoreSize(cache, 50); - - cache.removeAll(); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int lowerBound, final int upperBound) - throws Exception { - final int min = (int) ((1 - TOLERANCE) * lowerBound); - final int max = (int) ((1 + TOLERANCE) * upperBound); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - if (cache.getStatistics().getLocalHeapSize() <= max && cache.getStatistics().getLocalHeapSize() >= min) { - return true; - } - System.out.println("Still waiting for memory store size to fall in bounds [" + lowerBound + ", " + upperBound - + "] current=" + cache.getStatistics().getLocalHeapSize()); - return false; - } - }); - } - - private void waitForCacheMemoryStoreSize(final Cache cache, final int upperBound) throws Exception { - waitForCacheMemoryStoreSize(cache, 0, upperBound); - } - - public void testDiskCapacityChange(CacheManager cm) throws Exception { - final Cache cache = createCache("testDiskCapacityChange", 10, true, 0, 0); - cache.getCacheConfiguration().maxEntriesLocalHeap(1).maxEntriesInCache(100).getTerracottaConfiguration() - .consistency(TerracottaConfiguration.Consistency.STRONG).concurrency(16); - cm.addCache(cache); - - testCacheDiskCapacity(cache, 100); - - cache.getCacheConfiguration().setMaxEntriesInCache(200); - - testCacheDiskCapacity(cache, 200); - - cache.getCacheConfiguration().setMaxEntriesInCache(50); - - testCacheDiskCapacity(cache, 50); - - cache.removeAll(); - } - - private void testCacheDiskCapacity(final Cache cache, final int capacity) throws Exception { - for (int i = 0; i < 1000; i++) { - cache.put(new Element("key" + i, new byte[0])); - } - System.out.println("Waiting on capacoty of " + capacity); - WaitUtil.waitUntilCallableReturnsTrue(new Callable() { - @Override - public Boolean call() throws Exception { - System.out.println("Current cache size " + cache.getSize()); - Assert.assertTrue(cache.getSize() > capacity * .85); - return cache.getSize() >= capacity * 0.9 && cache.getSize() <= capacity * 1.1; - } - }); - } - - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-search-parser/src/test/java/net/sf/ehcache/search/parser/MCriteriaTest.java (revision 0) @@ -1,161 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache.search.parser; - -import net.sf.ehcache.search.expression.And; -import net.sf.ehcache.search.expression.EqualTo; -import net.sf.ehcache.search.expression.GreaterThan; -import net.sf.ehcache.search.expression.GreaterThanOrEqual; -import net.sf.ehcache.search.expression.ILike; -import net.sf.ehcache.search.expression.LessThan; -import net.sf.ehcache.search.expression.LessThanOrEqual; -import net.sf.ehcache.search.expression.Not; -import net.sf.ehcache.search.expression.NotEqualTo; -import net.sf.ehcache.search.expression.Or; -import net.sf.ehcache.search.parser.MCriteria.Between; -import net.sf.ehcache.search.parser.MCriteria.Simple; -import net.sf.ehcache.search.parser.MValue.MInt; - -import org.junit.Assert; -import org.junit.Test; - -public class MCriteriaTest { - - private final ClassLoader loader = getClass().getClassLoader(); - - @Test - public void testSimpleModelCriteria() throws CustomParseException { - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.EQ, obj); - EqualTo crit = (EqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, obj); - NotEqualTo crit = (NotEqualTo)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GE, obj); - GreaterThanOrEqual crit = (GreaterThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, obj); - GreaterThan crit = (GreaterThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, obj); - LessThan crit = (LessThan)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - { - MInt obj = new MValue.MInt(null, "0"); - Simple mcrit = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LE, obj); - LessThanOrEqual crit = (LessThanOrEqual)mcrit.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), "foo"); - Assert.assertEquals(crit.getComparableValue(), obj.asEhcacheObject(loader)); - } - } - - void checkBetween(String name, ModelElement> obj1, boolean min, ModelElement> obj2, boolean max) { - Between between = new MCriteria.Between(new MAttribute(name), obj1, min, obj2, max); - net.sf.ehcache.search.expression.Between crit = (net.sf.ehcache.search.expression.Between)between.asEhcacheObject(loader); - Assert.assertEquals(crit.getAttributeName(), name); - Assert.assertEquals(crit.getMin(), obj1.asEhcacheObject(loader)); - Assert.assertEquals(crit.getMax(), obj2.asEhcacheObject(loader)); - Assert.assertEquals(crit.isMinInclusive(), min); - Assert.assertEquals(crit.isMaxInclusive(), max); - } - - @Test - public void testBetween() throws CustomParseException { - MInt obj1 = new MValue.MInt(null, "0"); - MInt obj2 = new MValue.MInt(null, "110"); - checkBetween("foo", obj1, false, obj2, false); - checkBetween("foo", obj1, true, obj2, false); - checkBetween("foo", obj1, false, obj2, true); - checkBetween("foo", obj1, true, obj2, true); - } - - @Test - public void testIlike() { - MCriteria.ILike ilike = new MCriteria.ILike(MAttribute.KEY, "foo.*foo"); - ILike crit = (ILike)ilike.asEhcacheObject(loader); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testLike() { - MCriteria.Like like = new MCriteria.Like(MAttribute.KEY, "foo.%foo"); - ILike crit = (ILike)like.asEhcacheObject(loader); - Assert.assertEquals(like.getLikeRegex(), "foo.%foo"); - Assert.assertEquals(like.getILikeRegex(), "foo.*foo"); - Assert.assertEquals(crit.getRegex(), "foo.*foo"); - Assert.assertEquals(crit.getAttributeName(), MAttribute.KEY.getName()); - } - - @Test - public void testNot() throws CustomParseException { - MCriteria.Simple simple = new MCriteria.Simple(MAttribute.KEY, MCriteria.SimpleOp.EQ, new MValue.MInt(null, "1")); - MCriteria.Not not = new MCriteria.Not(simple); - Not crit = (Not)not.asEhcacheObject(loader); - @SuppressWarnings("unused") - EqualTo inner = (EqualTo)crit.getCriteria(); - Assert.assertTrue(true); // the casts are sufficient for the test. - } - - @Test - public void testAnd() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "0")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - Simple mcrit3 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.NE, new MValue.MInt(null, "5")); - - MCriteria.And and = new MCriteria.And(mcrit1, mcrit2, mcrit3); - And crit = (And)and.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof And); - And crit2 = (And)crit.getCriterion()[1]; - Assert.assertTrue(crit2.getCriterion()[0] instanceof LessThan); - Assert.assertTrue(crit2.getCriterion()[1] instanceof NotEqualTo); - - } - - @Test - public void testOr() throws CustomParseException { - Simple mcrit1 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.GT, new MValue.MInt(null, "100")); - Simple mcrit2 = new MCriteria.Simple(new MAttribute("foo"), MCriteria.SimpleOp.LT, new MValue.MInt(null, "10")); - MCriteria.Or or = new MCriteria.Or(mcrit1, mcrit2); - - Or crit = (Or)or.asEhcacheObject(loader); - Assert.assertTrue(crit.getCriterion()[0] instanceof GreaterThan); - Assert.assertTrue(crit.getCriterion()[1] instanceof LessThan); - } - -} Index: rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/terracotta/bootstrap/src/main/java/org/terracotta/modules/ehcache/async/AsyncCoordinatorFactory.java (revision 0) @@ -1,12 +0,0 @@ -/* - * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. - */ -package org.terracotta.modules.ehcache.async; - -import net.sf.ehcache.Ehcache; - -public interface AsyncCoordinatorFactory { - AsyncCoordinator getOrCreateAsyncCoordinator(final Ehcache cache, final AsyncConfig config); - - boolean destroy(String cacheManagerName, String cacheName); -} Index: rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/.settings/org.eclipse.jdt.core.prefs (revision 0) @@ -1,342 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=ignore -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressErrors=enabled -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=error -org.eclipse.jdt.core.compiler.problem.unhandledErrorToken=error -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error -org.eclipse.jdt.core.compiler.problem.unusedLabel=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=true -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=true -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=2 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true -org.eclipse.jdt.core.formatter.lineSplit=120 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/servermaplocalcache/ServerMapLocalCache.java (revision 0) @@ -1,194 +0,0 @@ -/** - * All content copyright 2010 (c) Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All - * rights reserved. - */ -package net.sf.ehcache.servermaplocalcache; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.event.CacheEventListenerAdapter; - -public class ServerMapLocalCache { - - private final static int CONCURRENCY = 256; - private volatile TCObjectSelfStore tcoSelfStore; - private volatile Cache ehcache; - private final ReentrantReadWriteLock[] locks = new ReentrantReadWriteLock[CONCURRENCY]; - private final Object localSync = new Object(); - private static final ExecutorService evictionHandlerStage = Executors.newFixedThreadPool(4, new ThreadFactory() { - private final AtomicInteger count = new AtomicInteger(); - - public Thread newThread(Runnable r) { - Thread t = new Thread(r, "eviction_handler_stage_thread_" + count.incrementAndGet()); - t.setDaemon(true); - return t; - } - }); - - public ServerMapLocalCache(TCObjectSelfStore tcoSelfStore, Cache ehcache) { - this.tcoSelfStore = tcoSelfStore; - this.ehcache = ehcache; - ehcache.getCacheEventNotificationService().registerListener(new EvictionListener(this)); - for (int i = 0; i < CONCURRENCY; i++) { - locks[i] = new ReentrantReadWriteLock(); - } - } - - private ReentrantReadWriteLock getLock(Object key) { - return locks[Math.abs(key.hashCode() % CONCURRENCY)]; - } - - public void put(TCObjectSelf tcoSelf) { - synchronized (localSync) { - tcoSelfStore.addTCObjectSelf(tcoSelf); - addToCache(tcoSelf); - } - } - - public TCObjectSelf getFromTCObjectSelfStore(Long oid) { - synchronized (localSync) { - return tcoSelfStore.getById(oid); - } - } - - // public void remove(String key) { - // synchronized (localSync) { - // removeFromCache(key); - // } - // } - // - // private void removeFromCache(String key) { - // WriteLock writeLock = getLock(key).writeLock(); - // writeLock.lock(); - // try { - // // remove key-value mapping: key->value - // Element element = ehcache.removeAndReturnElement(key); - // if (element != null) { - // TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - // if (tcoSelf != null) { - // handleKeyValueMappingRemoved(key, tcoSelf); - // } - // } - // - // } finally { - // writeLock.unlock(); - // } - // } - - private void handleKeyValueMappingRemoved(String key, TCObjectSelf tcoSelf) { - // remote remove - tcoSelfStore.removeTCObjectSelf(tcoSelf); - if (tcoSelf != null) { - // clean up meta-mapping: id->key - ehcache.remove(tcoSelf.getOid()); - } - } - - private void addToCache(TCObjectSelf tcoSelf) { - ReentrantReadWriteLock lock = getLock(tcoSelf.getKey()); - lock.writeLock().lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Add to cache: " + tcoSelf); - } - - // add meta mapping: oid->key - ehcache.put(new Element(tcoSelf.getOid(), tcoSelf.getKey())); - - // add the key->value mapping - ehcache.put(new Element(tcoSelf.getKey(), tcoSelf)); - - } finally { - lock.writeLock().unlock(); - } - } - - public void entryEvicted(Object objectKey, Object objectValue) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("Entry evicted; evictedKey: " + objectKey + ", evictedValue: " + objectValue); - } - if (objectValue instanceof TCObjectSelf) { - // key-value mapping evicted - keyValueMappingEvicted((String) objectKey, (TCObjectSelf) objectValue); - } else { - // oid-> key mapping removed - objectIdMappingEvicted((Long) objectKey, (String) objectValue); - } - } - - private void objectIdMappingEvicted(Long oid, String key) { - WriteLock writeLock = getLock(key).writeLock(); - writeLock.lock(); - Element element = null; - try { - element = ehcache.get(key); - if (element != null) { - TCObjectSelf tcoSelf = (TCObjectSelf) element.getObjectValue(); - if (tcoSelf != null && tcoSelf.getOid() == oid) { - // clean up key-value mapping - ehcache.remove(key); - tcoSelfStore.removeTCObjectSelf(tcoSelf); - } - } - } finally { - writeLock.unlock(); - } - if (DebugUtil.DEBUG) { - DebugUtil.debug("[objectIdEvicted] oid: " + oid + ", key: " + key + ", was mapped to value: " - + (element == null ? "null" : element.getObjectValue())); - } - } - - private void keyValueMappingEvicted(String objectKey, TCObjectSelf objectValue) { - WriteLock writeLock = getLock(objectKey).writeLock(); - writeLock.lock(); - try { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[keyValueMappingEvicted] key: " + objectKey + ", value: " + objectValue); - } - handleKeyValueMappingRemoved(objectKey, objectValue); - } finally { - writeLock.unlock(); - } - } - - private static class EvictionListener extends CacheEventListenerAdapter { - private final ServerMapLocalCache serverMapLocalCache; - - public EvictionListener(ServerMapLocalCache serverMapLocalCache) { - this.serverMapLocalCache = serverMapLocalCache; - } - - @Override - public void notifyElementExpired(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementExpired] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - - @Override - public void notifyElementEvicted(Ehcache cache, final Element element) { - if (DebugUtil.DEBUG) { - DebugUtil.debug("[ElementEvicted] expiredKey: " + element.getObjectKey() + ", expiredValue: " + element.getObjectValue()); - } - evictionHandlerStage.submit(new Runnable() { - public void run() { - serverMapLocalCache.entryEvicted(element.getObjectKey(), element.getObjectValue()); - } - }); - } - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/statistics/package.html (revision 0) @@ -1,8 +0,0 @@ - - - - -This package contains classes related to LiveCacheStatistics and its implementation. - - - Index: rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/distribution/colorcache/src/assemble/distribution.xml (revision 0) @@ -1,45 +0,0 @@ - - distribution - - tar.gz - - - - - - - - - - - - ${basedir}/src - /src - - - ${project.build.directory}/${project.name} - - **/ehcache*.jar - **/terracotta-toolkit*-runtime*.jar - - /webapps/${project.name} - - - ${basedir}/src/assemble - - README.* - - / - - - ${basedir}/src/assemble/jetty6.1 - /jetty6.1 - - - ${basedir}/src/assemble/bin - /bin - 0755 - - - - Index: rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 10926) +++ rctags/ehcache-2.10.7.0.13/system-tests/src/test/resources/hibernate-config/shutdowntest/domain/Person.hbm.xml (revision 0) @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/hibernate/domain/VersionedItem.java (revision 0) @@ -1,28 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package net.sf.ehcache.hibernate.domain; - -public class VersionedItem extends Item { - private Long version; - - public Long getVersion() { - return version; - } - - public void setVersion(Long version) { - this.version = version; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/test/java/net/sf/ehcache/constructs/eventual/StronglyConsistentCacheAccessorTest.java (revision 0) @@ -1,309 +0,0 @@ -package net.sf.ehcache.constructs.eventual; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Ehcache; -import net.sf.ehcache.Element; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.ElementValueComparatorConfiguration; -import net.sf.ehcache.config.TerracottaConfiguration; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.terracotta.test.categories.CheckShorts; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * StronglyConsistentCacheAccessorTest - */ -@Category(CheckShorts.class) -public class StronglyConsistentCacheAccessorTest { - - @Test - public void refusesStandaloneCache() { - try { - new StronglyConsistentCacheAccessor(new Cache("standalone", 100, false, false, 300, 600)); - fail("Underlying cache not clustered and eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void refusesClusteredButNoEventualCache() { - TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.STRONG); - - try { - new StronglyConsistentCacheAccessor(underlyingCache); - fail("Underlying cache clustered but not eventual"); - } catch (Exception e) { - assertThat(e, instanceOf(IllegalArgumentException.class)); - } - } - - @Test - public void acceptClusteredAndEventualUnderlyingCache() { - Ehcache underlyingCache = buildMockCache(); - - new StronglyConsistentCacheAccessor(underlyingCache); - } - - @Test - public void testPutIfAbsent() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.putIfAbsent(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.putIfAbsent(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.putIfAbsent(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testSingleArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - element = cacheAccessor.replace(element); - assertThat(element, nullValue()); - - - element = cacheAccessor.replace(new Element("key", "otherValue")); - assertThat(element.getObjectValue(), equalTo((Object)"value")); - - try { - cacheAccessor.replace(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testTwoArgReplace() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(null, element); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(false)); - assertThat(cacheAccessor.replace(element, new Element("key", "otherValue")), is(true)); - - try { - cacheAccessor.replace(new Element(null, null), new Element("key", "other")); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - - try { - cacheAccessor.replace(new Element("key", "other"), new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void testRemoveElement() { - Element element = new Element("key", "value"); - Ehcache underlyingCache = buildMockCache(); - when(underlyingCache.getQuiet((Object)"key")).thenReturn(new Element("key", "other"), element); - when(underlyingCache.remove((Object)"key")).thenReturn(true); - - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(underlyingCache); - assertThat(cacheAccessor.removeElement(element), is(false)); - assertThat(cacheAccessor.removeElement(element), is(true)); - - try { - cacheAccessor.removeElement(new Element(null, null)); - fail("Expected NPE with null key"); - } catch (NullPointerException e) { - // Expected - } - } - - @Test - public void putMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - String put = "put"; - Set putMethods = getMethodsMatching(put); - for (Method putMethod : putMethods) { - int paramLength = putMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(putMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && putMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + putMethod.getName()); - putMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void replaceMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "test"); - - Set replaceMethods = getMethodsMatching("replace"); - for (Method replaceMethod : replaceMethods) { - int paramLength = replaceMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(replaceMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(element); - } else { - params[0] = element; - } - if (paramLength > 1 && replaceMethod.getParameterTypes()[1].equals(Element.class)) { - params[1] = element; - } - System.out.println("Invoking " + replaceMethod.getName()); - replaceMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void removeMethodsDoWriteLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "test"; - Element element = new Element(key, "someValue"); - - String remove = "remove"; - Set removeMethods = getMethodsMatching(remove, "Property"); - for (Method removeMethod : removeMethods) { - System.out.println("Checking " + removeMethod.getName() + "(" + Arrays.toString(removeMethod.getParameterTypes()) + ")"); - int paramLength = removeMethod.getParameterTypes().length; - if (paramLength == 0 || (paramLength == 1 && removeMethod.getParameterTypes()[0].isPrimitive())) { - continue; - } - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else if (Element.class.isAssignableFrom(removeMethod.getParameterTypes()[0])) { - params[0] = element; - } else { - params[0] = key; - } - if (paramLength > 1 && removeMethod.getParameterTypes()[1].equals(Boolean.TYPE)) { - params[1] = false; - } - System.out.println("Invoking " + removeMethod.getName() + " with " + Arrays.toString(params)); - removeMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireWriteLockOnKey(key); - verify(ehcache).releaseWriteLockOnKey(key); - reset(ehcache); - } - } - - @Test - public void getMethodsDoReadLock() throws Exception { - Ehcache ehcache = buildMockCache(); - StronglyConsistentCacheAccessor cacheAccessor = new StronglyConsistentCacheAccessor(ehcache); - - String key = "key"; - String get = "get"; - Set getMethods = getMethodsMatching(get, "Internal", "S", "Keys", "Cache", "Manager", "Name", "Guid"); - for (Method getMethod : getMethods) { - System.out.println("Checking " + getMethod.getName() + "(" + Arrays.toString(getMethod.getParameterTypes()) + ")"); - int paramLength = getMethod.getParameterTypes().length; - Object[] params = new Object[paramLength]; - if (Collection.class.isAssignableFrom(getMethod.getParameterTypes()[0])) { - params[0] = Collections.singleton(key); - } else { - params[0] = key; - } - - System.out.println("Invoking " + getMethod.getName() + " with " + Arrays.toString(params)); - getMethod.invoke(cacheAccessor, params); - verify(ehcache).acquireReadLockOnKey(key); - verify(ehcache).releaseReadLockOnKey(key); - reset(ehcache); - } - } - - private Set getMethodsMatching(String put, String... excludes) { - Set results = new HashSet(); - Method[] methods = Ehcache.class.getMethods(); - for (Method method : methods) { - if (method.getName().contains(put)) { - boolean exclude = false; - for (String exclusion : excludes) { - if (method.getName().contains(exclusion)) { - exclude = true; - } - } - if (!exclude) { - results.add(method); - } - } - } - return results; - } - - private Ehcache buildMockCache() {TerracottaConfiguration terracottaConfiguration = mock(TerracottaConfiguration.class); - CacheConfiguration cacheConfiguration = mock(CacheConfiguration.class); - Ehcache underlyingCache = mock(Ehcache.class); - - when(underlyingCache.getName()).thenReturn("testCache"); - when(underlyingCache.getCacheConfiguration()).thenReturn(cacheConfiguration); - when(cacheConfiguration.getTerracottaConfiguration()).thenReturn(terracottaConfiguration); - when(cacheConfiguration.getElementValueComparatorConfiguration()).thenReturn(new ElementValueComparatorConfiguration()); - when(terracottaConfiguration.getConsistency()).thenReturn(TerracottaConfiguration.Consistency.EVENTUAL); - return underlyingCache; - } -} Index: rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java =================================================================== diff -u -N --- rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 10926) +++ rctags/ehcache-2.10.7.0.13/ehcache-core/src/main/java/net/sf/ehcache/CacheQuery.java (revision 0) @@ -1,440 +0,0 @@ -/** - * Copyright Terracotta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package net.sf.ehcache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.sf.ehcache.search.Attribute; -import net.sf.ehcache.search.Direction; -import net.sf.ehcache.search.ExecutionHints; -import net.sf.ehcache.search.Query; -import net.sf.ehcache.search.Results; -import net.sf.ehcache.search.SearchException; -import net.sf.ehcache.search.aggregator.Aggregator; -import net.sf.ehcache.search.aggregator.AggregatorException; -import net.sf.ehcache.search.aggregator.AggregatorInstance; -import net.sf.ehcache.search.expression.AlwaysMatch; -import net.sf.ehcache.search.expression.Criteria; -import net.sf.ehcache.store.StoreQuery; - -/** - * Query builder implementation. Instances are bound to a specific cache - * - * @author teck - */ -class CacheQuery implements Query, StoreQuery { - - private volatile boolean frozen; - private volatile boolean includeKeys; - private volatile boolean includeValues; - private volatile int maxResults = -1; - private String[] targets; - - private final List orderings = Collections.synchronizedList(new ArrayList()); - private final Set> includedAttributes = Collections.synchronizedSet(new HashSet>()); - private final List criteria = Collections.synchronizedList(new ArrayList()); - private final List aggregators = Collections.synchronizedList(new ArrayList()); - private final Set> groupByAttributes = Collections.synchronizedSet(new HashSet>()); - - private final Cache cache; - private volatile ExecutionHints hints; - - /** - * Create a new builder instance - * - * @param cache - */ - public CacheQuery(Cache cache) { - this.cache = cache; - } - - /** - * {@inheritDoc} - */ - public Query includeKeys() { - checkFrozen(); - this.includeKeys = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeValues() { - checkFrozen(); - this.includeValues = true; - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAttribute(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - - this.includedAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query includeAggregator(Aggregator... aggregators) throws SearchException, AggregatorException { - checkFrozen(); - - if (aggregators == null) { - throw new NullPointerException(); - } - - for (Aggregator aggregator : aggregators) { - if (aggregator == null) { - throw new NullPointerException("null aggregator"); - } - - this.aggregators.add(aggregator); - } - - return this; - } - - /** - * {@inheritDoc} - */ - public Query addOrderBy(Attribute> attribute, Direction direction) { - checkFrozen(); - this.orderings.add(new OrderingImpl(attribute, direction)); - return this; - } - - /** - * {@inheritDoc} - */ - public Query addGroupBy(Attribute>... attributes) { - checkFrozen(); - - if (attributes == null) { - throw new NullPointerException(); - } - - for (Attribute> attribute : attributes) { - if (attribute == null) { - throw new NullPointerException("null attribute"); - } - groupByAttributes.add(attribute); - } - return this; - } - - /** - * {@inheritDoc} - */ - public Query maxResults(int maxResults) { - checkFrozen(); - this.maxResults = maxResults; - return this; - } - - /** - * {@inheritDoc} - */ - public Query addCriteria(Criteria criteria) { - checkFrozen(); - - if (criteria == null) { - throw new NullPointerException("null criteria"); - } - - this.criteria.add(criteria); - return this; - } - - /** - * {@inheritDoc} - */ - public Results execute() throws SearchException { - return cache.executeQuery(snapshot()); - } - - /** - * {@inheritDoc} - */ - public Results execute(ExecutionHints params) throws SearchException { - this.hints = params; - return cache.executeQuery(snapshot()); - } - - - /** - * {@inheritDoc} - */ - public Query end() { - frozen = true; - return this; - } - - /** - * {@inheritDoc} - */ - public List getOrdering() { - assertFrozen(); - return Collections.unmodifiableList(orderings); - } - - /** - * {@inheritDoc} - */ - public Criteria getCriteria() { - assertFrozen(); - return getEffectiveCriteriaCopy(); - } - - /** - * {@inheritDoc} - */ - public boolean requestsKeys() { - assertFrozen(); - return includeKeys; - } - - /** - * {@inheritDoc} - */ - public boolean requestsValues() { - assertFrozen(); - return includeValues; - } - - /** - * {@inheritDoc} - */ - public Cache getCache() { - assertFrozen(); - return cache; - } - - /** - * {@inheritDoc} - */ - public Set> requestedAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.includedAttributes); - } - - /** - * {@inheritDoc} - */ - public Set> groupByAttributes() { - assertFrozen(); - return Collections.unmodifiableSet(this.groupByAttributes); - } - - /** - * {@inheritDoc} - */ - public int maxResults() { - assertFrozen(); - return maxResults; - } - - - /** - * {@inheritDoc} - */ - @Override - public ExecutionHints getExecutionHints() { - assertFrozen(); - return hints; - } - - /** - * {@inheritDoc} - */ - public List getAggregators() { - return Collections.unmodifiableList(this.aggregators); - } - - /** - * {@inheritDoc} - */ - public List> getAggregatorInstances() { - assertFrozen(); - return Collections.unmodifiableList(createAggregatorInstances(aggregators)); - } - - private static List> createAggregatorInstances(List aggregators) { - List> rv = new ArrayList>(aggregators.size()); - for (Aggregator aggregator : aggregators) { - rv.add(aggregator.createInstance()); - } - - return rv; - } - - private Criteria getEffectiveCriteriaCopy() { - Criteria result = new AlwaysMatch(); - for (Criteria c : criteria) { - result = result.and(c); - } - return result; - } - - private void assertFrozen() { - if (!frozen) { - throw new AssertionError("not frozen"); - } - } - - private StoreQuery snapshot() { - if (frozen) { - return this; - } - - return new StoreQueryImpl(); - } - - private void checkFrozen() { - if (frozen) { - throw new SearchException("Query is frozen and cannot be mutated"); - } - } - - /** - * {@inheritDoc} - */ - public String[] getTargets() { - return this.targets; - } - - /** - * {@inheritDoc} - */ - @Override - public void targets(final String[] targets) { - this.targets = targets; - } - - /** - * StoreQuery implementation (essentially a snapshot of this (non-frozen) query builder - */ - private class StoreQueryImpl implements StoreQuery { - private final Criteria copiedCriteria = CacheQuery.this.getEffectiveCriteriaCopy(); - private final boolean copiedIncludeKeys = includeKeys; - private final boolean copiedIncludeValues = includeValues; - private final Set> copiedAttributes = Collections.unmodifiableSet(new HashSet>(includedAttributes)); - private final int copiedMaxResults = maxResults; - private final List copiedOrdering = Collections.unmodifiableList(new ArrayList(orderings)); - private final List copiedAggregators = Collections.unmodifiableList(aggregators); - private final List> copiedAggregatorInstances = Collections.unmodifiableList(createAggregatorInstances(aggregators)); - private final Set> copiedGroupByAttributes = Collections.unmodifiableSet(new HashSet>(groupByAttributes)); - private final ExecutionHints execHints = hints; - - public Criteria getCriteria() { - return copiedCriteria; - } - - public boolean requestsKeys() { - return copiedIncludeKeys; - } - - public boolean requestsValues() { - return copiedIncludeValues; - } - - public Cache getCache() { - return cache; - } - - public Set