JBoss Cache SVN: r4956 - cache-bench-fwk/trunk/conf.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-03 02:17:38 -0500 (Thu, 03 Jan 2008)
New Revision: 4956
Modified:
cache-bench-fwk/trunk/conf/cachebench.xml
Log:
removed other onfig files as they are utdated
Modified: cache-bench-fwk/trunk/conf/cachebench.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench.xml 2008-01-03 07:05:03 UTC (rev 4955)
+++ cache-bench-fwk/trunk/conf/cachebench.xml 2008-01-03 07:17:38 UTC (rev 4956)
@@ -46,7 +46,7 @@
<!-- warms up the cache by doing operation on it; simulates a real-world environment. If no warmup is needed use
org.cachebench.warmup.NoCacheWarmup
-->
- <warmup warmupClass="org.cachebench.warmup.NoCacheWarmup">
+ <warmup warmupClass="org.cachebench.warmup.PutGetCacheWarmup">
<param name="operationCount" value="100"/>
</warmup>
16 years, 9 months
JBoss Cache SVN: r4955 - cache-bench-fwk/trunk/conf.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-03 02:05:03 -0500 (Thu, 03 Jan 2008)
New Revision: 4955
Removed:
cache-bench-fwk/trunk/conf/cachebench-coherence.xml
cache-bench-fwk/trunk/conf/cachebench-jbc-async.xml
cache-bench-fwk/trunk/conf/cachebench-jbc-br-async.xml
cache-bench-fwk/trunk/conf/cachebench-jbc-br.xml
cache-bench-fwk/trunk/conf/cachebench-jbc-sync.xml
Log:
removed other onfig files as they are utdated
Deleted: cache-bench-fwk/trunk/conf/cachebench-coherence.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench-coherence.xml 2008-01-03 06:51:03 UTC (rev 4954)
+++ cache-bench-fwk/trunk/conf/cachebench-coherence.xml 2008-01-03 07:05:03 UTC (rev 4955)
@@ -1,73 +0,0 @@
-<!--
- Configures and controls the behaviour of the cache benchmarking framework.
-
- sampleSize - this is the number of putsgets to be performed, an average is used in metrics.
- gcBetweenTestsEnabled - if true, the framework pauses between each test and requests System.gc() - use this if you find yourself running out of mem!
- sleepBetweenTests - ms to sleep between tests. useful to allow the JVM some time to do a gc
- emptyCacheBetweenTests - again, use if you're running out of mem.
- numThreads - the number of executor threads to use to perform the required number of operations.
--->
-<cachebench sampleSize="100000" gcBetweenTestsEnabled="true" sleepBetweenTests="1000" emptyCacheBetweenTests="true" numThreads="10">
-
- <!-- Each testcase represents either a single configuration or a cacheing product.
-
- For example, WhirlyCache would be one test case. JBossCache-standalone could be another, JBossCache-replicated could be yet another
-
- See the javadoc for org.cachebench.CacheWrapper for the cacheWrapper property
- -->
-
- <!--
- Note that if you are using REPLICATED tests, using the "ant runSlave" command, you can only run one test at a time.
- Otherwise, if you are using the test in standalone mode (testing a LOCAL cache), you can add multiple "testcase" elements.
- -->
-
- <!-- Make SURE you read the docs - especially when using Terracotta as this involves some additional setup -->
-
- <!-- Legacy stuff -->
- <!--<testcase name="JBossCache140-Pessimistic-REPL_SYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCacheWrapper">-->
- <!--<testcase name="EHCache124-replicated" cacheWrapper="org.cachebench.cachewrappers.EHCacheWrapper">-->
- <!--<testcase name="Terracotta230" cacheWrapper="org.cachebench.cachewrappers.TerracottaWrapper">-->
-
-
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_SYNC_BR" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_ASYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <testcase name="Coherence-3.x" cacheWrapper="org.cachebench.cachewrappers.CoherenceWrapper">
-
- <!--
- * The "name" attrib is just used for display in the reports.
- * You can write your own custom testClass.
- * weight is currently unused.
- -->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
-
- <!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
- -->
-
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <param name="config" value="pess-repl-sync-br.xml" />
- <!--<param name="config" value="pess-repl-async.xml" />-->
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml" />-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml" />-->
- </testcase>
-
-
- <!-- Currently we only have a CSVReportGenerator. See javadocs for org.cachebench.reportgenerators.ReportGenerator for writing your
- own report generators such as XML generators, graphic generators, etc -->
-
- <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs, etc. -->
- <report
- outputFile="performance.csv"
- generator="org.cachebench.reportgenerators.CSVReportGenerator" />
-
-</cachebench>
Deleted: cache-bench-fwk/trunk/conf/cachebench-jbc-async.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench-jbc-async.xml 2008-01-03 06:51:03 UTC (rev 4954)
+++ cache-bench-fwk/trunk/conf/cachebench-jbc-async.xml 2008-01-03 07:05:03 UTC (rev 4955)
@@ -1,73 +0,0 @@
-<!--
- Configures and controls the behaviour of the cache benchmarking framework.
-
- sampleSize - this is the number of putsgets to be performed, an average is used in metrics.
- gcBetweenTestsEnabled - if true, the framework pauses between each test and requests System.gc() - use this if you find yourself running out of mem!
- sleepBetweenTests - ms to sleep between tests. useful to allow the JVM some time to do a gc
- emptyCacheBetweenTests - again, use if you're running out of mem.
- numThreads - the number of executor threads to use to perform the required number of operations.
--->
-<cachebench sampleSize="100000" gcBetweenTestsEnabled="true" sleepBetweenTests="1000" emptyCacheBetweenTests="true" numThreads="10">
-
- <!-- Each testcase represents either a single configuration or a cacheing product.
-
- For example, WhirlyCache would be one test case. JBossCache-standalone could be another, JBossCache-replicated could be yet another
-
- See the javadoc for org.cachebench.CacheWrapper for the cacheWrapper property
- -->
-
- <!--
- Note that if you are using REPLICATED tests, using the "ant runSlave" command, you can only run one test at a time.
- Otherwise, if you are using the test in standalone mode (testing a LOCAL cache), you can add multiple "testcase" elements.
- -->
-
- <!-- Make SURE you read the docs - especially when using Terracotta as this involves some additional setup -->
-
- <!-- Legacy stuff -->
- <!--<testcase name="JBossCache140-Pessimistic-REPL_SYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCacheWrapper">-->
- <!--<testcase name="EHCache124-replicated" cacheWrapper="org.cachebench.cachewrappers.EHCacheWrapper">-->
- <!--<testcase name="Terracotta230" cacheWrapper="org.cachebench.cachewrappers.TerracottaWrapper">-->
-
-
- <testcase name="JBossCache2x-Pessimistic-REPL_SYNC_BR" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_ASYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <!--<testcase name="Coherence-3.x" cacheWrapper="org.cachebench.cachewrappers.CoherenceWrapper">-->
-
- <!--
- * The "name" attrib is just used for display in the reports.
- * You can write your own custom testClass.
- * weight is currently unused.
- -->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
-
- <!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
- -->
-
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <!--<param name="config" value="pess-repl-sync-br.xml" /> -->
- <param name="config" value="pess-repl-async.xml" />
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml" />-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml" />-->
- </testcase>
-
-
- <!-- Currently we only have a CSVReportGenerator. See javadocs for org.cachebench.reportgenerators.ReportGenerator for writing your
- own report generators such as XML generators, graphic generators, etc -->
-
- <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs, etc. -->
- <report
- outputFile="performance.csv"
- generator="org.cachebench.reportgenerators.CSVReportGenerator" />
-
-</cachebench>
Deleted: cache-bench-fwk/trunk/conf/cachebench-jbc-br-async.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench-jbc-br-async.xml 2008-01-03 06:51:03 UTC (rev 4954)
+++ cache-bench-fwk/trunk/conf/cachebench-jbc-br-async.xml 2008-01-03 07:05:03 UTC (rev 4955)
@@ -1,73 +0,0 @@
-<!--
- Configures and controls the behaviour of the cache benchmarking framework.
-
- sampleSize - this is the number of putsgets to be performed, an average is used in metrics.
- gcBetweenTestsEnabled - if true, the framework pauses between each test and requests System.gc() - use this if you find yourself running out of mem!
- sleepBetweenTests - ms to sleep between tests. useful to allow the JVM some time to do a gc
- emptyCacheBetweenTests - again, use if you're running out of mem.
- numThreads - the number of executor threads to use to perform the required number of operations.
--->
-<cachebench sampleSize="100000" gcBetweenTestsEnabled="true" sleepBetweenTests="1000" emptyCacheBetweenTests="true" numThreads="10">
-
- <!-- Each testcase represents either a single configuration or a cacheing product.
-
- For example, WhirlyCache would be one test case. JBossCache-standalone could be another, JBossCache-replicated could be yet another
-
- See the javadoc for org.cachebench.CacheWrapper for the cacheWrapper property
- -->
-
- <!--
- Note that if you are using REPLICATED tests, using the "ant runSlave" command, you can only run one test at a time.
- Otherwise, if you are using the test in standalone mode (testing a LOCAL cache), you can add multiple "testcase" elements.
- -->
-
- <!-- Make SURE you read the docs - especially when using Terracotta as this involves some additional setup -->
-
- <!-- Legacy stuff -->
- <!--<testcase name="JBossCache140-Pessimistic-REPL_SYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCacheWrapper">-->
- <!--<testcase name="EHCache124-replicated" cacheWrapper="org.cachebench.cachewrappers.EHCacheWrapper">-->
- <!--<testcase name="Terracotta230" cacheWrapper="org.cachebench.cachewrappers.TerracottaWrapper">-->
-
-
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_SYNC_BR" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <testcase name="JBossCache2x-Pessimistic-REPL_ASYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">
- <!--<testcase name="Coherence-3.x" cacheWrapper="org.cachebench.cachewrappers.CoherenceWrapper">-->
-
- <!--
- * The "name" attrib is just used for display in the reports.
- * You can write your own custom testClass.
- * weight is currently unused.
- -->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
-
- <!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
- -->
-
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <!--<param name="config" value="pess-repl-sync-br.xml" /> -->
- <param name="config" value="pess-repl-async-br.xml" />
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml" />-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml" />-->
- </testcase>
-
-
- <!-- Currently we only have a CSVReportGenerator. See javadocs for org.cachebench.reportgenerators.ReportGenerator for writing your
- own report generators such as XML generators, graphic generators, etc -->
-
- <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs, etc. -->
- <report
- outputFile="performance.csv"
- generator="org.cachebench.reportgenerators.CSVReportGenerator" />
-
-</cachebench>
Deleted: cache-bench-fwk/trunk/conf/cachebench-jbc-br.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench-jbc-br.xml 2008-01-03 06:51:03 UTC (rev 4954)
+++ cache-bench-fwk/trunk/conf/cachebench-jbc-br.xml 2008-01-03 07:05:03 UTC (rev 4955)
@@ -1,73 +0,0 @@
-<!--
- Configures and controls the behaviour of the cache benchmarking framework.
-
- sampleSize - this is the number of putsgets to be performed, an average is used in metrics.
- gcBetweenTestsEnabled - if true, the framework pauses between each test and requests System.gc() - use this if you find yourself running out of mem!
- sleepBetweenTests - ms to sleep between tests. useful to allow the JVM some time to do a gc
- emptyCacheBetweenTests - again, use if you're running out of mem.
- numThreads - the number of executor threads to use to perform the required number of operations.
--->
-<cachebench sampleSize="100000" gcBetweenTestsEnabled="true" sleepBetweenTests="1000" emptyCacheBetweenTests="true" numThreads="10">
-
- <!-- Each testcase represents either a single configuration or a cacheing product.
-
- For example, WhirlyCache would be one test case. JBossCache-standalone could be another, JBossCache-replicated could be yet another
-
- See the javadoc for org.cachebench.CacheWrapper for the cacheWrapper property
- -->
-
- <!--
- Note that if you are using REPLICATED tests, using the "ant runSlave" command, you can only run one test at a time.
- Otherwise, if you are using the test in standalone mode (testing a LOCAL cache), you can add multiple "testcase" elements.
- -->
-
- <!-- Make SURE you read the docs - especially when using Terracotta as this involves some additional setup -->
-
- <!-- Legacy stuff -->
- <!--<testcase name="JBossCache140-Pessimistic-REPL_SYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCacheWrapper">-->
- <!--<testcase name="EHCache124-replicated" cacheWrapper="org.cachebench.cachewrappers.EHCacheWrapper">-->
- <!--<testcase name="Terracotta230" cacheWrapper="org.cachebench.cachewrappers.TerracottaWrapper">-->
-
-
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_SYNC_BR" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <testcase name="JBossCache2x-Pessimistic-REPL_ASYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">
- <!--<testcase name="Coherence-3.x" cacheWrapper="org.cachebench.cachewrappers.CoherenceWrapper">-->
-
- <!--
- * The "name" attrib is just used for display in the reports.
- * You can write your own custom testClass.
- * weight is currently unused.
- -->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
-
- <!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
- -->
-
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <param name="config" value="pess-repl-sync-br.xml" />
- <!--<param name="config" value="pess-repl-async.xml" />-->
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml" />-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml" />-->
- </testcase>
-
-
- <!-- Currently we only have a CSVReportGenerator. See javadocs for org.cachebench.reportgenerators.ReportGenerator for writing your
- own report generators such as XML generators, graphic generators, etc -->
-
- <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs, etc. -->
- <report
- outputFile="performance.csv"
- generator="org.cachebench.reportgenerators.CSVReportGenerator" />
-
-</cachebench>
Deleted: cache-bench-fwk/trunk/conf/cachebench-jbc-sync.xml
===================================================================
--- cache-bench-fwk/trunk/conf/cachebench-jbc-sync.xml 2008-01-03 06:51:03 UTC (rev 4954)
+++ cache-bench-fwk/trunk/conf/cachebench-jbc-sync.xml 2008-01-03 07:05:03 UTC (rev 4955)
@@ -1,73 +0,0 @@
-<!--
- Configures and controls the behaviour of the cache benchmarking framework.
-
- sampleSize - this is the number of putsgets to be performed, an average is used in metrics.
- gcBetweenTestsEnabled - if true, the framework pauses between each test and requests System.gc() - use this if you find yourself running out of mem!
- sleepBetweenTests - ms to sleep between tests. useful to allow the JVM some time to do a gc
- emptyCacheBetweenTests - again, use if you're running out of mem.
- numThreads - the number of executor threads to use to perform the required number of operations.
--->
-<cachebench sampleSize="100000" gcBetweenTestsEnabled="true" sleepBetweenTests="1000" emptyCacheBetweenTests="true" numThreads="10">
-
- <!-- Each testcase represents either a single configuration or a cacheing product.
-
- For example, WhirlyCache would be one test case. JBossCache-standalone could be another, JBossCache-replicated could be yet another
-
- See the javadoc for org.cachebench.CacheWrapper for the cacheWrapper property
- -->
-
- <!--
- Note that if you are using REPLICATED tests, using the "ant runSlave" command, you can only run one test at a time.
- Otherwise, if you are using the test in standalone mode (testing a LOCAL cache), you can add multiple "testcase" elements.
- -->
-
- <!-- Make SURE you read the docs - especially when using Terracotta as this involves some additional setup -->
-
- <!-- Legacy stuff -->
- <!--<testcase name="JBossCache140-Pessimistic-REPL_SYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCacheWrapper">-->
- <!--<testcase name="EHCache124-replicated" cacheWrapper="org.cachebench.cachewrappers.EHCacheWrapper">-->
- <!--<testcase name="Terracotta230" cacheWrapper="org.cachebench.cachewrappers.TerracottaWrapper">-->
-
-
- <testcase name="JBossCache2x-Pessimistic-REPL_SYNC_BR" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">
- <!--<testcase name="JBossCache2x-Pessimistic-REPL_ASYNC" cacheWrapper="org.cachebench.cachewrappers.JBossCache200Wrapper">-->
- <!--<testcase name="Coherence-3.x" cacheWrapper="org.cachebench.cachewrappers.CoherenceWrapper">-->
-
- <!--
- * The "name" attrib is just used for display in the reports.
- * You can write your own custom testClass.
- * weight is currently unused.
- -->
- <test name="Strings" testClass="org.cachebench.tests.StringTest" weight="2.0" />
-
- <!--
- <test name="Primitive Wrappers" testClass="org.cachebench.tests.PrimitiveTest" weight="1.0" />
- <test name="Custom Class Types" testClass="org.cachebench.tests.CustomClassTest" weight="1.0" />
- <test name="Custom Subclasses of Abstracts" testClass="org.cachebench.tests.SubclassTest" weight="1.5" />
- <test name="Custom Types With Transients" testClass="org.cachebench.tests.TransientTest" weight="1.0" />
- <test name="Custom Types With Statics" testClass="org.cachebench.tests.StaticsTest" weight="1.5" />
- <test name="Custom Types With Associations" testClass="org.cachebench.tests.AssociationsTest" weight="2.0" />
- -->
-
- <!-- arbitrary params may be passed into the cacheWrapper implementation, typically used to pass in config files for the cache product. -->
- <!-- JBoss Cache 1.4.x and 2.x -->
- <param name="config" value="pess-repl-sync.xml" />
- <!--<param name="config" value="pess-repl-async.xml" />-->
-
- <!-- EHCache -->
- <!--<param name="config" value="ehcache-repl-sync.xml" />-->
-
- <!-- Terracotta -->
- <!--<param name="config" value="tc-config-pojo.xml" />-->
- </testcase>
-
-
- <!-- Currently we only have a CSVReportGenerator. See javadocs for org.cachebench.reportgenerators.ReportGenerator for writing your
- own report generators such as XML generators, graphic generators, etc -->
-
- <!-- The CSV report generated can be plugged in to a spreadsheet to generate graphs, etc. -->
- <report
- outputFile="performance.csv"
- generator="org.cachebench.reportgenerators.CSVReportGenerator" />
-
-</cachebench>
16 years, 9 months
JBoss Cache SVN: r4954 - in cache-bench-fwk/trunk: cache-products/terracotta-2.5.0 and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-03 01:51:03 -0500 (Thu, 03 Jan 2008)
New Revision: 4954
Modified:
cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java
cache-bench-fwk/trunk/runNode.sh
Log:
enhanced - added a new test that checks that caches that replications occurs as expected + refactorings
Modified: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh 2008-01-03 02:27:56 UTC (rev 4953)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh 2008-01-03 06:51:03 UTC (rev 4954)
@@ -3,7 +3,7 @@
TC_HOME="/cygdrive/c/java/terracotta-2.5.0"
CLASSPATH=$CLASSPATH:./classes/production/terracotta-2.5.0
SYS_PROPS="$SYS_PROPS -Dtc.config=$THIS_DIR/tc-client-config.xml"
-export START_NODE_COMMAND="$TC_HOME/bin/dso-java.sh -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner"
+#export START_NODE_COMMAND="$TC_HOME/bin/dso-java.sh -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner"
export START_NODE_COMMAND="java -Dtc.install-root=${TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/dso-boot/dso-boot-hotspot_win32_150_14.jar $SYS_PROPS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner"
\ No newline at end of file
Modified: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java 2008-01-03 02:27:56 UTC (rev 4953)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java 2008-01-03 06:51:03 UTC (rev 4954)
@@ -2,7 +2,6 @@
import org.cachebench.CacheWrapper;
-import java.util.Properties;
import java.util.Map;
import java.util.HashMap;
@@ -18,10 +17,15 @@
// Since terracotta
private final Map cache = new HashMap();
- public void init(Properties parameters) throws Exception
+ public void init(Map parameters) throws Exception
{
}
+ public Object getReplicatedData(String key) throws Exception
+ {
+ return get(key);
+ }
+
public void setUp() throws Exception
{
}
@@ -70,4 +74,5 @@
return "There are " + cache.size() + " objects in cache";
}
}
+
}
Modified: cache-bench-fwk/trunk/runNode.sh
===================================================================
--- cache-bench-fwk/trunk/runNode.sh 2008-01-03 02:27:56 UTC (rev 4953)
+++ cache-bench-fwk/trunk/runNode.sh 2008-01-03 06:51:03 UTC (rev 4954)
@@ -7,7 +7,7 @@
CACHE_DEBUG=true
preferIPv4Stack=true
-if [ -z $1]
+if [ -z $1 ]
then
echo "Usage:"
echo " ./runNode.sh currentNodeIndex testConfig [other params]"
16 years, 9 months
JBoss Cache SVN: r4953 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 21:27:56 -0500 (Wed, 02 Jan 2008)
New Revision: 4953
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
Cleaned up interceptor implementations
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ActivationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,6 +1,10 @@
package org.jboss.cache.interceptors;
-import org.jboss.cache.*;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.InvocationContext;
+import org.jboss.cache.Modification;
+import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.transaction.GlobalTransaction;
@@ -8,8 +12,8 @@
import org.jboss.cache.transaction.TransactionTable;
import org.jgroups.Address;
+import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
-import javax.transaction.SystemException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
@@ -47,6 +51,7 @@
isActivation = true;
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveDataMethod(ctx, tx, fqn, createUndoOps);
@@ -58,6 +63,7 @@
return returnValue;
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveNodeMethod(ctx, tx, fqn, createUndoOps);
@@ -69,6 +75,7 @@
return returnValue;
}
+ @Override
protected Object handlePrintMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handlePrintMethod(ctx, fqn);
@@ -76,6 +83,7 @@
return returnValue;
}
+ @Override
protected Object handleReleaseAllLocksMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleReleaseAllLocksMethod(ctx, fqn);
@@ -83,6 +91,7 @@
return returnValue;
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleGetChildrenNamesMethod(ctx, fqn);
@@ -90,6 +99,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleGetKeysMethod(ctx, fqn);
@@ -97,6 +107,7 @@
return returnValue;
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = super.handleGetNodeMethod(ctx, fqn);
@@ -104,6 +115,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent) throws Throwable
{
Object returnValue = super.handleGetKeyValueMethod(ctx, fqn, key, sendNodeEvent);
@@ -111,6 +123,7 @@
return returnValue;
}
+ @Override
protected Object handleAddChildMethod(InvocationContext ctx, GlobalTransaction tx, Fqn parentFqn, Object childName, Node cn, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleAddChildMethod(ctx, tx, parentFqn, childName, cn, createUndoOps);
@@ -118,6 +131,7 @@
return returnValue;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
Object returnValue = super.handlePutForExternalReadMethod(ctx, tx, fqn, key, value);
@@ -125,6 +139,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handlePutDataMethod(ctx, tx, fqn, data, createUndoOps);
@@ -132,6 +147,7 @@
return returnValue;
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handlePutKeyValueMethod(ctx, gtx, fqn, key, value, createUndoOps);
@@ -139,6 +155,7 @@
return returnValue;
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
Object returnValue = super.handleRemoveKeyMethod(ctx, tx, fqn, key, createUndoOps);
@@ -146,6 +163,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object returnValue = super.handlePutDataEraseMethod(ctx, gt, fqn, newData, createUndoOps, eraseContents);
@@ -172,7 +190,8 @@
log.debug("children all initialized");
remove(ctx, fqn);
}
- } else if (loaderNoChildren(fqn))
+ }
+ else if (loaderNoChildren(fqn))
{
if (log.isDebugEnabled()) log.debug("no children " + n);
remove(ctx, fqn);
@@ -180,25 +199,29 @@
}
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
Object retval = nextInterceptor(ctx);
- if (inTransaction()) {
+ if (inTransaction())
+ {
prepareCacheLoader(ctx);
}
return retval;
}
private boolean inTransaction()
- throws SystemException
+ throws SystemException
{
return tx_mgr != null && tx_mgr.getTransaction() != null;
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
Object retval = nextInterceptor(ctx);
- if (inTransaction()) {
+ if (inTransaction())
+ {
prepareCacheLoader(ctx);
}
return retval;
@@ -257,12 +280,14 @@
return m_activations;
}
+ @Override
public void resetStatistics()
{
super.resetStatistics();
m_activations = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = super.dumpStatistics();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/BaseRpcInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -41,6 +41,7 @@
usingBuddyReplication = buddyManager != null && buddyManager.isEnabled();
}
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,6 +1,6 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -9,6 +9,7 @@
import org.jboss.cache.config.Configuration;
import static org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.annotations.Inject;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.lock.NodeLock;
@@ -42,6 +43,11 @@
protected CacheLoaderManager clm;
protected boolean usingOptimisticInvalidation = false;
+ public CacheLoaderInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
/**
* True if CacheStoreInterceptor is in place.
* This allows us to skip loading keys for remove(Fqn, key) and put(Fqn, key).
@@ -49,11 +55,6 @@
*/
protected boolean useCacheStore = true;
- protected Log getLog()
- {
- return log;
- }
-
@Inject
protected void injectDependencies(TransactionTable txTable, CacheLoaderManager clm, Configuration configuration)
{
@@ -63,13 +64,13 @@
usingOptimisticInvalidation = configuration.isNodeLockingOptimistic() && mode.isInvalidation();
}
- public Object invoke(InvocationContext ctx) throws Throwable
+ @Start
+ protected void startInterceptor()
{
- if (loader == null) loader = clm.getCacheLoader();
- return super.invoke(ctx);
+ loader = clm.getCacheLoader();
}
-
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
if (fqn != null)
@@ -79,6 +80,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
if (fqn != null)
@@ -88,6 +90,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
if (fqn != null)
@@ -97,6 +100,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
if (fqn != null)
@@ -106,6 +110,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws Throwable
{
if (from != null)
@@ -120,6 +125,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleAddChildMethod(InvocationContext ctx, GlobalTransaction tx, Fqn parentFqn, Object childName, Node cn, boolean createUndoOps) throws Throwable
{
@@ -131,6 +137,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent) throws Throwable
{
if (fqn != null)
@@ -140,6 +147,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -149,6 +157,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -158,6 +167,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleReleaseAllLocksMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -167,6 +177,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePrintMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -176,6 +187,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -185,6 +197,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
if (fqn != null)
@@ -194,6 +207,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
// clean up nodesCreated map
@@ -221,6 +235,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
if (cache.getConfiguration().isNodeLockingOptimistic() && fqn != null)
@@ -230,6 +245,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
if (fqn != null && !useCacheStore)
@@ -239,6 +255,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
if (fqn != null && !useCacheStore)
@@ -424,12 +441,14 @@
return m_cacheMisses;
}
+ @Override
public void resetStatistics()
{
m_cacheLoads = 0;
m_cacheMisses = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheMgmtInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -21,12 +21,11 @@
*/
package org.jboss.cache.interceptors;
-import org.jboss.cache.CacheSPI;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.Fqn;
import org.jboss.cache.optimistic.DataVersion;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.apache.commons.logging.Log;
import java.util.HashMap;
import java.util.Map;
@@ -49,21 +48,18 @@
private long m_start = System.currentTimeMillis();
private long m_reset = m_start;
- public void setCache(CacheSPI cache)
+ public CacheMgmtInterceptor()
{
- super.setCache(cache);
+ log = LogFactory.getLog(getClass());
}
- protected Log getLog()
- {
- return log;
- }
-
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
return !getStatisticsEnabled();
}
+ @Override
protected Object handleEvictMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -71,6 +67,7 @@
return returnValue;
}
+ @Override
protected Object handleEvictVersionedNodeMethod(InvocationContext ctx, Fqn fqn, DataVersion dataVersion) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -78,6 +75,7 @@
return returnValue;
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent) throws Throwable
{
long t1 = System.currentTimeMillis();
@@ -87,7 +85,8 @@
{
m_miss_times = m_miss_times + (t2 - t1);
m_misses++;
- } else
+ }
+ else
{
m_hit_times = m_hit_times + (t2 - t1);
m_hits++;
@@ -95,18 +94,20 @@
return retval;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
return handlePutData(ctx, data);
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
return handlePutData(ctx, newData);
}
private Object handlePutData(InvocationContext ctx, Map data)
- throws Throwable
+ throws Throwable
{
long t1 = System.currentTimeMillis();
Object retval = nextInterceptor(ctx);
@@ -120,18 +121,20 @@
return retval;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
return handlePutExternalAndKeyValue(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutExternalAndKeyValue(ctx);
}
private Object handlePutExternalAndKeyValue(InvocationContext ctx)
- throws Throwable
+ throws Throwable
{
long t1 = System.currentTimeMillis();
Object retval = nextInterceptor(ctx);
@@ -211,6 +214,7 @@
return (System.currentTimeMillis() - m_reset) / 1000;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
@@ -229,6 +233,7 @@
return retval;
}
+ @Override
public void resetStatistics()
{
m_hits = 0;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheStoreInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,13 +1,13 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Modification;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.CacheLoaderConfig;
+import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -45,30 +45,25 @@
private long m_cacheStores = 0;
protected CacheLoader loader;
- protected Log getLog()
+
+ public CacheStoreInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
- public void setCache(CacheSPI cache)
+ @Start
+ protected void startInterceptor()
{
- super.setCache(cache);
+ loader = cache.getCacheLoaderManager().getCacheLoader();
this.loaderConfig = cache.getCacheLoaderManager().getCacheLoaderConfig();
tx_mgr = cache.getTransactionManager();
tx_table = cache.getTransactionTable();
- this.loader = cache.getCacheLoaderManager().getCacheLoader();
}
- public Object invoke(InvocationContext ctx) throws Throwable
- {
- if (loaderConfig == null) loaderConfig = cache.getCacheLoaderManager().getCacheLoaderConfig();
- if (loader == null) loader = cache.getCacheLoaderManager().getCacheLoader();
- return super.invoke(ctx);
- }
-
/**
* if this is a shared cache loader and the call is of remote origin, pass up the chain
*/
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
if (!ctx.isOriginLocal() && loaderConfig.isShared())
@@ -82,6 +77,7 @@
return false;
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction gtx) throws Throwable
{
if (inTransaction())
@@ -129,6 +125,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction gtx) throws Throwable
{
if (inTransaction())
@@ -155,6 +152,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
if (inTransaction())
@@ -165,6 +163,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
if (inTransaction())
@@ -179,6 +178,7 @@
* remove() methods need to be applied to the CacheLoader before passing up the call: a listener might
* access an element just removed, causing the CacheLoader to *load* the element before *removing* it.
*/
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -191,6 +191,7 @@
/**
* @see #handleRemoveNodeMethod(org.jboss.cache.InvocationContext, org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, boolean)
*/
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -205,6 +206,7 @@
/**
* @see #handleRemoveNodeMethod(org.jboss.cache.InvocationContext, org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, boolean)
*/
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
if (!inTransaction())
@@ -220,6 +222,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -233,6 +236,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -247,6 +251,7 @@
return returnValue;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
Object returnValue = nextInterceptor(ctx);
@@ -262,11 +267,13 @@
return returnValue;
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
return handlePutKeyValue(ctx, fqn, key, value);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutKeyValue(ctx, fqn, key, value);
@@ -332,11 +339,13 @@
return m_cacheStores;
}
+ @Override
public void resetStatistics()
{
m_cacheStores = 0;
}
+ @Override
public Map<String, Object> dumpStatistics()
{
Map<String, Object> retval = new HashMap<String, Object>();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
@@ -50,9 +49,9 @@
{
private BuddyManager buddyManager;
private boolean syncCommunications = false;
- private Log log = LogFactory.getLog(DataGravitatorInterceptor.class);
private Map<GlobalTransaction, MethodCall> transactionMods = new ConcurrentHashMap<GlobalTransaction, MethodCall>();
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
@@ -60,47 +59,55 @@
syncCommunications = configuration.getCacheMode() == Configuration.CacheMode.REPL_SYNC || configuration.getCacheMode() == Configuration.CacheMode.INVALIDATION_SYNC;
}
- protected Log getLog()
+ public DataGravitatorInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected boolean skipMethodCall(InvocationContext ctx)
{
return MethodDeclarations.isBlockUnblockMethod(ctx.getMethodCall().getMethodId()) ||
ctx.getOptionOverrides().isSkipDataGravitation();
}
+ @Override
protected Object handleGetChildrenNamesMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleExistsMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeysMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetMethod(ctx, fqn);
}
+ @Override
protected Object handlePrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modification, Address coordinator, boolean onePhaseCommit) throws Throwable
{
try
@@ -117,11 +124,13 @@
}
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
return handlePrepareMethod(ctx, gtx, modifications, address, onePhaseCommit);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
try
@@ -136,6 +145,7 @@
}
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
try
@@ -282,28 +292,6 @@
log.trace("Got response " + gr);
}
-// if (configuration.isUseRegionBasedMarshalling())
-// {
-// ClassLoader cl = Thread.currentThread().getContextClassLoader();
-// try
-// {
-// cache.getRegionManager().setContextClassLoaderAsCurrent(name);
-//
-// byte[] nodeData = (byte[]) resp[0];
-// ByteArrayInputStream bais = new ByteArrayInputStream(nodeData);
-// MarshalledValueInputStream mais = new MarshalledValueInputStream(bais);
-// nodes = (List) mais.readObject();
-// mais.close();
-// }
-// finally
-// {
-// Thread.currentThread().setContextClassLoader(cl);
-// }
-// }
-// else
-// {
-// }
-
result = new BackupData(name, gr);
}
@@ -312,18 +300,6 @@
private void cleanBackupData(BackupData backup, GlobalTransaction gtx, InvocationContext ctx) throws Throwable
{
- // MethodCall primaryDataCleanup, backupDataCleanup;
- // if (buddyManager.isDataGravitationRemoveOnFind())
- // {
- // primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null, backup.primaryFqn, Boolean.FALSE});
- // backupDataCleanup = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{null, backup.backupFqn, Boolean.FALSE});
- // }
- // else
- // {
- // primaryDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{backup.primaryFqn});
- // backupDataCleanup = MethodCallFactory.create(MethodDeclarations.evictNodeMethodLocal, new Object[]{backup.backupFqn});
- // }
-
MethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, backup.primaryFqn, backup.backupFqn);
@@ -332,11 +308,8 @@
{
// broadcast removes
// remove main Fqn
- //replicateCall(cache.getMembers(), primaryDataCleanup, syncCommunications);
-
if (log.isTraceEnabled()) log.trace("Performing cleanup on [" + backup.backupFqn + "]");
// remove backup Fqn
- //replicateCall(cache.getMembers(), backupDataCleanup, syncCommunications);
replicateCall(cache.getMembers(), cleanup, syncCommunications, ctx.getOptionOverrides(), false);
}
else
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/EvictionInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -7,7 +7,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -33,8 +32,6 @@
*/
public class EvictionInterceptor extends MethodDispacherInterceptor
{
- private static final Log log = LogFactory.getLog(EvictionInterceptor.class);
-
protected RegionManager regionManager;
/**
@@ -49,16 +46,18 @@
this.regionManager = regionManager;
}
- protected Log getLog()
+ public EvictionInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected Object handleEvictVersionedNodeMethod(InvocationContext ctx, Fqn fqn, DataVersion dataVersion) throws Throwable
{
return handleEvictMethod(ctx, fqn);
}
+ @Override
protected Object handleEvictMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -76,11 +75,13 @@
return retVal;
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
return handlePutForExternalReadMethod(ctx, gtx, fqn, key, value);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -91,6 +92,7 @@
return retVal;
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -118,6 +120,7 @@
return retVal;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -144,6 +147,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveKeyMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -165,6 +169,7 @@
return retVal;
}
+ @Override
protected Object handleGetNodeMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -185,11 +190,13 @@
return retVal;
}
+ @Override
protected Object handleGetDataMapMethod(InvocationContext ctx, Fqn fqn) throws Throwable
{
return handleGetNodeMethod(ctx, fqn);
}
+ @Override
protected Object handleGetKeyValueMethod(InvocationContext ctx, Fqn fqn, Object key, boolean sendNodeEvent) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -207,6 +214,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveNodeMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
Object retVal = nextInterceptor(ctx);
@@ -217,6 +225,7 @@
return retVal;
}
+ @Override
protected Object handleRemoveDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, boolean createUndoOps) throws Throwable
{
return handleRemoveNodeMethod(ctx, tx, fqn, createUndoOps);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -54,10 +54,14 @@
protected Map<GlobalTransaction, List<MethodCall>> txMods;
protected boolean optimistic;
+ public InvalidationInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
public void setCache(CacheSPI cache)
{
super.setCache(cache);
-// txTable = cache.getTransactionTable();
optimistic = configuration.isNodeLockingOptimistic();
if (optimistic) txMods = new ConcurrentHashMap<GlobalTransaction, List<MethodCall>>();
}
@@ -68,11 +72,6 @@
this.txTable = txTable;
}
- protected Log getLog()
- {
- return log;
- }
-
protected boolean skipMethodCall(InvocationContext ctx)
{
Option optionOverride = ctx.getOptionOverrides();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvocationContextInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Option;
import org.jboss.cache.marshall.MethodCall;
@@ -23,11 +23,12 @@
*/
public class InvocationContextInterceptor extends BaseTransactionalContextInterceptor implements InvocationContextInterceptorMBean
{
- protected Log getLog()
+ public InvocationContextInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
+ @Override
public Object invoke(InvocationContext ctx) throws Throwable
{
MethodCall call = ctx.getMethodCall();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,6 +1,5 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
@@ -33,7 +32,6 @@
* @author Mircea.Markus(a)jboss.com
* @version 2.1.0
* todo - Refactor stuff in txint
- * todo - revisit backward compatibility
*/
public abstract class MethodDispacherInterceptor extends Interceptor
{
@@ -52,7 +50,7 @@
*/
public Object invoke(InvocationContext ctx) throws Throwable
{
- if (getLog() != null && getLog().isTraceEnabled())
+ if (log.isTraceEnabled())
{
log.trace("Invoked with method call " + ctx.getMethodCall());
}
@@ -275,11 +273,6 @@
}
/**
- * used for logging various steps. if null is returned than nothing is logged.
- */
- protected abstract Log getLog();
-
- /**
* Each interceptor should extend this if it does not need any processing for current call.
* An sample usage would be: this interceptor is only interested if thre is one transaction going on. If so all
* handleXYZ would know that we have a transaction going and would not check its state.
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/NotificationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,10 +1,8 @@
package org.jboss.cache.interceptors;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.transaction.GlobalTransaction;
-import org.jboss.cache.marshall.MethodCall;
-import org.jboss.cache.marshall.MethodDeclarations;
-import org.apache.commons.logging.Log;
/**
* The interceptor in charge of firing off notifications to cache listeners
@@ -14,11 +12,12 @@
*/
public class NotificationInterceptor extends BaseTransactionalContextInterceptor
{
- protected Log getLog()
+ public NotificationInterceptor()
{
- return null;
+ log = LogFactory.getLog(getClass());
}
+ @Override
protected Object handleBlockChannelMethod(InvocationContext ctx) throws Throwable
{
cache.getNotifier().notifyCacheBlocked(cache, true);
@@ -27,6 +26,7 @@
return retVal;
}
+ @Override
protected Object handleUnblockChannelMethod(InvocationContext ctx) throws Throwable
{
cache.getNotifier().notifyCacheUnblocked(cache, true);
@@ -35,6 +35,7 @@
return retval;
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
// notify commit
@@ -44,6 +45,7 @@
return retval;
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
Object retval = nextInterceptor(ctx);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticCreateIfNotExistsInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -46,54 +46,63 @@
this.nodeFactory = nodeFactory;
}
+ @Override
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataEraseVersionedMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Map data, boolean createUndoOps, boolean eraseContent, DataVersion dv) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataEraseMethod(InvocationContext ctx, GlobalTransaction gt, Fqn fqn, Map newData, boolean createUndoOps, boolean eraseContents) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutDataVersionedMethod(InvocationContext ctx, GlobalTransaction globalTransaction, Fqn fqn, Map map, Boolean createUndoOps, DataVersion dataVersion) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutKeyValueVersionedMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, boolean createUndoOps, DataVersion dv) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Object key, Object value) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handlePutForExternalReadVersionedMethod(InvocationContext ctx, GlobalTransaction gtx, Fqn fqn, Object key, Object value, DataVersion dv) throws Throwable
{
createNode(ctx, fqn, false);
return nextInterceptor(ctx);
}
+ @Override
protected Object handleMoveMethod(InvocationContext ctx, Fqn from, Fqn to) throws Throwable
{
List<Fqn> fqns = new ArrayList<Fqn>();
@@ -135,13 +144,6 @@
List<Fqn> nodesCreated = new ArrayList<Fqn>();
- // synchronize on the workspace so that more than one thread doesn't attempt to put stuff into the workspace for
- // the same transaction. Isn't this unlikely though, given that each transaction would only occur in a single thread
- // at a time?
-/*
- synchronized (workspace)
- {
-*/
DataVersion version = null;
if (ctx.getOptionOverrides() != null && ctx.getOptionOverrides().getDataVersion() != null)
{
@@ -272,8 +274,6 @@
}
}
- //}// end sync block
-
if (!suppressNotification)
{
if (nodesCreated.size() > 0)
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,6 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -26,17 +25,12 @@
*
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
-public class OptimisticInterceptor extends MethodDispacherInterceptor
+public abstract class OptimisticInterceptor extends MethodDispacherInterceptor
{
protected TransactionManager txManager = null;
protected TransactionTable txTable = null;
protected boolean trace;
- protected Log getLog()
- {
- return null;
- }
-
@Inject
private void injectDependencies(TransactionManager txManager, TransactionTable txTable)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticLockingInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -34,13 +34,14 @@
{
private long lockAcquisitionTimeout;
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
lockAcquisitionTimeout = cache.getConfiguration().getLockAcquisitionTimeout();
}
-
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
//try and acquire the locks - before passing on
@@ -96,16 +97,19 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
return transactionFinalized(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
return transactionFinalized(ctx);
}
+ @Override
protected Object handleLockMethod(InvocationContext ctx, Fqn fqn, NodeLock.LockType lockType, boolean recursive)
{
// bail out if _lock() is being called on the tree cache... this should never be called with o/l enabled.
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -51,6 +51,7 @@
this.nodeFactory = nodeFactory;
}
+ @Override
public Object invoke(InvocationContext ctx) throws Throwable
{
MethodCall m = ctx.getMethodCall();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticReplicationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -47,10 +47,9 @@
// we really just need a set here, but concurrent CopyOnWriteArraySet has poor performance when writing.
private final Set<GlobalTransaction> broadcastTxs = new ConcurrentHashSet<GlobalTransaction>();
-
- protected Log getLog()
+ public OptimisticReplicationInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticValidatorInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -47,6 +47,7 @@
{
private boolean useTombstones;
+ @Override
public void setCache(CacheSPI cache)
{
super.setCache(cache);
@@ -54,6 +55,7 @@
useTombstones = (mode == CacheMode.INVALIDATION_ASYNC) || (mode == CacheMode.INVALIDATION_SYNC);
}
+ @Override
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
TransactionWorkspace workspace = getTransactionWorkspace(getGlobalTransaction(ctx));
@@ -90,7 +92,8 @@
if (underlyingNode != null && !underlyingNode.isValid())
{
// we havea tombstone
- if (!workspaceNode.isCreated() && !workspaceNode.isDeleted()) throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
+ if (!workspaceNode.isCreated() && !workspaceNode.isDeleted())
+ throw new DataVersioningException("Underlying node doesn't exist but a tombstone does; workspace node should be marked as created!");
if (underlyingNode.getVersion().newerThan(workspaceNode.getVersion()))
{
// we have an out of date node here
@@ -126,6 +129,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleCommitMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
GlobalTransaction gtx = getGlobalTransaction(ctx);
@@ -235,6 +239,7 @@
return nextInterceptor(ctx);
}
+ @Override
protected Object handleRollbackMethod(InvocationContext ctx, GlobalTransaction globalTransaction) throws Throwable
{
TransactionWorkspace workspace;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PassivationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,11 +1,11 @@
package org.jboss.cache.interceptors;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.loader.CacheLoader;
-import org.apache.commons.logging.Log;
import java.util.Collections;
import java.util.HashMap;
@@ -25,19 +25,20 @@
protected CacheLoader loader = null;
private AtomicLong m_passivations = new AtomicLong(0);
+ public PassivationInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
+
public void setCache(CacheSPI cache)
{
super.setCache(cache);
this.loader = cache.getCacheLoaderManager().getCacheLoader();
}
- protected Log getLog()
- {
- return null;
- }
-
/**
- * Notifies the cache instance listeners that the evicted node is about to
+ * Notifies the cache instance listeners that the evicted node is about to
* be passivated and stores the evicted node and its attributes back to the
* store using the CacheLoader.
*/
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -59,6 +59,11 @@
private Map<Thread, List<NodeLock>> lockTable;
private long lock_acquisition_timeout;
+ public PessimisticLockInterceptor()
+ {
+ log = LogFactory.getLog(getClass());
+ }
+
@Inject
public void injectDependencies(@ComponentName("LockTable")Map<Thread, List<NodeLock>> lockTable, Configuration configuration, CacheImpl cacheImpl, TransactionTable txTable)
{
@@ -68,11 +73,6 @@
this.tx_table = txTable;
}
- protected Log getLog()
- {
- return log;
- }
-
protected Object handlePutDataMethod(InvocationContext ctx, GlobalTransaction tx, Fqn fqn, Map data, boolean createUndoOps) throws Throwable
{
return handlePutMethod(ctx, fqn);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -1,6 +1,6 @@
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Configuration;
@@ -24,13 +24,11 @@
*/
public class ReplicationInterceptor extends BaseRpcInterceptor
{
-
- protected Log getLog()
+ public ReplicationInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
-
protected boolean skipMethodCall(InvocationContext ctx)
{
Option optionOverride = ctx.getOptionOverrides();
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03 02:27:56 UTC (rev 4953)
@@ -6,7 +6,7 @@
*/
package org.jboss.cache.interceptors;
-import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
@@ -56,12 +56,11 @@
private long m_rollbacks = 0;
- protected Log getLog()
+ public TxInterceptor()
{
- return log;
+ log = LogFactory.getLog(getClass());
}
-
@SuppressWarnings("unchecked")
protected Object handleOptimisticPrepareMethod(InvocationContext ctx, GlobalTransaction gtx, List modifications, Map data, Address address, boolean onePhaseCommit) throws Throwable
{
16 years, 9 months
JBoss Cache SVN: r4952 - in core/trunk/src: test/java/org/jboss/cache and 2 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 20:58:38 -0500 (Wed, 02 Jan 2008)
New Revision: 4952
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
Log:
Fixed tests
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CallInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -1,8 +1,10 @@
package org.jboss.cache.interceptors;
import org.jboss.cache.CacheImpl;
+import org.jboss.cache.CacheSPI;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.annotations.ComponentName;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodDeclarations;
@@ -24,11 +26,13 @@
public class CallInterceptor extends Interceptor
{
private CacheImpl cacheImpl;
+ private CacheSPI remoteDelegate;
@Inject
- private void injectDependencies(CacheImpl cacheImpl)
+ private void injectDependencies(CacheImpl cacheImpl, @ComponentName("remoteDelegate")CacheSPI remoteDelegate)
{
this.cacheImpl = cacheImpl;
+ this.remoteDelegate = remoteDelegate;
}
public Object invoke(InvocationContext ctx) throws Throwable
@@ -41,7 +45,7 @@
if (log.isTraceEnabled()) log.trace("Passing up method " + m + " so it gets invoked on cache.");
try
{
- retval = m.invoke(cacheImpl);
+ retval = m.invoke(m.getMethodId() == MethodDeclarations.dataGravitationCleanupMethod_id ? remoteDelegate : cacheImpl);
}
catch (Throwable t)
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/InvalidationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -131,7 +131,7 @@
return handleCrudMethod(ctx, fqn, null);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn primary, Fqn backup) throws Throwable
{
return handleCrudMethod(ctx, primary, null);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MethodDispacherInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -152,7 +152,7 @@
result = handlePutForExternalReadVersionedMethod(ctx, (GlobalTransaction) args[0], (Fqn) args[1], args[2], args[3], (DataVersion) args[5]);
break;
case MethodDeclarations.dataGravitationCleanupMethod_id:
- result = handleDataGravitationCleanupMethod(ctx, (GlobalTransaction) args[0], (Fqn) args[1], (Fqn) args[2]);
+ result = handleDataGravitationCleanupMethod(ctx, (Fqn) args[0], (Fqn) args[1]);
break;
case MethodDeclarations.removeNodeVersionedMethodLocal_id:
result = handleRemoveNodeVersionedMethod(ctx, (GlobalTransaction) args[0], (Fqn) args[1], (Boolean) args[2], (DataVersion) args[3]);
@@ -227,9 +227,9 @@
}
/**
- * Handles {@link org.jboss.cache.CacheImpl#_dataGravitationCleanup(org.jboss.cache.transaction.GlobalTransaction, org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
+ * Handles {@link org.jboss.cache.invocation.RemoteCacheInvocationDelegate#dataGravitationCleanup(org.jboss.cache.Fqn, org.jboss.cache.Fqn)}
*/
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn primary, Fqn backup) throws Throwable
{
return defaultHandlersBehavior();
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -176,7 +176,7 @@
*/
private Fqn getFqn(Object[] args, int methodId)
{
- return (Fqn) args[methodId == MethodDeclarations.moveMethodLocal_id ? 0 : 1];
+ return (Fqn) args[methodId == MethodDeclarations.moveMethodLocal_id || methodId == MethodDeclarations.dataGravitationCleanupMethod_id ? 0 : 1];
}
/**
@@ -187,7 +187,7 @@
*/
private Fqn getBackupFqn(Object[] args)
{
- return (Fqn) args[2];
+ return (Fqn) args[1];
}
/**
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/ReplicationInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -167,7 +167,7 @@
return handleCrudMethod(ctx);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn primary, Fqn backup) throws Throwable
{
return handleCrudMethod(ctx);
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -162,7 +162,7 @@
return handleNonTxMethod(ctx);
}
- protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, GlobalTransaction globalTransaction, Fqn primary, Fqn backup) throws Throwable
+ protected Object handleDataGravitationCleanupMethod(InvocationContext ctx, Fqn primary, Fqn backup) throws Throwable
{
return handleNonTxMethod(ctx);
}
@@ -1182,6 +1182,9 @@
modifications = entry.getModifications();
ctx = cache.getInvocationContext();
if (ctx.isOptionsUninitialised() && entry.getOption() != null) ctx.setOptionOverrides(entry.getOption());
+
+ assertCanContinue();
+
ctx.setOriginLocal(false);
}
Modified: core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/test/java/org/jboss/cache/LifeCycleTest.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -14,6 +14,7 @@
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -55,7 +56,7 @@
{
Cache cache = createCache(mode);
List<Cache> caches = new LinkedList<Cache>();
- if (c != null) for (Cache existingCache : c) caches.add(existingCache);
+ if (c != null) caches.addAll(Arrays.asList(c));
caches.add(cache);
c = caches.toArray(new CacheSPI[]{});
if (start)
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithOptimisticLockingTest.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -6,9 +6,12 @@
*/
package org.jboss.cache.buddyreplication;
+import org.testng.annotations.Test;
+
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
+@Test(groups = {"functional", "jgroups"})
public class BuddyReplicationWithOptimisticLockingTest extends BuddyReplicationFailoverTest
{
public BuddyReplicationWithOptimisticLockingTest()
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithTransactionsTest.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -6,15 +6,16 @@
*/
package org.jboss.cache.buddyreplication;
+import org.jboss.cache.Fqn;
import static org.testng.AssertJUnit.assertTrue;
+import org.testng.annotations.Test;
import javax.transaction.TransactionManager;
-import org.jboss.cache.Fqn;
-
/**
* @author <a href="mailto:manik@jboss.org">Manik Surtani (manik(a)jboss.org)</a>
*/
+@Test(groups = {"functional", "jgroups"})
public class BuddyReplicationWithTransactionsTest extends BuddyReplicationTestsBase
{
private Fqn fqn = Fqn.fromString("test");
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-03 00:57:22 UTC (rev 4951)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/EvictionConfigurationTest.java 2008-01-03 01:58:38 UTC (rev 4952)
@@ -195,7 +195,7 @@
{
cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache();
regionManager = cache.getRegionManager();
- assertEquals(0, regionManager.getAllRegions(Region.Type.ANY).size());
+ assertEquals(1, regionManager.getAllRegions(Region.Type.ANY).size());
}
private void setupCache(String configurationName)
16 years, 9 months
JBoss Cache SVN: r4951 - core/trunk/src/test/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 19:57:22 -0500 (Wed, 02 Jan 2008)
New Revision: 4951
Modified:
core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
Log:
Fixed test
Modified: core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-01-03 00:31:30 UTC (rev 4950)
+++ core/trunk/src/test/java/org/jboss/cache/interceptors/EvictionInterceptorTest.java 2008-01-03 00:57:22 UTC (rev 4951)
@@ -11,6 +11,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.Region;
import org.jboss.cache.RegionManager;
import org.jboss.cache.config.EvictionConfig;
@@ -83,9 +84,9 @@
}
@SuppressWarnings("unchecked")
- private Node<Object, Object> cast(Node node)
+ private NodeSPI<Object, Object> cast(Node node)
{
- return node;
+ return (NodeSPI<Object, Object>) node;
}
public void testVisitNode() throws Throwable
@@ -98,17 +99,15 @@
Region regionABC = regionManager.getRegion(fqn1, false);
assertNull(regionABC.takeLastEventNode());
- cache.put(fqn1, "key", "value");
- assertEquals("value", cache.get(fqn1, "key"));
- Node<Object, Object> node = cast(cache.getNode(fqn1));
+ putQuietly(fqn1, "key", "value");
+ NodeSPI<Object, Object> node = cast(cache.peek(Fqn.fromString(fqn1), false, false));
assertNotNull(node);
- assertEquals("value", node.get("key"));
+ assertEquals("value", node.getDirect("key"));
- cache.put(fqn3, "key", "value");
- assertEquals("value", cache.get(fqn3, "key"));
- node = cast(cache.getNode(fqn3));
+ putQuietly(fqn3, "key", "value");
+ node = cast(cache.peek(Fqn.fromString(fqn3), false, false));
assertNotNull(node);
- assertEquals("value", node.get("key"));
+ assertEquals("value", node.getDirect("key"));
mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
@@ -162,6 +161,39 @@
}
+ /**
+ * Helper to quietly add something into the cache without generating eviction events
+ *
+ * @param fqn fqn to add
+ * @param key key
+ * @param value value
+ */
+ private void putQuietly(String fqn, Object key, Object value)
+ {
+ putQuietly(Fqn.fromString(fqn), key, value);
+ }
+
+ /**
+ * Helper to quietly add something into the cache without generating eviction events
+ *
+ * @param fqn fqn to add
+ * @param key key
+ * @param value value
+ */
+ private void putQuietly(Fqn fqn, Object key, Object value)
+ {
+ NodeSPI root = cache.getRoot();
+ NodeSPI child = root;
+ for (int i = 0; i < fqn.size(); i++)
+ {
+ child = child.addChildDirect(new Fqn(fqn.get(i)));
+ }
+
+ assert child.getFqn().equals(fqn);
+
+ child.putDirect(key, value);
+ }
+
public void testVisitElement() throws Throwable
{
// make sure a get/visit on an empty node and empty element results in no cache events being added to event queue
@@ -173,8 +205,9 @@
Region region = regionManager.getRegion(fqn.toString(), false);
assertNull(region.takeLastEventNode());
- // add the node but try to get on a null element should result in no cache events being added to MarshRegion.
- cache.put(fqn, "wrongkey", "");
+ // add the node but try to get on a null element should result in no cache events being added to Region.
+ putQuietly(fqn, "wrongkey", "");
+
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
assertNull(region.takeLastEventNode());
@@ -189,7 +222,8 @@
assertNull(region.takeLastEventNode());
- cache.put(fqn4, key, "value");
+ putQuietly(fqn4, key, "value");
+
// test on element granularity configured node.
fqn = Fqn.fromString(fqn4);
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
@@ -204,26 +238,28 @@
assertNull(region.takeLastEventNode());
fqn = Fqn.fromString("/d/e/g");
- for (int i = 0; i < 1000; i++)
+ for (int i = 0; i < 100; i++)
{
key = i;
- cache.put("/d/e/g", key, "");
+ putQuietly("/d/e/g", key, "");
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
region = regionManager.getRegion(fqn.toString(), false);
- for (int i = 0; i < 1000; i++)
+
+ for (int i = 0; i < 100; i++)
{
event = region.takeLastEventNode();
assertEquals(fqn, event.getFqn());
assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
}
- cache.put("/a/b/c", key, "");
+ putQuietly("/a/b/c", key, "");
fqn = Fqn.fromString("/a/b/c");
+
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
@@ -234,17 +270,17 @@
assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
assertEquals(fqn, event.getFqn());
- for (int i = 0; i < 1000; i++)
+ for (int i = 0; i < 100; i++)
{
key = i;
- cache.put(fqn, key, "");
+ putQuietly(fqn, key, "");
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
}
- for (int i = 0; i < 1000; i++)
+ for (int i = 0; i < 100; i++)
{
event = region.takeLastEventNode();
assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
@@ -252,20 +288,6 @@
}
assertNull(region.takeLastEventNode());
-
- // What exactly are we trying to test here?!?
- // check null handling
-// mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
-// interceptor.invoke(InvocationContext.fromMethodCall(mc));
-// assertNull(region.takeLastEventNode());
-//
-// mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, null, true);
-// interceptor.invoke(InvocationContext.fromMethodCall(mc));
-// assertNull(region.takeLastEventNode());
-//
-// mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, null, true);
-// interceptor.invoke(InvocationContext.fromMethodCall(mc));
-// assertNull(region.takeLastEventNode());
}
public void testCreateNode() throws Throwable
@@ -289,13 +311,13 @@
assertEquals(fqn, event.getFqn());
assertEquals(100, event.getElementDifference());
- Node<Object, Object> node = cast(cache.getNode(fqn));
+ NodeSPI<Object, Object> node = cast(cache.peek(fqn, false, false));
assertNotNull(node);
for (int i = 0; i < 100; i++)
{
- assertTrue(node.getData().containsKey(i));
- assertEquals(i, node.get(i));
+ assertTrue(node.getDataDirect().containsKey(i));
+ assertEquals(i, node.getDirect(i));
}
for (int i = 0; i < 100; i++)
@@ -304,7 +326,7 @@
"value", false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertEquals("value", cache.get(fqn, i));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(i));
}
for (int i = 0; i < 100; i++)
@@ -326,15 +348,15 @@
assertEquals(fqn, event.getFqn());
assertEquals(100, event.getElementDifference());
assertNull(regionManager.getRegion(fqn.toString(), false).takeLastEventNode());
- node = cast(cache.getNode(fqn));
- assertEquals(100, node.getData().size());
+ node = cast(cache.peek(fqn, false, false));
+ assertEquals(100, node.getDataDirect().size());
assertNotNull(node);
for (int i = 0; i < 100; i++)
{
- assertTrue(node.getData().containsKey(i));
- assertEquals(i, node.get(i));
+ assertTrue(node.getDataDirect().containsKey(i));
+ assertEquals(i, node.getDirect(i));
}
mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, true);
@@ -353,8 +375,8 @@
for (int i = 0; i < 100; i++)
{
- assertTrue(node.getData().containsKey(i));
- assertEquals(i, node.get(i));
+ assertTrue(node.getDataDirect().containsKey(i));
+ assertEquals(i, node.getDirect(i));
}
}
@@ -369,23 +391,23 @@
MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
EvictedEventNode event = region.takeLastEventNode();
assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
assertEquals(1, event.getElementDifference());
assertEquals(fqn, event.getFqn());
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
event = region.takeLastEventNode();
assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
assertEquals(1, event.getElementDifference());
assertEquals(fqn, event.getFqn());
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
assertNull(region.takeLastEventNode());
}
@@ -393,13 +415,13 @@
public void testRemoveNode() throws Throwable
{
Fqn fqn = Fqn.fromString("/a/b/c");
- cache.put(fqn, "a", "b");
- cache.put(fqn, "b", "c");
+ putQuietly(fqn, "a", "b");
+ putQuietly(fqn, "b", "c");
MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, null, fqn, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertEquals(0, cache.getNode(fqn).getData().size());
+ assertEquals(0, cache.peek(fqn, false, false).getDataDirect().size());
Region region = regionManager.getRegion(fqn.toString(), false);
EvictedEventNode event = region.takeLastEventNode();
assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
@@ -409,7 +431,7 @@
mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertNull(cache.getNode(fqn));
+ assertNull(cache.peek(fqn, false, false));
event = region.takeLastEventNode();
assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
assertEquals(fqn, event.getFqn());
@@ -419,8 +441,8 @@
public void testRemoveElement() throws Throwable
{
Fqn fqn = Fqn.fromString("/a/b/c");
- cache.put(fqn, "a", "b");
- cache.put(fqn, "b", "c");
+ putQuietly(fqn, "a", "b");
+ putQuietly(fqn, "b", "c");
MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
null, fqn, "a", false);
@@ -496,12 +518,12 @@
mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
null, fqn, key, value, false);
interceptor.invoke(InvocationContext.fromMethodCall(mc));
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
event = region.takeLastEventNode();
assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
assertEquals(1, event.getElementDifference());
assertEquals(fqn, event.getFqn());
- assertEquals("value", cache.get(fqn, key));
+ assertEquals("value", cache.peek(fqn, false, false).getDirect(key));
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
16 years, 9 months
JBoss Cache SVN: r4950 - in core/branches/1.4.X: tests/functional/org/jboss/cache/buddyreplication and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 19:31:30 -0500 (Wed, 02 Jan 2008)
New Revision: 4950
Added:
core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java
Modified:
core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
Log:
Added test and fix for JBCACHE-1241 - do not remove internal fqns when removing root.
Modified: core/branches/1.4.X/src/org/jboss/cache/TreeCache.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/TreeCache.java 2008-01-03 00:17:12 UTC (rev 4949)
+++ core/branches/1.4.X/src/org/jboss/cache/TreeCache.java 2008-01-03 00:31:30 UTC (rev 4950)
@@ -3886,7 +3886,8 @@
{
for (Iterator i = children.iterator(); i.hasNext();)
{
- remove(new Fqn(fqn, i.next()), o);
+ Fqn childFqn = new Fqn(fqn, i.next());
+ if (!internalFqns.contains(childFqn)) remove(childFqn, o);
}
}
}
@@ -3917,7 +3918,8 @@
{
for (Iterator i = children.iterator(); i.hasNext();)
{
- evict(new Fqn(fqn, i.next()));
+ Fqn childFqn = new Fqn(fqn, i.next());
+ if (!internalFqns.contains(childFqn)) evict(childFqn);
}
}
}
Added: core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java
===================================================================
--- core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java (rev 0)
+++ core/branches/1.4.X/tests/functional/org/jboss/cache/buddyreplication/RemoveRootBuddyTest.java 2008-01-03 00:31:30 UTC (rev 4950)
@@ -0,0 +1,44 @@
+package org.jboss.cache.buddyreplication;
+
+import org.jboss.cache.Fqn;
+import org.jboss.cache.TreeCache;
+import org.jboss.cache.misc.TestingUtil;
+
+import java.util.ArrayList;
+
+/**
+ * Test added to replicate a found issue - JBCACHE-1241
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class RemoveRootBuddyTest extends BuddyReplicationTestsBase
+{
+ TreeCache cache1, cache2;
+
+ protected void setUp() throws Exception
+ {
+ cache1 = createCache(false, 1, "myBuddyPoolReplicationGroup", false, true, true);
+ cache2 = createCache(false, 1, "myBuddyPoolReplicationGroup", false, true, true);
+
+ TestingUtil.blockUntilViewsReceived(new TreeCache[]{cache1, cache2}, 60000);
+ }
+
+ protected void tearDown()
+ {
+ cache1.stop();
+ cache2.stop();
+ }
+
+ public void testRemoveRootNode() throws Exception
+ {
+ int opCount = 10;
+ for (int i = 0; i < opCount; i++)
+ {
+ String key = String.valueOf(opCount);
+ String value = String.valueOf(opCount);
+ Fqn f = Fqn.fromString("/test" + key);
+ cache1.put(f, key, value);
+ }
+ cache1.remove(Fqn.ROOT);
+ }
+}
16 years, 9 months
JBoss Cache SVN: r4949 - core/trunk/src/main/java/org/jboss/cache/invocation.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 19:17:12 -0500 (Wed, 02 Jan 2008)
New Revision: 4949
Modified:
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
Log:
JBCACHE-1241 - removing root should not attempt to clear internal Fqns.
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-01-02 23:09:38 UTC (rev 4948)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-01-03 00:17:12 UTC (rev 4949)
@@ -418,10 +418,14 @@
// we need to preserve options
InvocationContext ctx = getInvocationContext();
Option o = ctx.getOptionOverrides();
+ Set<Fqn> internalFqns = getInternalFqns();
for (Object childName : peek(fqn, false, false).getChildrenNames())
{
- ctx.setOptionOverrides(o);
- result = removeNode(new Fqn<Object>((Fqn<Object>) fqn, childName)) && result;
+ if (!internalFqns.contains(new Fqn(childName)))
+ {
+ ctx.setOptionOverrides(o);
+ result = removeNode(new Fqn<Object>((Fqn<Object>) fqn, childName)) && result;
+ }
}
return result;
16 years, 9 months
JBoss Cache SVN: r4948 - core/trunk/src/main/java/org/jboss/cache/interceptors.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-02 18:09:38 -0500 (Wed, 02 Jan 2008)
New Revision: 4948
Modified:
core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
Log:
Added null check
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-02 19:37:27 UTC (rev 4947)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/TxInterceptor.java 2008-01-02 23:09:38 UTC (rev 4948)
@@ -1195,7 +1195,9 @@
ctx = cache.getInvocationContext();
}
- if (ctx.isOptionsUninitialised() && entry.getOption() != null)
+ entry = txTable.get(gtx);
+
+ if (ctx.isOptionsUninitialised() && entry != null && entry.getOption() != null)
{
// use the options from the transaction entry instead
ctx.setOptionOverrides(entry.getOption());
@@ -1218,7 +1220,7 @@
if (log.isTraceEnabled()) log.trace("calling aftercompletion for " + gtx);
// set any transaction wide options as current for this thread.
- if ((entry = txTable.get(gtx)) != null)
+ if (entry != null)
{
modifications = entry.getModifications();
ctx.setOptionOverrides(entry.getOption());
16 years, 9 months