JBoss Cache SVN: r7166 - core/trunk/src/main/java/org/jboss/cache/config/parsing.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-11-19 10:44:21 -0500 (Wed, 19 Nov 2008)
New Revision: 7166
Modified:
core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
Log:
More helpful log
Modified: core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-11-19 15:27:29 UTC (rev 7165)
+++ core/trunk/src/main/java/org/jboss/cache/config/parsing/CacheConfigsXmlParser.java 2008-11-19 15:44:21 UTC (rev 7166)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.config.parsing;
import org.apache.commons.logging.Log;
@@ -85,10 +85,10 @@
throw new ConfigurationException("Unable to find config file " + fileName + " either in classpath or on the filesystem!");
}
- return parseConfigs(is);
+ return parseConfigs(is, fileName);
}
- public Map<String, Configuration> parseConfigs(InputStream stream) throws CloneNotSupportedException
+ public Map<String, Configuration> parseConfigs(InputStream stream, String fileName) throws CloneNotSupportedException
{
// loop through all elements in XML.
Element root = getDocumentRoot(stream);
@@ -126,7 +126,10 @@
}
else
{
- log.debug("Detected legacy configuration file format when parsing configuration file. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
+ if (fileName == null)
+ log.debug("Detected legacy configuration file format when parsing configuration XML from input stream ["+stream+"]. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
+ else
+ log.debug("Detected legacy configuration file format when parsing configuration file ["+fileName+"]. Migrating to the new (3.x) file format is recommended. See FAQs for details.");
XmlConfigurationParser2x oldParser = new XmlConfigurationParser2x();
c = oldParser.parseConfiguration(element);
}
16 years, 2 months
JBoss Cache SVN: r7165 - core/trunk/src/test/resources.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-19 10:27:29 -0500 (Wed, 19 Nov 2008)
New Revision: 7165
Modified:
core/trunk/src/test/resources/log4j.xml
Log:
reduce log verbosity
Modified: core/trunk/src/test/resources/log4j.xml
===================================================================
--- core/trunk/src/test/resources/log4j.xml 2008-11-19 12:42:49 UTC (rev 7164)
+++ core/trunk/src/test/resources/log4j.xml 2008-11-19 15:27:29 UTC (rev 7165)
@@ -66,8 +66,8 @@
<!-- ======================= -->
<root>
- <appender-ref ref="CONSOLE"/>
- <!--<appender-ref ref="FILE"/>-->
+ <!--<appender-ref ref="CONSOLE"/>-->
+ <appender-ref ref="FILE"/>
</root>
</log4j:configuration>
16 years, 2 months
JBoss Cache SVN: r7164 - core/trunk/src/main/release.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-11-19 07:42:49 -0500 (Wed, 19 Nov 2008)
New Revision: 7164
Modified:
core/trunk/src/main/release/README.txt
Log:
Modified: core/trunk/src/main/release/README.txt
===================================================================
--- core/trunk/src/main/release/README.txt 2008-11-19 11:57:48 UTC (rev 7163)
+++ core/trunk/src/main/release/README.txt 2008-11-19 12:42:49 UTC (rev 7164)
@@ -3,29 +3,26 @@
Note:
- We offer different packaging for download:
- + jbosscache-core-2.1.x-bin, just the core jar file and dependencies.
- + jbosscache-core-2.1.x-all, everything including docs, sources and tests.
- + jbosscache-core-2.1.x-doc, just the documentation.
+ + jbosscache-core-3.x.y-bin, just the core jar file and dependencies.
+ + jbosscache-core-3.x.y-all, everything including docs, demos and tutorials, no sources though.
+ + jbosscache-core-3.x.y-doc, just the documentation.
+ + jbosscache-core-3.x.y-src, a zipped up snapshot of the project root directory in subversion, which includes all sources, tests and build scripts.
- If you are looking for JBoss Cache POJO edition, this is a separate distribution:
- + jbosscache-pojo-2.1.x-bin, just the core jar file and dependencies. Note that this will include jbosscache-core.jar as a dependency.
- + jbosscache-pojo-2.1.x-all, everything including docs, sources and tests.
- + jbosscache-pojo-2.1.x-doc, just the documentation.
+ + jbosscache-pojo-3.x.y-bin, just the core jar file and dependencies. Note that this will include jbosscache-core.jar as a dependency.
+ + jbosscache-pojo-3.x.y-all, everything including docs, sources and tests.
+ + jbosscache-pojo-3.x.y-doc, just the documentation.
Requirements:
- JDK 5.0 and up
Running the tutorial:
- - The bin and all distros come with a build.xml file in the directory root, which contains targets for running
- tests as well as the demo outlined in the tutorial. You need an installation of Jakarta Ant 1.6.0 or higher
- to run the script.
+ - Please read the tutorial documentation (in the jbosscache-core-3.x.y-all distribution) for instructions.
-- Just run 'ant' in the root directry for instructions.
-
-
Problems:
- Please report problems to the JBoss cache forum
(http://www.jboss.org/forum.jsp?forum=157)
- or the JBoss dev mailing list
+ or the JBoss dev mailing list (https://lists.jboss.org/mailman/listinfo/jbosscache-dev)
+
16 years, 2 months
JBoss Cache SVN: r7163 - in core/trunk/src/test/java/org/jboss/cache: buddyreplication and 10 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-19 06:57:48 -0500 (Wed, 19 Nov 2008)
New Revision: 7163
Added:
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/InvalidationReplicationListener.java
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/MvccReplicationListener.java
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/OptimisticReplicationListener.java
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/PessReplicationListener.java
core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java
Removed:
core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
Modified:
core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java
core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
Log:
enhnaced tests
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PFERPessimisticTestBase.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -2,7 +2,6 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
-import org.jboss.cache.util.internals.ReplicationListener;
import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.lock.NodeLock;
@@ -38,42 +37,40 @@
*/
public void testNoOpWhenLockedAnd0msTimeout() throws Exception
{
- PutForExternalReadTestBaseTL threadCfg = threadLocal.get();
// create the parent node first ...
- threadCfg.replListener2 = new ReplicationListener(threadCfg.cache2);
- threadCfg.replListener2.smartExpect(PutKeyValueCommand.class, false);
- threadCfg.cache1.put(parentFqn, key, value);
- threadCfg.replListener2.waitForReplicationToOccur(10000);
+ replListener2.expect(PutKeyValueCommand.class);
+ cache1.put(parentFqn, key, value);
+ replListener2.waitForReplicationToOccur(10000);
- threadCfg.replListener2.smartExpect(PutKeyValueCommand.class, true);
- threadCfg.tm1.begin();
- threadCfg.cache1.put(parentFqn, key, value2);
+ replListener2.expectWithTx(PutKeyValueCommand.class);
+ tm1.begin();
+ cache1.put(parentFqn, key, value2);
- Transaction t = threadCfg.tm1.suspend();
+ Transaction t = tm1.suspend();
- assertLocked(parentFqn, threadCfg.cache1, true);
+ assertLocked(parentFqn, cache1, true);
// parentFqn should be write-locked.
long startTime = System.currentTimeMillis();
- threadCfg.cache1.putForExternalRead(fqn, key, value);
+ cache1.putForExternalRead(fqn, key, value);
long waited = System.currentTimeMillis() - startTime;
// crappy way to test that pFER does not block, but it is effective.
- assertTrue("Should not wait " + waited + " millis for lock timeout, should attempt to acquire lock with 0ms!", waited < threadCfg.cache1.getConfiguration().getLockAcquisitionTimeout());
+ assertTrue("Should not wait " + waited + " millis for lock timeout, should attempt to acquire lock with 0ms!", waited < cache1.getConfiguration().getLockAcquisitionTimeout());
// should not block.
- threadCfg.tm1.resume(t);
- threadCfg.tm1.commit();
+ tm1.resume(t);
+ tm1.commit();
- threadCfg.replListener2.waitForReplicationToOccur(1000);
+ replListener2.waitForReplicationToOccur(1000);
- assertEquals("Parent node write should have succeeded", value2, threadCfg.cache1.get(parentFqn, key));
+ assertEquals("Parent node write should have succeeded", value2, cache1.get(parentFqn, key));
if (isUsingInvalidation())
- assertNull("Parent node write should have invalidated", threadCfg.cache2.get(parentFqn, key));
+ assertNull("Parent node write should have invalidated", cache2.get(parentFqn, key));
else
- assertEquals("Parent node write should have replicated", value2, threadCfg.cache2.get(parentFqn, key));
+ assertEquals("Parent node write should have replicated", value2, cache2.get(parentFqn, key));
- assertNull("PFER should have been a no-op", threadCfg.cache1.get(fqn, key));
- assertNull("PFER should have been a no-op", threadCfg.cache2.get(fqn, key));
+ assertNull("PFER should have been a no-op", cache1.get(fqn, key));
+ assertNull("PFER should have been a no-op", cache2.get(fqn, key));
}
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/api/pfer/PutForExternalReadTestBase.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -2,12 +2,11 @@
import org.easymock.EasyMock;
import static org.easymock.EasyMock.*;
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.RPCManager;
+import org.jboss.cache.*;
import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.ComponentRegistry;
@@ -16,7 +15,7 @@
import org.jboss.cache.transaction.GlobalTransaction;
import org.jboss.cache.transaction.OptimisticTransactionContext;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.jgroups.Address;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
@@ -28,100 +27,92 @@
import javax.transaction.TransactionManager;
import java.util.List;
import java.util.Vector;
-import org.jboss.cache.UnitTestCacheFactory;
@Test(groups = {"functional", "jgroups", "transaction"})
public abstract class PutForExternalReadTestBase
{
- // TODO: Refactor this test so it isn't bound to using Thread.sleep() calls.
-
protected Configuration.CacheMode cacheMode;
protected NodeLockingScheme nodeLockingScheme;
protected final Fqn fqn = Fqn.fromString("/one/two");
protected final Fqn parentFqn = fqn.getParent();
protected final String key = "k", value = "v", value2 = "v2";
-
- protected class PutForExternalReadTestBaseTL {
- protected CacheSPI<String, String> cache1, cache2;
- ReplicationListener replListener1;
- ReplicationListener replListener2;
+ protected CacheSPI<String, String> cache1, cache2;
- protected TransactionManager tm1, tm2;
+ ReplicationListener replListener1;
+ ReplicationListener replListener2;
- protected boolean useTx;
- }
-
-
- ThreadLocal<PutForExternalReadTestBaseTL> threadLocal = new ThreadLocal<PutForExternalReadTestBaseTL>();
+ protected TransactionManager tm1, tm2;
+ protected boolean useTx;
+
+
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- PutForExternalReadTestBaseTL tl = new PutForExternalReadTestBaseTL();
- threadLocal.set(tl);
-
+
CacheFactory<String, String> cf = new UnitTestCacheFactory<String, String>();
- tl.cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
- tl.cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- tl.cache1.getConfiguration().setSerializationExecutorPoolSize(0);//this is very important for async tests!
- tl.cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ cache1 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache1.getConfiguration().setSerializationExecutorPoolSize(0);//this is very important for async tests!
+ cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- tl.cache1.start();
- tl.tm1 = tl.cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
+ cache1.start();
+ tm1 = cache1.getConfiguration().getRuntimeConfig().getTransactionManager();
- tl.cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
- tl.cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
- tl.cache2.getConfiguration().setSerializationExecutorPoolSize(0); //this is very important for async tests!
- tl.cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
+ cache2 = (CacheSPI<String, String>) cf.createCache(UnitTestCacheConfigurationFactory.createConfiguration(cacheMode), false);
+ cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
+ cache2.getConfiguration().setSerializationExecutorPoolSize(0); //this is very important for async tests!
+ cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
- tl.cache2.start();
- tl.tm2 = tl.cache2.getConfiguration().getRuntimeConfig().getTransactionManager();
+ cache2.start();
+ tm2 = cache2.getConfiguration().getRuntimeConfig().getTransactionManager();
+ replListener1 = ReplicationListener.getReplicationListener(cache1);
+ replListener2 = ReplicationListener.getReplicationListener(cache2);
- TestingUtil.blockUntilViewsReceived(10000, tl.cache1, tl.cache2);
+ TestingUtil.blockUntilViewsReceived(10000, cache1, cache2);
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
- if (tl != null) {
- TestingUtil.killCaches(tl.cache1, tl.cache2);
- threadLocal.set(null);
- }
+ TestingUtil.killCaches(cache1, cache2);
}
public void testNoOpWhenNodePresent()
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
- tl.cache1.putForExternalRead(fqn, key, value);
- asyncWait();
+ replListener2.expect(PutForExternalReadCommand.class);
+ cache1.putForExternalRead(fqn, key, value);
+ replListener2.waitForReplicationToOccur();
- assertEquals("PFER should have succeeded", value, tl.cache1.get(fqn, key));
+
+ assertEquals("PFER should have succeeded", value, cache1.get(fqn, key));
if (isUsingInvalidation())
- assertNull("PFER should not have effected cache2", tl.cache2.get(fqn, key));
+ assertNull("PFER should not have effected cache2", cache2.get(fqn, key));
else
- assertEquals("PFER should have replicated", value, tl.cache2.get(fqn, key));
+ assertEquals("PFER should have replicated", value, cache2.get(fqn, key));
// reset
- tl.cache1.removeNode(fqn);
- asyncWait();
+ replListener2.expect(RemoveNodeCommand.class);
+ cache1.removeNode(fqn);
+ replListener2.waitForReplicationToOccur();
- assertFalse("Should have reset", tl.cache1.getRoot().hasChild(fqn));
- assertFalse("Should have reset", tl.cache2.getRoot().hasChild(fqn));
+ assertFalse("Should have reset", cache1.getRoot().hasChild(fqn));
+ assertFalse("Should have reset", cache2.getRoot().hasChild(fqn));
- tl.cache1.put(fqn, key, value);
- asyncWait();
+ replListener2.expect(PutKeyValueCommand.class);
+ cache1.put(fqn, key, value);
+ replListener2.waitForReplicationToOccur();
// now this pfer should be a no-op
- tl.cache1.putForExternalRead(fqn, key, value2);
+ cache1.putForExternalRead(fqn, key, value2);
- assertEquals("PFER should have been a no-op", value, tl.cache1.get(fqn, key));
+ assertEquals("PFER should have been a no-op", value, cache1.get(fqn, key));
if (isUsingInvalidation())
- assertNull("PFER should have been a no-op", tl.cache2.get(fqn, key));
+ assertNull("PFER should have been a no-op", cache2.get(fqn, key));
else
- assertEquals("PFER should have been a no-op", value, tl.cache2.get(fqn, key));
+ assertEquals("PFER should have been a no-op", value, cache2.get(fqn, key));
}
private Vector<Address> anyAddresses()
@@ -132,72 +123,72 @@
public void testAsyncForce() throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
RPCManager rpcManager = EasyMock.createNiceMock(RPCManager.class);
- RPCManager originalRpcManager = tl.cache1.getConfiguration().getRuntimeConfig().getRPCManager();
+ RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
List<Address> memberList = originalRpcManager.getMembers();
expect(rpcManager.getMembers()).andReturn(memberList).anyTimes();
// inject a mock RPC manager so that we can test whether calls made are sync or async.
- ComponentRegistry cr = TestingUtil.extractComponentRegistry(tl.cache1);
+ ComponentRegistry cr = TestingUtil.extractComponentRegistry(cache1);
cr.registerComponent(rpcManager, RPCManager.class);
cr.rewire();
// invalidations will not trigger any rpc calls for PFER
if (!isUsingInvalidation())
{
- // specify what we expect called on the mock Rpc Manager. For params we don't care about, just use ANYTHING.
- // setting the mock object to expect the "sync" param to be false.
+ // specify what we expectWithTx called on the mock Rpc Manager. For params we don't care about, just use ANYTHING.
+ // setting the mock object to expectWithTx the "sync" param to be false.
expect(rpcManager.callRemoteMethods(anyAddresses(), (ReplicableCommand) anyObject(), eq(false), anyLong(), anyBoolean())).andReturn(null);
}
replay(rpcManager);
// now try a simple replication. Since the RPCManager is a mock object it will not actually replicate anything.
- tl.cache1.putForExternalRead(fqn, key, value);
+ cache1.putForExternalRead(fqn, key, value);
verify(rpcManager);
// cleanup
- TestingUtil.extractComponentRegistry(tl.cache1).registerComponent(originalRpcManager, RPCManager.class);
- tl.cache1.removeNode(fqn);
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
+ cache1.removeNode(fqn);
}
public void testTxSuspension() throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
// create parent node first
- tl.cache1.put(parentFqn, key, value);
+ replListener2.expect(PutKeyValueCommand.class);
+ cache1.put(parentFqn, key, value);
+ replListener2.waitForReplicationToOccur();
// start a tx and do some stuff.
- tl.tm1.begin();
- tl.cache1.get(parentFqn, key);
- tl.cache1.putForExternalRead(fqn, key, value); // should have happened in a separate tx and have committed already.
- Transaction t = tl.tm1.suspend();
+ replListener2.expect(PutForExternalReadCommand.class);
+ tm1.begin();
+ cache1.get(parentFqn, key);
+ cache1.putForExternalRead(fqn, key, value); // should have happened in a separate tx and have committed already.
+ Transaction t = tm1.suspend();
- asyncWait();
+ replListener2.waitForReplicationToOccur();
- assertLocked(parentFqn, tl.cache1, false);
+ assertLocked(parentFqn, cache1, false);
- assertEquals("PFER should have completed", value, tl.cache1.get(fqn, key));
+ assertEquals("PFER should have completed", value, cache1.get(fqn, key));
if (isUsingInvalidation())
- assertNull("PFER should not have effected cache2", tl.cache2.get(fqn, key));
+ assertNull("PFER should not have effected cache2", cache2.get(fqn, key));
else
- assertEquals("PFER should have completed", value, tl.cache2.get(fqn, key));
+ assertEquals("PFER should have completed", value, cache2.get(fqn, key));
- tl.tm1.resume(t);
- tl.tm1.commit();
+ tm1.resume(t);
+ tm1.commit();
- assertEquals("parent fqn tx should have completed", value, tl.cache1.get(parentFqn, key));
+ assertEquals("parent fqn tx should have completed", value, cache1.get(parentFqn, key));
if (isUsingInvalidation())
- assertNull("parent fqn tx should have invalidated cache2", tl.cache2.get(parentFqn, key));
+ assertNull("parent fqn tx should have invalidated cache2", cache2.get(parentFqn, key));
else
- assertEquals("parent fqn tx should have completed", value, tl.cache2.get(parentFqn, key));
+ assertEquals("parent fqn tx should have completed", value, cache2.get(parentFqn, key));
}
public void testExceptionSuppression() throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
RPCManager barfingRpcManager = EasyMock.createNiceMock(RPCManager.class);
- RPCManager originalRpcManager = tl.cache1.getConfiguration().getRuntimeConfig().getRPCManager();
+ RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
try
{
List<Address> memberList = originalRpcManager.getMembers();
@@ -206,13 +197,13 @@
expect(barfingRpcManager.callRemoteMethods(anyAddresses(), (ReplicableCommand) anyObject(), anyBoolean(), anyLong(), anyBoolean())).andThrow(new RuntimeException("Barf!")).anyTimes();
replay(barfingRpcManager);
- TestingUtil.extractComponentRegistry(tl.cache1).registerComponent(barfingRpcManager, RPCManager.class);
- tl.cache1.getConfiguration().getRuntimeConfig().setRPCManager(barfingRpcManager);
- TestingUtil.extractComponentRegistry(tl.cache1).rewire();
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(barfingRpcManager, RPCManager.class);
+ cache1.getConfiguration().getRuntimeConfig().setRPCManager(barfingRpcManager);
+ TestingUtil.extractComponentRegistry(cache1).rewire();
try
{
- tl.cache1.put(fqn, key, value);
+ cache1.put(fqn, key, value);
if (!isOptimistic()) fail("Should have barfed");
}
catch (RuntimeException re)
@@ -222,14 +213,13 @@
if (isOptimistic() && !isUsingInvalidation())
{
// proves that the put did, in fact, barf. Doesn't work for invalidations since the inability to invalidate will not cause a rollback.
- assertNull(tl.cache1.get(fqn, key));
- }
- else
+ assertNull(cache1.get(fqn, key));
+ } else
{
// clean up any indeterminate state left over
try
{
- tl.cache1.removeNode(fqn);
+ cache1.removeNode(fqn);
// as above, the inability to invalidate will not cause an exception
if (!isUsingInvalidation()) fail("Should have barfed");
}
@@ -238,36 +228,35 @@
}
}
- assertNull("Should have cleaned up", tl.cache1.get(fqn, key));
+ assertNull("Should have cleaned up", cache1.get(fqn, key));
// should not barf
- tl.cache1.putForExternalRead(fqn, key, value);
+ cache1.putForExternalRead(fqn, key, value);
}
finally
{
- TestingUtil.extractComponentRegistry(tl.cache1).registerComponent(originalRpcManager, RPCManager.class);
+ TestingUtil.extractComponentRegistry(cache1).registerComponent(originalRpcManager, RPCManager.class);
}
}
public void testBasicPropagation() throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
- assert !tl.cache1.exists(fqn);
- assert !tl.cache2.exists(fqn);
+ assert !cache1.exists(fqn);
+ assert !cache2.exists(fqn);
- tl.cache1.putForExternalRead(fqn, key, value);
+ replListener2.expect(PutForExternalReadCommand.class);
+ cache1.putForExternalRead(fqn, key, value);
+ replListener2.waitForReplicationToOccur();
- asyncWait();
-
- assertEquals("PFER updated cache1", value, tl.cache1.get(fqn, key));
+ assertEquals("PFER updated cache1", value, cache1.get(fqn, key));
Object expected = isUsingInvalidation() ? null : value;
- assertEquals("PFER propagated to cache2 as expected", expected, tl.cache2.get(fqn, key));
+ assertEquals("PFER propagated to cache2 as expected", expected, cache2.get(fqn, key));
// replication to cache 1 should NOT happen.
- tl.cache2.putForExternalRead(fqn, key, value);
+ cache2.putForExternalRead(fqn, key, value);
- assertEquals("PFER updated cache2", value, tl.cache2.get(fqn, key));
- assertEquals("Cache1 should be unaffected", value, tl.cache1.get(fqn, key));
+ assertEquals("PFER updated cache2", value, cache2.get(fqn, key));
+ assertEquals("Cache1 should be unaffected", value, cache1.get(fqn, key));
}
/**
@@ -297,56 +286,59 @@
*/
public void testMemLeakOnSuspendedTransactions() throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
Fqn fqn2 = Fqn.fromString("/fqn/two");
- tl.tm1.begin();
- tl.cache1.putForExternalRead(fqn, key, value);
- tl.tm1.commit();
+ replListener2.expect(PutForExternalReadCommand.class);
+ tm1.begin();
+ cache1.putForExternalRead(fqn, key, value);
+ tm1.commit();
+ replListener2.waitForReplicationToOccur(10000);
- TestingUtil.sleepThread(500);
- assert tl.cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
- assert tl.cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
- assert tl.cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
- assert tl.cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
- tl.tm1.begin();
- tl.cache1.putForExternalRead(fqn, key, value);
- tl.cache1.put(fqn2, key, value);
- tl.tm1.commit();
+ System.out.println("PutForExternalReadTestBase.testMemLeakOnSuspendedTransactions");
+ //do not expectWithTx a PFER replication, as the node already exists so this is a no-op
+ replListener2.expectWithTx(PutKeyValueCommand.class);
+ tm1.begin();
+ cache1.putForExternalRead(fqn, key, value);
+ cache1.put(fqn2, key, value);
+ tm1.commit();
+ replListener2.waitForReplicationToOccur();
- asyncWait();
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
- assert tl.cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
- assert tl.cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
- assert tl.cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
- assert tl.cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+ replListener2.expectWithTx(PutKeyValueCommand.class);
+ tm1.begin();
+ cache1.put(fqn2, key, value);
+ cache1.putForExternalRead(fqn, key, value);
+ tm1.commit();
+ replListener2.waitForReplicationToOccur(60000);
- tl.tm1.begin();
- tl.cache1.put(fqn2, key, value);
- tl.cache1.putForExternalRead(fqn, key, value);
- tl.tm1.commit();
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
- asyncWait();
+ //do not expectWithTx a PFER replication, as the node already exists so this is a no-op
+ replListener2.expectWithTx(PutKeyValueCommand.class, PutKeyValueCommand.class);
+ tm1.begin();
+ cache1.put(fqn2, key, value);
+ cache1.putForExternalRead(fqn, key, value);
+ cache1.put(fqn2, key, value);
+ tm1.commit();
+ replListener2.waitForReplicationToOccur(60000);
- assert tl.cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
- assert tl.cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
- assert tl.cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
- assert tl.cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
-
- tl.tm1.begin();
- tl.cache1.put(fqn2, key, value);
- tl.cache1.putForExternalRead(fqn, key, value);
- tl.cache1.put(fqn2, key, value);
- tl.tm1.commit();
-
- asyncWait();
-
- assert tl.cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
- assert tl.cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
- assert tl.cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
- assert tl.cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
+ assert cache1.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 1 should have no stale global TXs";
+ assert cache1.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 1 should have no stale local TXs";
+ assert cache2.getTransactionTable().getNumGlobalTransactions() == 0 : "Cache 2 should have no stale global TXs";
+ assert cache2.getTransactionTable().getNumLocalTransactions() == 0 : "Cache 2 should have no stale local TXs";
}
/**
@@ -357,30 +349,29 @@
*/
private void cacheModeLocalTest(boolean transactional) throws Exception
{
- PutForExternalReadTestBaseTL tl = threadLocal.get();
RPCManager rpcManager = EasyMock.createMock(RPCManager.class);
- RPCManager originalRpcManager = tl.cache1.getConfiguration().getRuntimeConfig().getRPCManager();
+ RPCManager originalRpcManager = cache1.getConfiguration().getRuntimeConfig().getRPCManager();
// inject a mock RPC manager so that we can test whether calls made are sync or async.
- tl.cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);
+ cache1.getConfiguration().getRuntimeConfig().setRPCManager(rpcManager);
- // specify that we expect nothing will be called on the mock Rpc Manager.
+ // specify that we expectWithTx nothing will be called on the mock Rpc Manager.
replay(rpcManager);
// now try a simple replication. Since the RPCManager is a mock object it will not actually replicate anything.
if (transactional)
- tl.tm1.begin();
+ tm1.begin();
- tl.cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
- tl.cache1.putForExternalRead(fqn, key, value);
+ cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
+ cache1.putForExternalRead(fqn, key, value);
if (transactional)
- tl.tm1.commit();
+ tm1.commit();
verify(rpcManager);
// cleanup
- tl.cache1.getConfiguration().getRuntimeConfig().setRPCManager(originalRpcManager);
- tl.cache1.removeNode(fqn);
+ cache1.getConfiguration().getRuntimeConfig().setRPCManager(originalRpcManager);
+ cache1.removeNode(fqn);
}
protected abstract void assertLocked(Fqn fqn, CacheSPI cache, boolean writeLocked);
@@ -416,10 +407,4 @@
{
return nodeLockingScheme == NodeLockingScheme.OPTIMISTIC;
}
-
- protected void asyncWait()
- {
- // always needs to do this since PFER will force async comms.
- TestingUtil.sleepThread(500);
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyGroupAssignmentTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -101,6 +101,8 @@
cachesTL.set(caches);
assertNoLocks(caches);
+ TestingUtil.sleepThread(getSleepTimeout());
+
System.out.println("*** Testing cache 0");
waitForBuddy(caches.get(0), caches.get(1), false);
waitForBuddy(caches.get(0), caches.get(2), false);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationFailoverTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -70,6 +70,7 @@
System.out.println("***** About to kill original data owner (" + caches.get(0).getLocalAddress() + "). *****");
// forcefully kill data owner.
killChannel(caches.get(0), caches.get(1), 2);
+ waitForSingleBuddy(caches.get(1), caches.get(2));
System.out.println("Killed. Testing backup roots.");
TestingUtil.dumpCacheContents(caches);
@@ -217,7 +218,7 @@
assertNoLocks(caches);
// gravitate to 2:
- caches.get(2).getNode(fqn); // expect entire subtree to gravitate.
+ caches.get(2).getNode(fqn); // expectWithTx entire subtree to gravitate.
delay(); // cleanup commands are async
Fqn newBackupFqn = fqnTransformer.getBackupFqn(caches.get(2).getLocalAddress(), fqn);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -324,6 +324,20 @@
waitForBuddy(dataOwner, buddy, onlyBuddy, 60000);
}
+ /**
+ * Will wait for 60 secs + 10sec * caches.length for the given caches to become buddys.
+ * The caches should be ordered as per underlying view.
+ */
+ public void waitForSingleBuddy(Cache... caches) throws Exception
+ {
+ long timeout = 60000 + caches.length;
+ for (int i = 0; i < caches.length - 1; i++)
+ {
+ waitForBuddy(caches[i], caches[i+1], true, timeout);
+ }
+ waitForBuddy(caches[caches.length - 1], caches[0], true, timeout);
+ }
+
public void waitForBuddy(Cache dataOwner, Cache buddy, boolean onlyBuddy, long timeout) throws Exception
{
long start = System.currentTimeMillis();
Modified: core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/cluster/ReplicationQueueTxTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -4,8 +4,7 @@
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationQueueNotifier;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -46,8 +45,8 @@
public void testTransactionalReplication() throws Exception
{
- ReplicationListener cache1Listener = new ReplicationListener(cache);
- ReplicationListener cache2Listener = new ReplicationListener(cache2);
+ ReplicationListener cache1Listener = ReplicationListener.getReplicationListener(cache);
+ ReplicationListener cache2Listener = ReplicationListener.getReplicationListener(cache2);
cache2Listener.expect(PutKeyValueCommand.class);
// outside of tx scope
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/ExpirationPolicyTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -72,19 +72,22 @@
public void testUpdateToFuture() throws Exception
{
+ future = System.currentTimeMillis() + 2500;
+ past = System.currentTimeMillis() - 1000;
try
{
+ EvictionController evictionController = new EvictionController(cache);
log.info("update 1 from future to past");
cache.put(fqn1, ExpirationAlgorithmConfig.EXPIRATION_KEY, future);
- TestingUtil.sleepThread(200);
- new EvictionController(cache).startEviction();
+ TestingUtil.sleepThread(1000);
+ evictionController.startEviction();
assertNotNull(cache.getNode(fqn1));
- cache.put(fqn1, ExpirationAlgorithmConfig.EXPIRATION_KEY, future + 250);
- TestingUtil.sleepThread(500);
- new EvictionController(cache).startEviction();
+ cache.put(fqn1, ExpirationAlgorithmConfig.EXPIRATION_KEY, future + 1200);
+ TestingUtil.sleepThread(2000);
+ evictionController.startEviction();
assertNotNull(cache.getNode(fqn1));
- TestingUtil.sleepThread(100);
- new EvictionController(cache).startEviction();
+ TestingUtil.sleepThread(1000);
+ evictionController.startEviction();
assertNull(cache.getNode(fqn1));
}
finally
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/InvalidationInterceptorTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -13,12 +13,13 @@
import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.optimistic.DefaultDataVersion;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -118,18 +119,18 @@
cache2.start();
Fqn fqn = Fqn.fromString("/a/b");
- ReplicationListener replListener1 = new ReplicationListener(cache1);
- ReplicationListener replListener2 = new ReplicationListener(cache2);
+ ReplicationListener replListener1 = ReplicationListener.getReplicationListener(cache1);
+ ReplicationListener replListener2 = ReplicationListener.getReplicationListener(cache2);
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, "key", "value");
- replListener2.waitForReplicationToOccur(500);
+ replListener2.waitForReplicationToOccur();
// TestingUtil.sleepThread(500);// give it time to broadcast the evict call
// test that this has NOT replicated, but rather has been invalidated:
assertEquals("value", cache1.get(fqn, "key"));
assertNull("Should NOT have replicated!", cache2.getNode(fqn));
- replListener1.expectAny();
+ replListener1.expect(PutKeyValueCommand.class);
// now make sure cache2 is in sync with cache1:
cache2.put(fqn, "key", "value");
// TestingUtil.sleepThread(500);// give it time to broadcast the evict call
@@ -140,7 +141,7 @@
assertHasBeenInvalidated(n, "Should have been invalidated");
assertEquals("value", cache2.get(fqn, "key"));
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
// now test the invalidation:
cache1.put(fqn, "key2", "value2");
assertEquals("value2", cache1.get(fqn, "key2"));
Modified: core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/loader/CacheLoaderWithReplicationTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -12,11 +12,12 @@
import org.jboss.cache.UnitTestCacheFactory;
import org.jboss.cache.commands.tx.CommitCommand;
import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;
import org.testng.annotations.AfterMethod;
@@ -202,7 +203,7 @@
public void testPessAsyncRepl() throws Exception
{
createCaches(false, false);
- ReplicationListener replListener = new ReplicationListener(cache2);
+ ReplicationListener replListener = ReplicationListener.getReplicationListener(cache2);
mgr1.begin();
cache1.put(fqn, key, "value");
@@ -212,9 +213,9 @@
assertNull(loader1.get(fqn));
assertNull(loader2.get(fqn));
- replListener.expect(PrepareCommand.class);
+ replListener.expectWithTx(PutKeyValueCommand.class);
mgr1.commit();
- replListener.waitForReplicationToOccur(500);
+ replListener.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
assertEquals("value", cache2.get(fqn, key));
@@ -278,10 +279,10 @@
{
createCaches(false, true);
- ReplicationListener replListener = new ReplicationListener(cache2);
+ ReplicationListener replListener = ReplicationListener.getReplicationListener(cache2);
mgr1.begin();
- replListener.expect(CommitCommand.class);
+ replListener.expectWithTx(PutKeyValueCommand.class);
cache1.put(fqn, key, "value");
assertEquals("value", cache1.get(fqn, key));
@@ -291,7 +292,7 @@
mgr1.commit();
- replListener.waitForReplicationToOccur(500);
+ replListener.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
assertEquals("value", cache2.get(fqn, key));
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/AsyncReplTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -12,29 +12,23 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.commands.legacy.write.PessPutKeyValueCommand;
+import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
+import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.marshall.data.Address;
import org.jboss.cache.marshall.data.Person;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
+import javax.transaction.*;
import java.lang.reflect.Method;
-import org.jboss.cache.UnitTestCacheFactory;
-import org.jboss.cache.config.Configuration;
/**
* Test marshalling for async mode.
@@ -66,8 +60,8 @@
cache2 = createCache("TestCache");
- replListener1 = new ReplicationListener(cache1);
- replListener2 = new ReplicationListener(cache2);
+ replListener1 = ReplicationListener.getReplicationListener(cache1);
+ replListener2 = ReplicationListener.getReplicationListener(cache2);
addr = new Address();
addr.setCity("San Jose");
ben = new Person();
@@ -121,11 +115,11 @@
}
if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
- replListener2.expect(PessPutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(aop, "person", ben);
replListener2.waitForReplicationToOccur(500);
- replListener2.expect(PessPutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(Fqn.fromString("/alias"), "person", ben);
replListener2.waitForReplicationToOccur(500);
@@ -150,7 +144,7 @@
// Set it back to the cache
// Can't cast it to Person. CCE will resutl.
if (useMarshalledValues) Thread.currentThread().setContextClassLoader(clb);
- replListener1.expect(PessPutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
cache2.put(aop, "person", ben2);
replListener1.waitForReplicationToOccur(1000);
if (useMarshalledValues) resetContextClassLoader();
@@ -180,11 +174,11 @@
if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
- replListener2.expect(PessPutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(Fqn.fromString("/aop/1"), "person", ben);
replListener2.waitForReplicationToOccur(1000);
- replListener2.expect(PessPutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(Fqn.fromString("/aop/2"), "person", scopedBen1);
replListener2.waitForReplicationToOccur(1000);
@@ -204,7 +198,7 @@
public void testTxPut() throws Exception
{
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
beginTransaction();
cache1.put(aop, "person", ben);
commit();
@@ -228,7 +222,7 @@
}
if (useMarshalledValues) Thread.currentThread().setContextClassLoader(cla);
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
beginTransaction();
cache1.put(aop, "person", ben);
commit();
@@ -254,7 +248,7 @@
// Set it back to the cache
// Can't cast it to Person. CCE will resutl.
if (useMarshalledValues) Thread.currentThread().setContextClassLoader(clb);
- replListener1.expectAny();
+ replListener1.expect(PutKeyValueCommand.class);
cache2.put(aop, "person", ben2);
if (useMarshalledValues) resetContextClassLoader();
replListener1.waitForReplicationToOccur(100);
@@ -282,7 +276,7 @@
Fqn base = Fqn.fromString("/aop");
Fqn fqn = Fqn.fromRelativeElements(base, custom1);
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, "key", "value");
replListener2.waitForReplicationToOccur(10000);
Modified: core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/InvalidRegionForStateTransferTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -4,11 +4,12 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -50,7 +51,7 @@
c1.start();
c2 = new UnitTestCacheFactory<Object, Object>().createCache(c1.getConfiguration().clone());
- replListener2 = new ReplicationListener(c2);
+ replListener2 = ReplicationListener.getReplicationListener(c2);
TestingUtil.blockUntilViewsReceived(60000, c1, c2);
}
@@ -69,7 +70,7 @@
c1.getRegion(fqn.getParent(), true).registerContextClassLoader(getClass().getClassLoader());
c2.getRegion(fqn.getParent(), true).registerContextClassLoader(getClass().getClassLoader());
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
// write something; will cause a stale region to be stored in C2's cache marshaller
c1.put(fqn, "k", "v");
assert c1.get(fqn, "k").equals("v");
Modified: core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -12,7 +12,7 @@
import org.jboss.cache.transaction.OptimisticTransactionContext;
import org.jboss.cache.transaction.TransactionTable;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.Test;
@@ -175,7 +175,7 @@
groupIncreaser++;
CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
- ReplicationListener replListener2 = new ReplicationListener(cache2);
+ ReplicationListener replListener2 = ReplicationListener.getReplicationListener(cache2);
LockManager lockManager = TestingUtil.extractLockManager(cache);
LockManager lockManager2 = TestingUtil.extractLockManager(cache2);
@@ -189,11 +189,11 @@
SamplePojo pojo = new SamplePojo(21, "test");
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache.put("/one/two", "key1", pojo);
mgr.commit();
- replListener2.waitForReplicationToOccur(1000);
+ replListener2.waitForReplicationToOccur();
// cache asserts
assertNull(mgr.getTransaction());
@@ -237,7 +237,7 @@
groupIncreaser++;
CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
- ReplicationListener replListener2 = new ReplicationListener(cache2);
+ ReplicationListener replListener2 = ReplicationListener.getReplicationListener(cache2);
LockManager lockManager = TestingUtil.extractLockManager(cache);
LockManager lockManager2 = TestingUtil.extractLockManager(cache2);
@@ -251,7 +251,7 @@
SamplePojo pojo = new SamplePojo(21, "test");
- replListener2.expect(PutKeyValueCommand.class, CommitCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache.put("/one/two", "key1", pojo);
mgr.commit();
@@ -291,9 +291,9 @@
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
replListener2.expect(RemoveNodeCommand.class);
- replListener2.expect(CommitCommand.class);
+ replListener2.expect();
cache.removeNode("/one/two");
- replListener2.waitForReplicationToOccur(1000);
+ replListener2.waitForReplicationToOccur();
assertEquals(false, cache.exists("/one/two"));
assertEquals(null, cache.get("/one/two", "key1"));
@@ -307,7 +307,7 @@
{
groupIncreaser++;
CacheSPI<Object, Object> cache = createAsyncReplicatedCache();
- ReplicationListener replListener = new ReplicationListener(cache);
+ ReplicationListener replListener = ReplicationListener.getReplicationListener(cache);
CacheSPI<Object, Object> cache2 = createAsyncReplicatedCache();
LockManager lockManager = TestingUtil.extractLockManager(cache);
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationOptLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -21,14 +21,4 @@
nodeLockingScheme = "OPTIMISTIC";
isInvalidation = true;
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- TestingUtil.sleepThread(500);
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncInvalidationPessLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -21,19 +21,4 @@
nodeLockingScheme = "PESSIMISTIC";
isInvalidation = true;
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- TestingUtil.sleepThread(500);
- }
-
- public void testPutKeyValueViaNodeAPI() throws Exception
- {
- super.testPutDataViaNodeAPI();
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplOptLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -22,75 +22,4 @@
cacheMode = Configuration.CacheMode.REPL_ASYNC;
nodeLockingScheme = "OPTIMISTIC";
}
-
- protected void verifyReplication()
- {
- TestingUtil.sleepThread(500);
- }
-
- public void testRemoveKey() throws Exception
- {
- super.testRemoveKey();
- }
-
- public void testPutKeyValue() throws Exception
- {
- super.testPutKeyValue();
- }
-
- public void testPutKeyValueViaNodeAPI() throws Exception
- {
- super.testPutKeyValueViaNodeAPI();
- }
-
- public void testPutData() throws Exception
- {
- super.testPutData();
- }
-
- public void testPutDataViaNodeAPI() throws Exception
- {
- super.testPutDataViaNodeAPI();
- }
-
- public void testRemoveNode() throws Exception
- {
- super.testRemoveNode();
- }
-
- public void testRemoveNodeViaNodeAPI() throws Exception
- {
- super.testRemoveNodeViaNodeAPI();
- }
-
- public void testRemoveKeyViaNodeAPI() throws Exception
- {
- super.testRemoveKeyViaNodeAPI();
- }
-
- public void testTransactionalBehaviourCommit() throws Exception
- {
- super.testTransactionalBehaviourCommit();
- }
-
- public void testTransactionalBehaviourRollback() throws Exception
- {
- super.testTransactionalBehaviourRollback();
- }
-
- public void testTransactionalBehaviourViaNodeAPI() throws Exception
- {
- super.testTransactionalBehaviourViaNodeAPI();
- }
-
- public void testAddChild() throws Exception
- {
- super.testAddChild();
- }
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/AsyncReplPessLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -7,7 +7,7 @@
package org.jboss.cache.options.cachemodelocal;
import org.jboss.cache.config.Configuration;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import org.jboss.cache.commands.ReplicableCommand;
import org.jboss.cache.commands.legacy.write.PessPutDataMapCommand;
import org.jboss.cache.commands.legacy.write.PessPutKeyValueCommand;
@@ -27,7 +27,6 @@
@Test(groups = {"functional", "jgroups"}, testName = "options.cachemodelocal.AsyncReplPessLocksTest")
public class AsyncReplPessLocksTest extends CacheModeLocalTestBase
{
-
ReplicationListener current;
Map<Cache, ReplicationListener> cache2Listener = new HashMap<Cache, ReplicationListener>(2);
@@ -37,29 +36,4 @@
cacheMode = Configuration.CacheMode.REPL_ASYNC;
nodeLockingScheme = "PESSIMISTIC";
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache, Class<? extends ReplicableCommand> what)
- {
- if (what == PutDataMapCommand.class) what = PessPutDataMapCommand.class;
- if (what == PutKeyValueCommand.class) what = PessPutKeyValueCommand.class;
- if (what == RemoveKeyCommand.class) what = PessRemoveKeyCommand.class;
- if (what == RemoveNodeCommand.class) what = PessRemoveNodeCommand.class;
- getCacheListener(cache).expect(what);
- }
-
- protected void verifyReplication()
- {
- current.waitForReplicationToOccur(2000);
- }
-
- public ReplicationListener getCacheListener(Cache cache)
- {
- current = cache2Listener.get(cache);
- if (current == null)
- {
- current = new ReplicationListener(cache);
- cache2Listener.put(cache, current);
- }
- return current;
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/CacheModeLocalTestBase.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -19,6 +19,7 @@
import org.jboss.cache.commands.write.RemoveNodeCommand;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -45,12 +46,15 @@
* set this to true if the implementing class plans to use an invalidating cache mode *
*/
protected boolean isInvalidation;
+ CacheSPI<String, String> cache1;
+ CacheSPI<String, String> cache2;
- private ThreadLocal<CacheSPI<String, String>> cache1TL = new ThreadLocal<CacheSPI<String, String>>();
- private ThreadLocal<CacheSPI<String, String>> cache2TL = new ThreadLocal<CacheSPI<String, String>>();
- private ThreadLocal<NodeSPI<String, String>> root1TL = new ThreadLocal<NodeSPI<String, String>>();
- private ThreadLocal<NodeSPI<String, String>> root2TL = new ThreadLocal<NodeSPI<String, String>>();
+ NodeSPI<String, String> root1;
+ NodeSPI<String, String> root2;
+ ReplicationListener replListener1;
+ ReplicationListener replListener2;
+
private final Fqn fqn = Fqn.fromString("/a");
private final String key = "key";
@@ -58,13 +62,6 @@
public void setUp() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
- // force a tear down if the test runner didn't run one before (happens in IDEA)
- if (cache1 != null || cache2 != null)
- tearDown();
-
CacheFactory<String, String> instance = new UnitTestCacheFactory<String, String>();
Configuration c = new Configuration();
@@ -89,29 +86,22 @@
cache2 = (CacheSPI<String, String>) instance.createCache(c, false);
cache2.start();
- cache1TL.set(cache1);
- cache2TL.set(cache2);
- root1TL.set(cache1.getRoot());
- root2TL.set(cache2.getRoot());
+ root1 = cache1.getRoot();
+ root2 = cache2.getRoot();
+
+ replListener1 = ReplicationListener.getReplicationListener(cache1);
+ replListener2 = ReplicationListener.getReplicationListener(cache2);
}
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
TestingUtil.killCaches(cache1, cache2);
- cache1TL.set(null);
- cache2TL.set(null);
}
public void testPutKeyValue() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put(fqn, key, "value");
Thread.sleep(500);
@@ -123,10 +113,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -147,10 +137,10 @@
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -164,11 +154,6 @@
public void testPutKeyValueViaNodeAPI() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
-
Node node1 = root1.addChild(fqn);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value");
@@ -180,10 +165,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
node1.put(key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -207,10 +192,10 @@
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value2");
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -224,9 +209,6 @@
public void testPutData() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
Map<String, String> map = new HashMap<String, String>();
map.put(key, "value");
@@ -239,10 +221,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
- registerReplicationCommand(cache2, PutDataMapCommand.class);
+ replListener2.expect(PutDataMapCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
cache1.put(fqn, map);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
@@ -264,10 +246,10 @@
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value2");
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -281,11 +263,6 @@
public void testPutDataViaNodeAPI() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
-
Map<String, String> map = new HashMap<String, String>();
map.put(key, "value");
@@ -299,10 +276,10 @@
assertNull("Should be null", cache2.get(fqn, key));
// now try again with passing the default options
- registerReplicationCommand(cache2, PutDataMapCommand.class);
+ replListener2.expect(PutDataMapCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
node1.putAll(map);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
// cache 2 should as well
@@ -326,10 +303,10 @@
assertEquals("value2", cache2.get(fqn, key));
assertEquals("value", cache1.get(fqn, key));
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value2");
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -343,15 +320,12 @@
public void testRemoveNode() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
// put some stuff in the cache first
// make sure we cleanup thread local vars.
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -379,9 +353,9 @@
}
// replace cache entries
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -393,10 +367,10 @@
}
// now try again with passing the default options
- registerReplicationCommand(cache2, RemoveNodeCommand.class);
+ replListener2.expect(RemoveNodeCommand.class);
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
cache1.removeNode(fqn);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -405,18 +379,14 @@
public void testRemoveNodeViaNodeAPI() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
// put some stuff in the cache first
// make sure we cleanup thread local vars.
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
assertEquals("value", cache1.get(fqn, key));
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
if (isInvalidation)
{
assertNull("Should be null", cache2.get(fqn, key));
@@ -443,9 +413,9 @@
}
// replace cache entries
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -456,11 +426,11 @@
assertEquals("value", cache2.get(fqn, key));
}
- registerReplicationCommand(cache2, RemoveNodeCommand.class);
+ replListener2.expect(RemoveNodeCommand.class);
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
root1.removeChild(fqn);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -469,14 +439,11 @@
public void testRemoveKey() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect((Class<? extends ReplicableCommand>) PutKeyValueCommand.class);
// put some stuff in the cache first
cache1.getInvocationContext().setOptionOverrides(null);
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -503,10 +470,10 @@
assertEquals("value", cache2.get(fqn, key));
}
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
// replace cache entries
cache1.put(fqn, key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -517,11 +484,11 @@
assertEquals("value", cache2.get(fqn, key));
}
- registerReplicationCommand(cache2, RemoveKeyCommand.class);
+ replListener2.expect(RemoveKeyCommand.class);
// now try again with passing the default options
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.remove(fqn, key);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -530,17 +497,12 @@
public void testRemoveKeyViaNodeAPI() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
-
// put some stuff in the cache first
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
Node node1 = root1.addChild(fqn);
cache1.getInvocationContext().setOptionOverrides(null);
node1.put(key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -568,9 +530,9 @@
}
// replace cache entries
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expect(PutKeyValueCommand.class);
node1.put(key, "value");
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
assertEquals("value", cache1.get(fqn, key));
if (isInvalidation)
{
@@ -582,10 +544,10 @@
}
// now try again with passing the default options
- registerReplicationCommand(cache2, RemoveKeyCommand.class);
+ replListener2.expect(RemoveKeyCommand.class);
cache1.getInvocationContext().getOptionOverrides().reset();
node1.remove(key);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// both should be null
assertNull("should be null", cache1.get(fqn, key));
@@ -594,18 +556,15 @@
public void testTransactionalBehaviourCommit() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
TransactionManager mgr = cache1.getTransactionManager();
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expectWithTx(PutKeyValueCommand.class);
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value1");
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache1.put(fqn, key, "value2");
mgr.commit();
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value2", cache1.get(fqn, key));
@@ -618,7 +577,7 @@
assertNull(cache2.get(fqn, key));
}
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expectWithTx(PutKeyValueCommand.class);
// now try again with passing the default options
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
@@ -626,7 +585,7 @@
cache1.getInvocationContext().getOptionOverrides().reset();
cache1.put(fqn, key, "value");
mgr.commit();
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -641,7 +600,7 @@
}
// now cache2
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expect(PutKeyValueCommand.class);
mgr = cache2.getTransactionManager();
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
@@ -649,7 +608,7 @@
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
mgr.commit();
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
@@ -662,14 +621,14 @@
assertNull(cache1.get(fqn, key));
}
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expectWithTx(PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
cache2.put(fqn, key, "value2");
cache2.getInvocationContext().getOptionOverrides().reset();
cache2.put(fqn, key, "value4");
mgr.commit();
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value4", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -684,15 +643,12 @@
public void testTransactionalBehaviourRollback() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
-
TransactionManager mgr = cache1.getTransactionManager();
- // create these first ...
+ replListener2.expect(PutKeyValueCommand.class, PutKeyValueCommand.class);
cache1.put("/a", key, "old");
cache1.put("/b", key, "old");
- Thread.sleep(500);
+ replListener2.waitForReplicationToOccur();
mgr.begin();
@@ -720,13 +676,8 @@
public void testTransactionalBehaviourViaNodeAPI() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
-
Node node1 = root1.addChild(fqn);
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expectWithTx(PutKeyValueCommand.class);
TransactionManager mgr = cache1.getTransactionManager();
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().reset();
@@ -734,7 +685,8 @@
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value2");
mgr.commit();
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
+
// cache1 should still have this
assertEquals("value2", cache1.get(fqn, key));
@@ -748,14 +700,14 @@
}
// now try again with passing the default options
- registerReplicationCommand(cache2, PutKeyValueCommand.class);
+ replListener2.expectWithTx(PutKeyValueCommand.class);
mgr.begin();
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node1.put(key, "value3");
cache1.getInvocationContext().getOptionOverrides().reset();
node1.put(key, "value");
mgr.commit();
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertEquals("value", cache1.get(fqn, key));
@@ -772,14 +724,14 @@
// now cache2
Node node2 = root2.addChild(fqn);
mgr = cache2.getTransactionManager();
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expectWithTx(PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
node2.put(key, "value3");
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.put(key, "value2");
mgr.commit();
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value2", cache2.get(fqn, key));
@@ -792,14 +744,14 @@
assertNull(cache1.get(fqn, key));
}
- registerReplicationCommand(cache1, PutKeyValueCommand.class);
+ replListener1.expectWithTx(PutKeyValueCommand.class);
mgr.begin();
cache2.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
node2.put(key, "value2");
cache2.getInvocationContext().getOptionOverrides().reset();
node2.put(key, "value4");
mgr.commit();
- verifyReplication();
+ replListener1.waitForReplicationToOccur();
assertEquals("value4", cache2.get(fqn, key));
if (!isInvalidation)
{
@@ -814,14 +766,9 @@
public void testAddChild() throws Exception
{
- CacheSPI<String, String> cache1 = cache1TL.get();
- CacheSPI<String, String> cache2 = cache2TL.get();
- NodeSPI<String, String> root1 = root1TL.get();
- NodeSPI<String, String> root2 = root2TL.get();
-
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
root1.addChild(fqn);
- Thread.sleep(1000);
+
// cache1 should still have this
assertTrue(root1.hasChild(fqn));
// cache 2 should not
@@ -829,12 +776,15 @@
assertTrue("Should be null", node2 == null || (isInvalidation && !node2.isValid()));
// now try again with passing the default options
+ replListener2.expect(RemoveNodeCommand.class);
root1.removeChild(fqn);
+ replListener2.waitForReplicationToOccur();
+
cache1.getInvocationContext().getOptionOverrides().setCacheModeLocal(false);
- registerReplicationCommand(cache2, PutDataMapCommand.class);
+ replListener2.expect(PutDataMapCommand.class);
root1.addChild(fqn);
- verifyReplication();
+ replListener2.waitForReplicationToOccur();
// cache1 should still have this
assertTrue(root1.hasChild(fqn));
@@ -848,19 +798,4 @@
assertTrue("Should be null", node2 == null || !node2.isValid());
}
}
-
- /**
- * Register a command that should be received by the specified cache as the result of a replication taking place.
- * @param cache the cache on which the given command should be replicated.
- * @param what the command that should be replicated
- * @see org.jboss.cache.options.cachemodelocal.AsyncReplPessLocksTest#registerReplicationCommand(org.jboss.cache.CacheSPI, Class)
- */
- protected abstract void registerReplicationCommand(CacheSPI<String, String> cache, Class<? extends ReplicableCommand> what);
-
-
- /**
- * Wait a while until the give command gets replicated.
- * @see AsyncReplPessLocksTest#verifyReplication()
- */
- protected abstract void verifyReplication();
}
\ No newline at end of file
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationOptLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -20,13 +20,4 @@
nodeLockingScheme = "OPTIMISTIC";
isInvalidation = true;
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncInvalidationPessLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -20,13 +20,4 @@
nodeLockingScheme = "PESSIMISTIC";
isInvalidation = true;
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplOptLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -20,15 +20,4 @@
cacheMode = Configuration.CacheMode.REPL_SYNC;
nodeLockingScheme = "OPTIMISTIC";
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- TestingUtil.sleepThread(250);
- }
-
}
Modified: core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/options/cachemodelocal/SyncReplPessLocksTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -19,13 +19,4 @@
cacheMode = Configuration.CacheMode.REPL_SYNC;
nodeLockingScheme = "PESSIMISTIC";
}
-
- protected void registerReplicationCommand(CacheSPI<String, String> cache2, Class<? extends ReplicableCommand> what)
- {
- //do nothing
- }
-
- protected void verifyReplication()
- {
- }
}
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/AsyncReplTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -14,7 +14,7 @@
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.internals.ReplicationListener;
+import org.jboss.cache.util.internals.replicationlisteners.ReplicationListener;
import static org.testng.AssertJUnit.*;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
@@ -22,6 +22,7 @@
import javax.transaction.TransactionManager;
import org.jboss.cache.UnitTestCacheFactory;
+import org.jboss.cache.commands.write.PutKeyValueCommand;
import org.jboss.cache.config.Configuration;
/**
@@ -47,11 +48,11 @@
threadLocal.set(tl);
log("creating cache1");
tl.cache1 = createCache("CacheGroup");
- tl.replListener1 = new ReplicationListener(tl.cache1);
+ tl.replListener1 = ReplicationListener.getReplicationListener(tl.cache1);
log("creating cache2");
tl.cache2 = createCache("CacheGroup");
- tl.replListener2 = new ReplicationListener(tl.cache2);
+ tl.replListener2 = ReplicationListener.getReplicationListener(tl.cache2);
}
@@ -116,25 +117,24 @@
Fqn fqn = Fqn.fromString("/a");
String key = "key";
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, key, "value1");
// allow for replication
- replListener2.waitForReplicationToOccur(500);
+ replListener2.waitForReplicationToOccur();
assertEquals("value1", cache1.get(fqn, key));
assertEquals("value1", cache2.get(fqn, key));
TransactionManager mgr = cache1.getTransactionManager();
mgr.begin();
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put(fqn, key, "value2");
assertEquals("value2", cache1.get(fqn, key));
assertEquals("value1", cache2.get(fqn, key));
mgr.commit();
+ replListener2.waitForReplicationToOccur();
- replListener2.waitForReplicationToOccur(500);
-
assertEquals("value2", cache1.get(fqn, key));
assertEquals("value2", cache2.get(fqn, key));
@@ -162,7 +162,7 @@
{
cache3 = createCache("DifferentGroup");
cache4 = createCache("DifferentGroup");
- replListener2.expectAny();
+ replListener2.expect(PutKeyValueCommand.class);
cache1.put("/a/b/c", "age", 38);
// because we use async repl, modfication may not yet have been propagated to cache2, so
// we have to wait a little
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/PessimisticSyncReplTxTest.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -61,7 +61,7 @@
public void setUp() throws Exception
{
t1_ex = t2_ex = null;
- lock = new Semaphore(1);
+ lock = new Semaphore(1, true);
}
@AfterMethod(alwaysRun = true)
@@ -938,6 +938,11 @@
{
initCaches(Configuration.CacheMode.REPL_SYNC);
final CacheSPI<Object, Object> c1 = this.cache1;
+
+ final Semaphore threadOneFirstPart = new Semaphore(0);
+ final Semaphore threadTwoFirstPart = new Semaphore(0);
+ final Semaphore threadOneSecondPart = new Semaphore(0);
+
Thread t1 = new Thread()
{
public void run()
@@ -946,14 +951,12 @@
try
{
- lock.acquire();
tm = beginTransaction();
c1.put("/a/b/c", "age", 38);
c1.put("/a/b/c", "age", 39);
- lock.release();
+ threadOneFirstPart.release();
- TestingUtil.sleepThread(300);
- lock.acquire();
+ threadTwoFirstPart.acquire();
try
{
tm.commit();
@@ -961,10 +964,9 @@
catch (RollbackException ex)
{
System.out.println("[Thread1] received RollbackException, as expected. Rolling back changes");
- }
- finally
+ } finally
{
- lock.release();
+ threadOneSecondPart.release();
}
}
catch (Throwable ex)
@@ -972,10 +974,6 @@
ex.printStackTrace();
t1_ex = ex;
}
- finally
- {
- lock.release();
- }
}
};
@@ -987,21 +985,17 @@
try
{
- sleep(200);
- Thread.yield();
- lock.acquire();
+ threadOneFirstPart.acquire();
tm = beginTransaction();
assertNull(cache2.get("/a/b/c", "age"));// must be null as not yet committed
cache2.put("/a/b/c", "age", 40);
- lock.release();
- TestingUtil.sleepThread(300);
- lock.acquire();
+ threadTwoFirstPart.release();
+
+ threadOneSecondPart.acquire();
assertEquals(40, cache2.get("/a/b/c", "age"));// must not be null
tm.commit();
- lock.release();
- TestingUtil.sleepThread(1000);
tm = beginTransaction();
assertEquals("After cache2 commit", 40, cache2.get("/a/b/c", "age"));
tm.commit();
Deleted: core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java 2008-11-19 11:46:13 UTC (rev 7162)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -1,336 +0,0 @@
-package org.jboss.cache.util.internals;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.InvocationContext;
-import org.jboss.cache.RPCManager;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.WriteCommand;
-import org.jboss.cache.commands.legacy.write.*;
-import org.jboss.cache.commands.write.*;
-import org.jboss.cache.commands.remote.ReplicateCommand;
-import org.jboss.cache.commands.tx.PrepareCommand;
-import org.jboss.cache.commands.tx.CommitCommand;
-import org.jboss.cache.factories.ComponentRegistry;
-import org.jboss.cache.io.ByteBuffer;
-import org.jboss.cache.marshall.AbstractMarshaller;
-import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
-import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
-import org.jboss.cache.marshall.Marshaller;
-import org.jboss.cache.marshall.RegionalizedMethodCall;
-import org.jboss.cache.util.TestingUtil;
-import org.jgroups.blocks.RpcDispatcher;
-import org.jgroups.util.Buffer;
-
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Utility class that notifies when certain commands were asynchronously replicated on secondary cache.
- * Especially useful for avaoiding Thread.sleep() statements.
- * <p/>
- * Usage:
- * <pre>
- * Cache c1, c2; //these being two async caches
- * AsyncReplicationListener listener2 = new AsyncReplicationListener(c2);
- * listener2.expect(PutKeyValueCommand.class);
- * c1.put(fqn, key, value);
- * listener2.waitForReplicationToOccur(1000); // -this will block here untill c2 recieves the PutKeyValueCommand command
- * </pre>
- * Lifecycle - after being used (i.e. waitForReplicationToOccur returns sucessfully) the object returns to the
- * non-initialized state and *can* be reused through expect-wait cycle.
- * <b>Note</b>: this class might be used aswell for sync caches, e.g. a test could have subclasses which use sync and
- * async replication
- *
- * @author Mircea.Markus(a)jboss.com
- * @since 2.2
- */
-public class ReplicationListener
-{
- private CountDownLatch latch = new CountDownLatch(1);
- private Set<Class<? extends ReplicableCommand>> expectedCommands;
- private Configuration config;
- private static Map <Class<? extends WriteCommand>, Class<? extends WriteCommand>> mvcc2PessMap =
- new HashMap<Class<? extends WriteCommand>, Class<? extends WriteCommand>>();
- static
- {
- mvcc2PessMap.put(ClearDataCommand.class, PessClearDataCommand.class);
- mvcc2PessMap.put(MoveCommand.class, PessMoveCommand.class);
- mvcc2PessMap.put(PutDataMapCommand.class, PessPutDataMapCommand.class);
- mvcc2PessMap.put(PutForExternalReadCommand.class, PessPutForExternalReadCommand.class);
- mvcc2PessMap.put(PutKeyValueCommand.class, PessPutKeyValueCommand.class);
- mvcc2PessMap.put(RemoveKeyCommand.class, PessRemoveKeyCommand.class);
- mvcc2PessMap.put(RemoveNodeCommand.class, PessRemoveNodeCommand.class);
- }
-
- /**
- * Builds a listener that will observe the given cache for recieving replication commands.
- */
- public ReplicationListener(Cache cache)
- {
- ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
- RPCManager rpcManager = componentRegistry.getComponent(RPCManager.class);
- CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
- RpcDispatcher.Marshaller2 realMarshaller = (RpcDispatcher.Marshaller2) realDispatcher.getMarshaller();
- RpcDispatcher.Marshaller2 delegate = null;
- if ((realMarshaller instanceof RegionMarshallerDelegate) || (realMarshaller instanceof MarshallerDelegate))
- {
- throw new RuntimeException("Illegal state");
- }
- if (realDispatcher instanceof InactiveRegionAwareRpcDispatcher)
- delegate = new RegionMarshallerDelegate((Marshaller) realMarshaller);
- else
- delegate = new MarshallerDelegate(realMarshaller);
- realDispatcher.setMarshaller(delegate);
- realDispatcher.setRequestMarshaller(delegate);
- realDispatcher.setResponseMarshaller(delegate);
- this.config = cache.getConfiguration();
- }
-
- /**
- * Based on cache's configuration, will know for what specific commands to expect to be replicated.
- * E.g. async replication with a tx, would expect only a PrepareCommand (async is 1PC). sync repl with tx would expect
- * a prepare and a commit (sync is 2pc).
- * @param inTx do you expect replication to occur as result of a tx.commit?
- */
- public void smartExpect(Class<? extends WriteCommand> writeCommand, boolean inTx)
- {
- if (config.getCacheMode().equals(Configuration.CacheMode.INVALIDATION_ASYNC) || config.getCacheMode().equals(Configuration.CacheMode.INVALIDATION_SYNC))
- {
- expect(InvalidateCommand.class);
- return;
- }
- if (inTx)
- {
- expect(PrepareCommand.class);
- if (config.getCacheMode().isSynchronous())
- {
- expect(CommitCommand.class);
- }
- return;
- }
- if (config.getNodeLockingScheme().equals(Configuration.NodeLockingScheme.PESSIMISTIC))
- {
- expect(getPessCommand(writeCommand));
- }
- }
-
- private Class<? extends ReplicableCommand> getPessCommand(Class<? extends WriteCommand> writeCommand)
- {
- Class<? extends ReplicableCommand> result = mvcc2PessMap.get(writeCommand);
- if (result == null) throw new IllegalStateException("Unknown command: " + writeCommand);
- return result;
- }
-
- private class MarshallerDelegate implements RpcDispatcher.Marshaller2
- {
- RpcDispatcher.Marshaller2 marshaller;
-
- private MarshallerDelegate(RpcDispatcher.Marshaller2 marshaller)
- {
- this.marshaller = marshaller;
- }
-
- public byte[] objectToByteBuffer(Object obj) throws Exception
- {
- return marshaller.objectToByteBuffer(obj);
- }
-
- public Object objectFromByteBuffer(byte bytes[]) throws Exception
- {
- Object result = marshaller.objectFromByteBuffer(bytes);
- if (result instanceof ReplicateCommand && expectedCommands != null)
- {
- ReplicateCommand replicateCommand = (ReplicateCommand) result;
- return new ReplicateCommandDelegate(replicateCommand);
- }
- return result;
- }
-
- public Buffer objectToBuffer(Object o) throws Exception
- {
- return marshaller.objectToBuffer(o);
- }
-
- public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
- {
- Object result = marshaller.objectFromByteBuffer(bytes, i, i1);
- if (result instanceof ReplicateCommand && expectedCommands != null)
- {
- ReplicateCommand replicateCommand = (ReplicateCommand) result;
- return new ReplicateCommandDelegate(replicateCommand);
- }
- return result;
- }
- }
-
- /**
- * We want the notification to be performed only *after* the remote command is executed.
- */
- private class ReplicateCommandDelegate extends ReplicateCommand
- {
- ReplicateCommand realOne;
-
- private ReplicateCommandDelegate(ReplicateCommand realOne)
- {
- this.realOne = realOne;
- }
-
- @Override
- public Object perform(InvocationContext ctx) throws Throwable
- {
- try
- {
- return realOne.perform(ctx);
- }
- finally
- {
- System.out.println("Processed command: " + realOne);
- Iterator<Class<? extends ReplicableCommand>> it = expectedCommands.iterator();
- while (it.hasNext())
- {
- Class<? extends ReplicableCommand> replicableCommandClass = it.next();
- if (realOne.containsCommandType(replicableCommandClass))
- {
- it.remove();
- }
- else if (realOne.getSingleModification() instanceof PrepareCommand) //explicit transaction
- {
- PrepareCommand prepareCommand = (PrepareCommand) realOne.getSingleModification();
- if (prepareCommand.containsModificationType(replicableCommandClass))
- {
- it.remove();
- }
- }
- }
- if (expectedCommands.isEmpty())
- {
- latch.countDown();
- }
- }
- }
- }
-
- /**
- * Needed for region based marshalling.
- */
- private class RegionMarshallerDelegate extends AbstractMarshaller
- {
- private Marshaller realOne;
-
- private RegionMarshallerDelegate(Marshaller realOne)
- {
- this.realOne = realOne;
- }
-
- public void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception
- {
- realOne.objectToObjectStream(obj, out);
- }
-
- public Object objectFromObjectStream(ObjectInputStream in) throws Exception
- {
- return realOne.objectFromObjectStream(in);
- }
-
- public Object objectFromStream(InputStream is) throws Exception
- {
- return realOne.objectFromStream(is);
- }
-
- public void objectToObjectStream(Object obj, ObjectOutputStream out, Fqn region) throws Exception
- {
- realOne.objectToObjectStream(obj, out, region);
- }
-
- public RegionalizedMethodCall regionalizedMethodCallFromByteBuffer(byte[] buffer) throws Exception
- {
- RegionalizedMethodCall result = realOne.regionalizedMethodCallFromByteBuffer(buffer);
- if (result.command instanceof ReplicateCommand && expectedCommands != null)
- {
- ReplicateCommand replicateCommand = (ReplicateCommand) result.command;
- result.command = new ReplicateCommandDelegate(replicateCommand);
- }
- return result;
- }
-
- public RegionalizedMethodCall regionalizedMethodCallFromObjectStream(ObjectInputStream in) throws Exception
- {
- return realOne.regionalizedMethodCallFromObjectStream(in);
- }
-
- public ByteBuffer objectToBuffer(Object o) throws Exception
- {
- return realOne.objectToBuffer(o);
- }
-
- public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
- {
- return realOne.objectFromByteBuffer(bytes, i, i1);
- }
- }
-
- /**
- * Blocks for the elements specified through {@link #expect(Class[])} invocations to be replicated in this cache.
- * if replication does not occur in the give timeout then an exception is being thrown.
- */
- public void waitForReplicationToOccur(long timeoutMillis)
- {
- System.out.println("enter... ReplicationListener.waitForReplicationToOccur");
- waitForReplicationToOccur(timeoutMillis, TimeUnit.MILLISECONDS);
- System.out.println("exit... ReplicationListener.waitForReplicationToOccur");
- }
-
- /**
- * Similar to {@link #waitForReplicationToOccur(long)} except that this method provides more flexibility in time units.
- *
- * @param timeout the maximum time to wait
- * @param timeUnit the time unit of the <tt>timeout</tt> argument.
- */
- public void waitForReplicationToOccur(long timeout, TimeUnit timeUnit)
- {
- assert expectedCommands != null : "there are no replication expectations; please use AsyncReplicationListener.expect(...) before calling this method";
- try
- {
- if (!latch.await(timeout, timeUnit))
- {
- assert false : "waiting for more than " + timeout + " " + timeUnit + " and following commands did not replicate: " + expectedCommands;
- }
- }
- catch (InterruptedException e)
- {
- throw new IllegalStateException("unexpected", e);
- }
- finally
- {
- expectedCommands = null;
- latch = new CountDownLatch(1);
- }
- }
-
- /**
- * {@link #waitForReplicationToOccur(long)} will block untill all the commands specified here are being replicated
- * to this cache. The method can be called several times with various arguments.
- */
- public void expect(Class<? extends ReplicableCommand>... expectedCommands)
- {
- if (this.expectedCommands == null)
- {
- this.expectedCommands = new HashSet<Class<? extends ReplicableCommand>>();
- }
- this.expectedCommands.addAll(Arrays.asList(expectedCommands));
- }
-
- /**
- * Waits untill first command is replicated.
- */
- public void expectAny()
- {
- expect();
- }
-}
Added: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/InvalidationReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/InvalidationReplicationListener.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/InvalidationReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -0,0 +1,56 @@
+package org.jboss.cache.util.internals.replicationlisteners;
+
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.legacy.write.VersionedInvalidateCommand;
+import org.jboss.cache.commands.write.InvalidateCommand;
+import org.jboss.cache.commands.write.PutForExternalReadCommand;
+import org.jboss.cache.Cache;
+import org.jboss.cache.config.Configuration;
+
+/**
+ * Specialization of ReplicationListener for caches that use invalidation.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class InvalidationReplicationListener extends ReplicationListener
+{
+
+ Class<? extends InvalidateCommand> base;
+
+ public InvalidationReplicationListener(Cache cache)
+ {
+ super(cache);
+ if (cache.getConfiguration().getNodeLockingScheme().equals(Configuration.NodeLockingScheme.OPTIMISTIC))
+ {
+ base = VersionedInvalidateCommand.class;
+ } else
+ {
+ base = InvalidateCommand.class;
+ }
+ }
+
+ public void expect(Class<? extends ReplicableCommand>... expectedCommands)
+ {
+ expectInvalidations(expectedCommands);
+ }
+
+ public void expectWithTx(Class<? extends ReplicableCommand>... writeCommands)
+ {
+ expectInvalidations(writeCommands);
+ }
+
+ private void expectInvalidations(Class<? extends ReplicableCommand>... commands)
+ {
+ for (Class<? extends ReplicableCommand> command : commands)
+ {
+ if (command.equals(PutForExternalReadCommand.class))
+ {
+ internalExpect();//so that the map won't be empty
+ }
+ else
+ {
+ internalExpect(base);
+ }
+ }
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/MvccReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/MvccReplicationListener.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/MvccReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -0,0 +1,34 @@
+package org.jboss.cache.util.internals.replicationlisteners;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+
+/**
+ * Specialization of ReplicationListener for mvcc caches.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class MvccReplicationListener extends ReplicationListener
+{
+ public MvccReplicationListener(Cache cache)
+ {
+ super(cache);
+ }
+
+ /**
+ * all the commands should be received at the other end.
+ */
+ public void expect(Class<? extends ReplicableCommand>... expectedCommands)
+ {
+ internalExpect(expectedCommands);
+ }
+
+ public void expectWithTx(Class<? extends ReplicableCommand>... writeCommands)
+ {
+ internalExpect(PrepareCommand.class);
+ //this is because for async replication we have an 1pc transaction
+ if (config.getCacheMode().isSynchronous()) internalExpect(CommitCommand.class);
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/OptimisticReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/OptimisticReplicationListener.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/OptimisticReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -0,0 +1,80 @@
+package org.jboss.cache.util.internals.replicationlisteners;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.tx.OptimisticPrepareCommand;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Specialization of ReplicationListener for optimistic caches.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class OptimisticReplicationListener extends ReplicationListener
+{
+ public OptimisticReplicationListener(Cache cache)
+ {
+ super(cache);
+ }
+
+ /**
+ * For each command, expect an OptimisticPrepare and an commit.
+ */
+ public void expect(Class<? extends ReplicableCommand>... expectedCommands)
+ {
+ //in the case of optimistic replication, an prepare and an commit is expected foe each node
+ for (Class<? extends ReplicableCommand> command : expectedCommands)
+ {
+ internalExpect(OptimisticPrepareCommand.class, CommitCommand.class);
+ }
+ }
+
+ /**
+ * For all given commands expect a single prepare, and a single commit.
+ */
+ public void expectWithTx(Class<? extends ReplicableCommand>... writeCommands)
+ {
+ internalExpect(OptimisticPrepareCommand.class, CommitCommand.class);
+ }
+
+ protected void postCommandExecution(ReplicateCommand realOne)
+ {
+ int initialExpectations = expectedCommands.size();
+ List<ReplicableCommand> mods = getAllModifications(realOne);
+ for (Iterator<Class<? extends ReplicableCommand>> typeIt = expectedCommands.iterator(); typeIt.hasNext();)
+ {
+ Class<? extends ReplicableCommand> commadType = typeIt.next();
+ Iterator<ReplicableCommand> instanceIt = mods.iterator();
+ while (instanceIt.hasNext())
+ {
+ ReplicableCommand replicableCommand = instanceIt.next();
+ if (replicableCommand.getClass().equals(commadType))
+ {
+ instanceIt.remove();
+ typeIt.remove();
+ }
+ }
+ }
+ int remainingExpectations = expectedCommands.size();
+ System.out.println("Processed command: " + realOne + ". " + (initialExpectations - remainingExpectations) + " identified, remaining " + remainingExpectations);
+ }
+
+ private List<ReplicableCommand> getAllModifications(ReplicateCommand realOne)
+ {
+ List<ReplicableCommand> result = new ArrayList<ReplicableCommand>();
+ if (realOne.isSingleCommand())
+ {
+ result.add(realOne.getSingleModification());
+ }
+ else
+ {
+ result.addAll(realOne.getModifications());
+ }
+ return result;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/PessReplicationListener.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/PessReplicationListener.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/PessReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -0,0 +1,71 @@
+package org.jboss.cache.util.internals.replicationlisteners;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.commands.tx.CommitCommand;
+import org.jboss.cache.commands.legacy.write.*;
+import org.jboss.cache.commands.write.*;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Specialization of ReplicationListener for optimistic caches.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class PessReplicationListener extends ReplicationListener
+{
+ private static Map<Class<? extends ReplicableCommand>, Class<? extends ReplicableCommand>> mvcc2PessMap =
+ new HashMap<Class<? extends ReplicableCommand>, Class<? extends ReplicableCommand>>();
+
+ static
+ {
+ mvcc2PessMap.put(ClearDataCommand.class, PessClearDataCommand.class);
+ mvcc2PessMap.put(MoveCommand.class, PessMoveCommand.class);
+ mvcc2PessMap.put(PutDataMapCommand.class, PessPutDataMapCommand.class);
+ mvcc2PessMap.put(PutForExternalReadCommand.class, PessPutForExternalReadCommand.class);
+ mvcc2PessMap.put(PutKeyValueCommand.class, PessPutKeyValueCommand.class);
+ mvcc2PessMap.put(RemoveKeyCommand.class, PessRemoveKeyCommand.class);
+ mvcc2PessMap.put(RemoveNodeCommand.class, PessRemoveNodeCommand.class);
+ }
+
+
+ public PessReplicationListener(Cache cache)
+ {
+ super(cache);
+ }
+
+ /**
+ * In this scenario, all the commands shold be replaced wiht their pessimistic cunterparts.
+ */
+ public void expect(Class<? extends ReplicableCommand>... expectedCommands)
+ {
+ for (Class<? extends ReplicableCommand> command: expectedCommands)
+ {
+ super.internalExpect(getPessCommand(command));
+ }
+ }
+
+ public void expectWithTx(Class<? extends ReplicableCommand>... commands)
+ {
+ for (Class<? extends ReplicableCommand> command : commands)
+ {
+ if (command.equals(PessPutForExternalReadCommand.class))
+ {
+ throw new IllegalArgumentException("PFER are not part of tx, use no-tx .expect()");
+ }
+ }
+ internalExpect(PrepareCommand.class);
+ if (config.getCacheMode().isSynchronous())
+ {
+ internalExpect(CommitCommand.class);
+ }
+ }
+
+ private Class<? extends ReplicableCommand> getPessCommand(Class<? extends ReplicableCommand> command)
+ {
+ return mvcc2PessMap.get((Class<? extends ReplicableCommand>) command);
+ }
+}
Copied: core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java (from rev 7147, core/trunk/src/test/java/org/jboss/cache/util/internals/ReplicationListener.java)
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/util/internals/replicationlisteners/ReplicationListener.java 2008-11-19 11:57:48 UTC (rev 7163)
@@ -0,0 +1,336 @@
+package org.jboss.cache.util.internals.replicationlisteners;
+
+import org.jboss.cache.*;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.commands.ReplicableCommand;
+import org.jboss.cache.commands.remote.ReplicateCommand;
+import org.jboss.cache.commands.tx.PrepareCommand;
+import org.jboss.cache.factories.ComponentRegistry;
+import org.jboss.cache.io.ByteBuffer;
+import org.jboss.cache.marshall.AbstractMarshaller;
+import org.jboss.cache.marshall.CommandAwareRpcDispatcher;
+import org.jboss.cache.marshall.InactiveRegionAwareRpcDispatcher;
+import org.jboss.cache.marshall.Marshaller;
+import org.jboss.cache.marshall.RegionalizedMethodCall;
+import org.jboss.cache.util.TestingUtil;
+import org.jgroups.blocks.RpcDispatcher;
+import org.jgroups.util.Buffer;
+
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Utility class that notifies when certain commands were asynchronously replicated on secondary cache.
+ * Especially useful for avaoiding Thread.sleep() statements.
+ * <p/>
+ * Usage:
+ * <pre>
+ * no tx:
+ * Cache c1, c2; //these being two async caches
+ * ReplicationListener listener2 = ReplicationListener.getReplicationListener(c2);
+ * listener2.expect(PutKeyValueCommand.class);
+ * c1.put(fqn, key, value);
+ * listener2.waitForReplicationToOccur(1000); // -this will block here untill c2 recieves the PutKeyValueCommand command
+ * with tx: (difference is that expectWithTx is used insted of expect
+ * Cache c1, c2; //these being two async caches
+ * ReplicationListener listener2 = ReplicationListener.getReplicationListener(c2);
+ * listener2.expectWithTx(PutKeyValueCommand.class);
+ * txManager.begin();
+ * c1.put(fqn, key, value);
+ * txManager.commit();
+ * listener2.waitForReplicationToOccur(1000); // -this will block here untill c2 recieves the PutKeyValueCommand command
+ * </pre>
+ *
+ *
+ * Lifecycle - after being used (i.e. waitForReplicationToOccur returns sucessfully) the object returns to the
+ * non-initialized state and *can* be reused through expect-wait cycle.
+ * <b>Note</b>: this class might be used aswell for sync caches, e.g. a test could have subclasses which use sync and
+ * async replication
+ *
+ * @author Mircea.Markus(a)jboss.com
+ * @since 2.2
+ */
+abstract public class ReplicationListener
+{
+
+ public static final long DEFAULT_TIMEOUT = 10000;
+ private CountDownLatch latch = new CountDownLatch(1);
+ protected List<Class<? extends ReplicableCommand>> expectedCommands;
+ protected Configuration config;
+
+ /**
+ * Builds a listener that will observe the given cache for recieving replication commands.
+ */
+ protected ReplicationListener(Cache cache)
+ {
+ ComponentRegistry componentRegistry = TestingUtil.extractComponentRegistry(cache);
+ RPCManager rpcManager = componentRegistry.getComponent(RPCManager.class);
+ CommandAwareRpcDispatcher realDispatcher = (CommandAwareRpcDispatcher) TestingUtil.extractField(rpcManager, "rpcDispatcher");
+ RpcDispatcher.Marshaller2 realMarshaller = (RpcDispatcher.Marshaller2) realDispatcher.getMarshaller();
+ RpcDispatcher.Marshaller2 delegate = null;
+ if ((realMarshaller instanceof RegionMarshallerDelegate) || (realMarshaller instanceof MarshallerDelegate))
+ {
+ throw new RuntimeException("Illegal state");
+ }
+ if (realDispatcher instanceof InactiveRegionAwareRpcDispatcher)
+ delegate = new RegionMarshallerDelegate((Marshaller) realMarshaller);
+ else
+ delegate = new MarshallerDelegate(realMarshaller);
+ realDispatcher.setMarshaller(delegate);
+ realDispatcher.setRequestMarshaller(delegate);
+ realDispatcher.setResponseMarshaller(delegate);
+ this.config = cache.getConfiguration();
+ }
+
+ protected ReplicationListener()
+ {
+ }
+
+ abstract public void expect(Class<? extends ReplicableCommand>... expectedCommands);
+
+ /**
+ * Based on cache's configuration, will know for what specific commands to expect to be replicated.
+ * E.g. async replication with a tx, would expect only a PrepareCommand (async is 1PC). sync repl with tx would expect
+ * a prepare and a commit (sync is 2pc).
+ */
+ abstract public void expectWithTx(Class<? extends ReplicableCommand>... writeCommands);
+
+ /**
+ * Factory method, to be used in order to obtain a replication listener based on a cache config.
+ */
+ public static ReplicationListener getReplicationListener(Cache cache)
+ {
+ if (cache.getConfiguration().getCacheMode().isInvalidation())
+ {
+ return new InvalidationReplicationListener(cache);
+ }
+ if (cache.getConfiguration().getNodeLockingScheme().equals(Configuration.NodeLockingScheme.OPTIMISTIC))
+ {
+ return new OptimisticReplicationListener(cache);
+ }
+ else if (cache.getConfiguration().getNodeLockingScheme().equals(Configuration.NodeLockingScheme.PESSIMISTIC))
+ {
+ return new PessReplicationListener(cache);
+ } else
+ {
+ return new MvccReplicationListener(cache);
+ }
+ }
+
+ private class MarshallerDelegate implements RpcDispatcher.Marshaller2
+ {
+ RpcDispatcher.Marshaller2 marshaller;
+
+ private MarshallerDelegate(RpcDispatcher.Marshaller2 marshaller)
+ {
+ this.marshaller = marshaller;
+ }
+
+ public byte[] objectToByteBuffer(Object obj) throws Exception
+ {
+ return marshaller.objectToByteBuffer(obj);
+ }
+
+ public Object objectFromByteBuffer(byte bytes[]) throws Exception
+ {
+ Object result = marshaller.objectFromByteBuffer(bytes);
+ if (result instanceof ReplicateCommand && expectedCommands != null)
+ {
+ ReplicateCommand replicateCommand = (ReplicateCommand) result;
+ return new ReplicateCommandDelegate(replicateCommand);
+ }
+ return result;
+ }
+
+ public Buffer objectToBuffer(Object o) throws Exception
+ {
+ return marshaller.objectToBuffer(o);
+ }
+
+ public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
+ {
+ Object result = marshaller.objectFromByteBuffer(bytes, i, i1);
+ if (result instanceof ReplicateCommand && expectedCommands != null)
+ {
+ ReplicateCommand replicateCommand = (ReplicateCommand) result;
+ return new ReplicateCommandDelegate(replicateCommand);
+ }
+ return result;
+ }
+ }
+
+ /**
+ * We want the notification to be performed only *after* the remote command is executed.
+ */
+ private class ReplicateCommandDelegate extends ReplicateCommand
+ {
+ ReplicateCommand realOne;
+
+ private ReplicateCommandDelegate(ReplicateCommand realOne)
+ {
+ this.realOne = realOne;
+ }
+
+ @Override
+ public Object perform(InvocationContext ctx) throws Throwable
+ {
+ try
+ {
+ return realOne.perform(ctx);
+ }
+ finally
+ {
+ postCommandExecution(realOne);
+ if (expectedCommands.isEmpty())
+ {
+ latch.countDown();
+ }
+ }
+ }
+ }
+
+
+ protected void postCommandExecution(ReplicateCommand realOne)
+ {
+ System.out.println("Processed command: " + realOne + "; expecting - " + expectedCommands.size() + " commands");
+ Iterator<Class<? extends ReplicableCommand>> it = expectedCommands.iterator();
+ while (it.hasNext())
+ {
+ Class<? extends ReplicableCommand> replicableCommandClass = it.next();
+ if (realOne.containsCommandType(replicableCommandClass))
+ {
+ it.remove();
+ } else if (realOne.getSingleModification() instanceof PrepareCommand) //explicit transaction
+ {
+ PrepareCommand prepareCommand = (PrepareCommand) realOne.getSingleModification();
+ if (prepareCommand.containsModificationType(replicableCommandClass))
+ {
+ it.remove();
+ }
+ }
+ }
+ System.out.println("After process expecing : " + expectedCommands.size() + " commands");
+ }
+
+ /**
+ * Needed for region based marshalling.
+ */
+ private class RegionMarshallerDelegate extends AbstractMarshaller
+ {
+ private Marshaller realOne;
+
+ private RegionMarshallerDelegate(Marshaller realOne)
+ {
+ this.realOne = realOne;
+ }
+
+ public void objectToObjectStream(Object obj, ObjectOutputStream out) throws Exception
+ {
+ realOne.objectToObjectStream(obj, out);
+ }
+
+ public Object objectFromObjectStream(ObjectInputStream in) throws Exception
+ {
+ return realOne.objectFromObjectStream(in);
+ }
+
+ public Object objectFromStream(InputStream is) throws Exception
+ {
+ return realOne.objectFromStream(is);
+ }
+
+ public void objectToObjectStream(Object obj, ObjectOutputStream out, Fqn region) throws Exception
+ {
+ realOne.objectToObjectStream(obj, out, region);
+ }
+
+ public RegionalizedMethodCall regionalizedMethodCallFromByteBuffer(byte[] buffer) throws Exception
+ {
+ RegionalizedMethodCall result = realOne.regionalizedMethodCallFromByteBuffer(buffer);
+ if (result.command instanceof ReplicateCommand && expectedCommands != null)
+ {
+ ReplicateCommand replicateCommand = (ReplicateCommand) result.command;
+ result.command = new ReplicateCommandDelegate(replicateCommand);
+ }
+ return result;
+ }
+
+ public RegionalizedMethodCall regionalizedMethodCallFromObjectStream(ObjectInputStream in) throws Exception
+ {
+ return realOne.regionalizedMethodCallFromObjectStream(in);
+ }
+
+ public ByteBuffer objectToBuffer(Object o) throws Exception
+ {
+ return realOne.objectToBuffer(o);
+ }
+
+ public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
+ {
+ return realOne.objectFromByteBuffer(bytes, i, i1);
+ }
+ }
+
+ /**
+ * Blocks for the elements specified through {@link #expect(Class[])} invocations to be replicated in this cache.
+ * if replication does not occur in the give timeout then an exception is being thrown.
+ */
+ public void waitForReplicationToOccur(long timeoutMillis)
+ {
+ System.out.println("enter... ReplicationListener.waitForReplicationToOccur");
+ waitForReplicationToOccur(timeoutMillis, TimeUnit.MILLISECONDS);
+ System.out.println("exit... ReplicationListener.waitForReplicationToOccur");
+ }
+
+ /**
+ * same as {@link #waitForReplicationToOccur(long)}, just that it uses the {@link #DEFAULT_TIMEOUT} for timeout.
+ */
+ public void waitForReplicationToOccur()
+ {
+ waitForReplicationToOccur(DEFAULT_TIMEOUT);
+ }
+
+ /**
+ * Similar to {@link #waitForReplicationToOccur(long)} except that this method provides more flexibility in time units.
+ *
+ * @param timeout the maximum time to wait
+ * @param timeUnit the time unit of the <tt>timeout</tt> argument.
+ */
+ public void waitForReplicationToOccur(long timeout, TimeUnit timeUnit)
+ {
+ assert expectedCommands != null : "there are no replication expectations; please use AsyncReplicationListener.expectWithTx(...) before calling this method";
+ try
+ {
+ if (!expectedCommands.isEmpty() && !latch.await(timeout, timeUnit))
+ {
+ assert false : "waiting for more than " + timeout + " " + timeUnit + " and following commands did not replicate: " + expectedCommands;
+ }
+ }
+ catch (InterruptedException e)
+ {
+ throw new IllegalStateException("unexpected", e);
+ }
+ finally
+ {
+ expectedCommands = null;
+ latch = new CountDownLatch(1);
+ }
+ }
+
+ /**
+ * {@link #waitForReplicationToOccur(long)} will block untill all the commands specified here are being replicated
+ * to this cache. The method can be called several times with various arguments.
+ */
+ protected void internalExpect(Class<? extends ReplicableCommand>... expectedCommands)
+ {
+ if (this.expectedCommands == null)
+ {
+ this.expectedCommands = new ArrayList<Class<? extends ReplicableCommand>>();
+ }
+ this.expectedCommands.addAll(Arrays.asList(expectedCommands));
+ }
+}
16 years, 2 months
JBoss Cache SVN: r7162 - core/trunk/src/main/java/org/jboss/cache/commands/tx.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-19 06:46:13 -0500 (Wed, 19 Nov 2008)
New Revision: 7162
Modified:
core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
Log:
enhnaced toString
Modified: core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-11-19 11:33:37 UTC (rev 7161)
+++ core/trunk/src/main/java/org/jboss/cache/commands/tx/OptimisticPrepareCommand.java 2008-11-19 11:46:13 UTC (rev 7162)
@@ -1,24 +1,24 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.cache.commands.tx;
import org.jboss.cache.InvocationContext;
@@ -102,6 +102,7 @@
"modifications=" + modifications +
", localAddress=" + localAddress +
", onePhaseCommit=" + onePhaseCommit +
+ ", globalTransaction = " + globalTransaction +
'}';
}
}
16 years, 2 months
JBoss Cache SVN: r7161 - core/trunk.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-11-19 06:33:37 -0500 (Wed, 19 Nov 2008)
New Revision: 7161
Modified:
core/trunk/pom.xml
Log:
increased thread count
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2008-11-19 11:10:43 UTC (rev 7160)
+++ core/trunk/pom.xml 2008-11-19 11:33:37 UTC (rev 7161)
@@ -132,7 +132,7 @@
<version>2.4.3-JBOSS</version>
<configuration>
<parallel>tests</parallel>
- <threadCount>1</threadCount>
+ <threadCount>10</threadCount>
<forkMode>none</forkMode>
<trimStackTrace>false</trimStackTrace>
<properties>
16 years, 2 months
JBoss Cache SVN: r7160 - core/tags/3.0.0.GA/src/main/release.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-11-19 06:10:43 -0500 (Wed, 19 Nov 2008)
New Revision: 7160
Modified:
core/tags/3.0.0.GA/src/main/release/README.txt
Log:
Modified: core/tags/3.0.0.GA/src/main/release/README.txt
===================================================================
--- core/tags/3.0.0.GA/src/main/release/README.txt 2008-11-19 04:00:15 UTC (rev 7159)
+++ core/tags/3.0.0.GA/src/main/release/README.txt 2008-11-19 11:10:43 UTC (rev 7160)
@@ -3,29 +3,26 @@
Note:
- We offer different packaging for download:
- + jbosscache-core-2.1.x-bin, just the core jar file and dependencies.
- + jbosscache-core-2.1.x-all, everything including docs, sources and tests.
- + jbosscache-core-2.1.x-doc, just the documentation.
+ + jbosscache-core-3.x.y-bin, just the core jar file and dependencies.
+ + jbosscache-core-3.x.y-all, everything including docs, demos and tutorials, no sources though.
+ + jbosscache-core-3.x.y-doc, just the documentation.
+ + jbosscache-core-3.x.y-src, a zipped up snapshot of the project root directory in subversion, which includes all sources, tests and build scripts.
- If you are looking for JBoss Cache POJO edition, this is a separate distribution:
- + jbosscache-pojo-2.1.x-bin, just the core jar file and dependencies. Note that this will include jbosscache-core.jar as a dependency.
- + jbosscache-pojo-2.1.x-all, everything including docs, sources and tests.
- + jbosscache-pojo-2.1.x-doc, just the documentation.
+ + jbosscache-pojo-3.x.y-bin, just the core jar file and dependencies. Note that this will include jbosscache-core.jar as a dependency.
+ + jbosscache-pojo-3.x.y-all, everything including docs, sources and tests.
+ + jbosscache-pojo-3.x.y-doc, just the documentation.
Requirements:
- JDK 5.0 and up
Running the tutorial:
- - The bin and all distros come with a build.xml file in the directory root, which contains targets for running
- tests as well as the demo outlined in the tutorial. You need an installation of Jakarta Ant 1.6.0 or higher
- to run the script.
+ - Please read the tutorial documentation (in the jbosscache-core-3.x.y-all distribution) for instructions.
-- Just run 'ant' in the root directry for instructions.
-
-
Problems:
- Please report problems to the JBoss cache forum
(http://www.jboss.org/forum.jsp?forum=157)
- or the JBoss dev mailing list
+ or the JBoss dev mailing list (https://lists.jboss.org/mailman/listinfo/jbosscache-dev)
+
16 years, 2 months
JBoss Cache SVN: r7159 - in enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide: es-ES and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mospina
Date: 2008-11-18 23:00:15 -0500 (Tue, 18 Nov 2008)
New Revision: 7159
Modified:
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/Makefile
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Book_Info.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Term.po
Log:
translation for Pojo cache completed
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/Makefile
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/Makefile 2008-11-19 03:17:03 UTC (rev 7158)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/Makefile 2008-11-19 04:00:15 UTC (rev 7159)
@@ -4,7 +4,7 @@
XML_LANG = en-US
-BRAND = JBoss
+#BRAND = JBoss
OTHER_LANGS = de-DE es-ES fr-FR ja-JP pt-BR zh-CN
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Book_Info.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Book_Info.po 2008-11-19 03:17:03 UTC (rev 7158)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Book_Info.po 2008-11-19 04:00:15 UTC (rev 7159)
@@ -8,7 +8,7 @@
"Project-Id-Version: Book_Info\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-17 16:15+1000\n"
+"PO-Revision-Date: 2008-11-19 13:30+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -32,7 +32,7 @@
#: Book_Info.xml:12
#, no-c-format
msgid "This book is a User Guide for Pojo Cache"
-msgstr "Este libro es un manual del usuario para Pojo Cache"
+msgstr "Este libro es el manual del usuario para Pojo Cache"
#. Tag: holder
#: Book_Info.xml:26
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po 2008-11-19 03:17:03 UTC (rev 7158)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po 2008-11-19 04:00:15 UTC (rev 7159)
@@ -8,7 +8,7 @@
"Project-Id-Version: Introduction\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-18 13:54+1000\n"
+"PO-Revision-Date: 2008-11-19 13:56+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -40,9 +40,9 @@
"on, the object will then need to implement the <literal>Serializable</"
"literal> interface. In addition, it has known limitations:"
msgstr ""
-"Los dos componentes en JBossCache, plain cache (implementado como TreeCache) y "
+"Los dos componentes en JBossCache, caché simple (implementado como TreeCache) y "
"PojoCache (implementado como PojoCache) son transaccionales, en-memoria, "
-"replicados y persistentes. Sin embargo, TreeCache usualmente se utiliza como un sistema de caché sencillo. Es decir que almacena directamente las referencias de objetos y tiene un APi similar a <literal>HashMap</literal>. Si la replicación o la persistencia se encuentran prendidas entonces el objeto necesitará implementar la interfaz <literal>Serializable</"
+"replicados y persistentes. Sin embargo, TreeCache usualmente se utiliza como un sistema de caché sencillo. Es decir que almacena directamente las referencias de objetos y tiene un <literal>HashMap</literal> similar a un Api. Si la replicación o la persistencia se encuentran prendidas entonces el objeto necesitará implementar la interfaz <literal>Serializable</"
"literal>. Además tiene limitaciones conocidas:"
#. Tag: para
@@ -73,7 +73,7 @@
"replication. If we have two <literal>Person</literal> instances that share "
"the same <literal>Address</literal> , upon replication, it will be split "
"into two separate <literal>Address</literal> instances (instead of just one)."
-msgstr "La estructura del objeto no puede tener una relación gráfica. Es decir, el objeto no puede tener sub-objetos compartidos (referenciados múltiplemente) o referenciados a sí mismos (cíclico). De otra manera, la relación se romperá con la serialización. Por ejemplo, la figura 1 ilustra este problema durante la replicación. Si tenemos dos instancias <literal>Person</literal> que comparten la misma <literal>Address</literal> , en la replicación, será separada en dos instancias <literal>Address</literal> separadas (en lugar de solo una). "
+msgstr "La estructura del objeto no puede tener una relación gráfica. Es decir, el objeto no puede tener sub-objetos compartidos (referenciados múltiplemente) o referenciados a sí mismos (cíclico). De otra manera, la relación se romperá con la serialización. Por ejemplo, la figura 1 ilustra este problema durante la replicación. Si tenemos dos instancias <literal>Person</literal> que comparten la misma <literal>Address</literal> , en la replicación, será separada en dos instancias <literal>Address</literal> aparte (en lugar de solo una). "
#. Tag: title
#: Introduction.xml:21
@@ -89,8 +89,8 @@
"By \"object-oriented\", we mean that PojoCache provides tight integration "
"with the object-oriented Java language paradigm, specifically,"
msgstr ""
-"Por otro lado, PojoCache, on the other hand es un caché \"orientado a objetos\" detallado. "
-"Lo que queremos decir con \"orientado a objetos\" es que PojoCache proporciona una integración fuerte con el paradigma del lenguaje Java orientado a objetos especificamente,"
+"Por otro lado, PojoCache es un caché \"orientado a objetos\" detallado. "
+"Lo que queremos decir con \"orientado a objetos\" es que PojoCache proporciona una integración fuerte con el paradigma del lenguaje Java orientado a objetos especificamente:"
#. Tag: para
#: Introduction.xml:31
@@ -129,7 +129,7 @@
"xml file (i.e., <literal>jboss-aop.xml</literal>), or through annotation "
"inside the POJO. Depending on your preference, you can either pre-instrument "
"your POJO (compile time) or have JBossAop do it at load time."
-msgstr "Declare POJO para que sea \"preparado\" (en Aop parlance) ya sea por medio de un archivo xml externo (i.e., <literal>jboss-aop.xml</literal>), o por medio de una anotación dentro del POJO. Dependiendo de su preferencia puede pre-instrumentar su POJO (durante la compilación) o hacer que JBossAop lo haga en el momento de carga."
+msgstr "Declare POJO para que sea \"preparado\" (en lenguaje Aop) ya sea por medio de un archivo xml externo (i.e., <literal>jboss-aop.xml</literal>), o por medio de una anotación dentro del POJO. Dependiendo de su preferencia puede pre-instrumentar su POJO (durante la compilación) o hacer que JBossAop lo haga en el momento de carga."
#. Tag: para
#: Introduction.xml:47
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Term.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Term.po 2008-11-19 03:17:03 UTC (rev 7158)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Term.po 2008-11-19 04:00:15 UTC (rev 7159)
@@ -8,7 +8,7 @@
"Project-Id-Version: Term\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-17 09:52+1000\n"
+"PO-Revision-Date: 2008-11-19 13:39+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -119,7 +119,7 @@
"memory, replicated, and persistent. PojoCache currently is a sub-class of "
"TreeCache."
msgstr ""
-"TreeCache es un componente de JBossCache que es un sistema caché simple. Es decir que almacena una referencia de objeto Java y requiere que un objeto sea serializable para realizar replicación en binarios. Se basa en Java se encuentra en "
+"TreeCache es un componente de JBossCache que es un sistema caché simple. Es decir que almacena una referencia de objeto Java y requiere que un objeto sea serializable para realizar replicación en binarios. Se basa en Java, se encuentra en "
"memoria, es replicado y persistente. Actualmente PojoCache es una sub-clase de "
"TreeCache."
@@ -168,7 +168,7 @@
"or annotation, we consider it \"aspectized\"."
msgstr ""
"Prepare es una palabra clave en el lenguaje de JBossAop utilizada para especificar qué POJO necesita ser instrumentado. Aparece en un archivo <literal>jboss-aop.xml</"
-"literal>. Sin embargo, si puede utilizar una anotación para especificar la instrumentación POJO entonces no hay necesidad de un listado <literal>jboss-aop.xml</literal>. Observe que cuando se declara aporpiadamente un POJO por medio del xml "
+"literal>. Sin embargo, si puede utilizar una anotación para especificar la instrumentación POJO entonces no hay necesidad de un listado <literal>jboss-aop.xml</literal>. Observe que cuando se declara apropiadamente un POJO por medio del xml "
"o por una anotación entonces lo consideramos como \"aspectized\"."
#. Tag: term
16 years, 2 months
JBoss Cache SVN: r7158 - enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES.
by jbosscache-commits@lists.jboss.org
Author: mospina
Date: 2008-11-18 22:17:03 -0500 (Tue, 18 Nov 2008)
New Revision: 7158
Modified:
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Api.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Instrumentation.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Jbossaop.po
Log:
translation for Pojo cache in progress
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Api.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Api.po 2008-11-18 04:45:36 UTC (rev 7157)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Api.po 2008-11-19 03:17:03 UTC (rev 7158)
@@ -8,7 +8,7 @@
"Project-Id-Version: Api\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-17 16:33+1000\n"
+"PO-Revision-Date: 2008-11-19 12:16+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -96,7 +96,7 @@
"opaque \"primitive\" type. That is, it will simply store it without mapping "
"the object's field into cache. Replication is done on the object wide level "
"and therefore no fine-grained replication can be obtained."
-msgstr ""
+msgstr "Cuando el POJO es solo serializable, PojoCache simplemente lo tratará como un tipo \"primitivo\" opaco. Es decir que simplemente lo almacenará sin mapear el campo del objeto en el caché. La replicación se reliza a nivel de todo el objeto y por lo tanto no se puede obtener una replicación detallada."
#. Tag: para
#: Api.xml:20
@@ -111,6 +111,10 @@
"POJO or circular reference, this Api will handle the appropriate reference "
"counting."
msgstr ""
+"Si <literal>pojo</literal> tiene sub-objetos, por ejemplo, tiene campos que son de tipo no-"
+"primitivo, esta llamada emitirá <literal>putObject</literal> "
+"recursivamente hasta que todo el árbol de objetos sea atravesado (mapeo por acceso). Además, si pone <literal>pojo</literal> múltiples veces, simplemente retorna la referencia del objeto original. También si este POJO ha sido referenciado múltiples veces, por ejemplo, referenciado por otro "
+"POJO o un referencia circular, esta Api manejará el conteo de referencias apropiado."
#. Tag: para
#: Api.xml:23
@@ -122,13 +126,13 @@
"once for each POJO (think of it as attaching POJO to cache management). Once "
"it is executed, <literal>PojoCache</literal> will assign an interceptor for "
"the pojo instance and its sub-objects."
-msgstr ""
+msgstr "El valor de retorno después de la llamada es el objeto existente bajo fqn (si hay alguno). Como consecuencia, una llamada exitosa reemplazará ese valor antiguo con la instancia pojo, si existe. Observe que un usuario sólo necesitará emitir esta llamada una sola vez para cada POJO (considérelo como adjuntar POJO a la administración de caché). Una vez que se ejecuta, <literal>PojoCache</literal> asignará un interceptor para la instancia pojo y sus sub-objetos. "
#. Tag: title
#: Api.xml:26
#, no-c-format
msgid "Detachment"
-msgstr ""
+msgstr "Separación "
#. Tag: programlisting
#: Api.xml:27
@@ -170,13 +174,13 @@
"won't get garbage collected by the VM. Note this call will also remove "
"everything stored under <literal>fqn</literal> even if you have put other "
"plain cache data there."
-msgstr ""
+msgstr "Esta llamada separará el POJO de la administración de caché removiendo el contenido bajo fqn y retornando la instancia POJO almacenada allí (null si no existe). Después de la llamada exitosa cualquier operación POJO en la referencia POJO retornada ya no es interceptada por el sistema del caché. Así que en esencia utilizará esta Api en caso de que decida que ya no es necesario el POJO bajo <literal>fqn</literal>. Por ejemplo, si un POJO ya no se encuentra en contexto, necesitará invocar explícitamente esta Api de otra manera no la recogera la basura de la MV. Observe que esta llamada también borrará todo lo almacenado bajo <literal>fqn</literal> incluso si ha puesto otros datos de caché simples. "
#. Tag: title
#: Api.xml:31
#, no-c-format
msgid "Query"
-msgstr ""
+msgstr "Petición"
#. Tag: programlisting
#: Api.xml:32
@@ -214,6 +218,8 @@
"add the cache interceptor such that every future access will be in sync with "
"the underlying cache store."
msgstr ""
+"Esta llamada retornará el contenido del objeto actual ubicado bajo <literal>fqn</"
+"literal>. Esta llamada de método es útil cuando no tiene la referencia POJO exacta. Por ejemplo, en caso de conmutación al nodo replicado usted debe obtener la referencia de objeto de la instancia caché replicada. En ese caso, PojoCache creará un nuevo objeto Java si no existe y luego añadirá el interceptor de caché de tal manera que todo acceso futuro esté sincronizado con el almacenamiento caché subyacente. "
#. Tag: programlisting
#: Api.xml:36
@@ -262,7 +268,7 @@
"find the POJOs under that base. For example, if you specify the fqn to be "
"root, e.g., <code>\"/\"</code> , then it will return all the managed POJOs "
"under the cache."
-msgstr ""
+msgstr "Esta llamada retornará todos los POJOs administrados bajo el caché con un nombre Fqn base. Es recursivo lo que significa que atravesará todos los sub-árboles para encontrar los POJOs bajo esa base. Por ejemplo, si especifica el fqn para que sea la raíz, por ejemplo, <code>\"/\"</code> entonces retornará todos los POJOs administrados bajo el caché. "
#. Tag: para
#: Api.xml:40
@@ -272,5 +278,5 @@
"assumes that once a pojo is found with a fqn, no more pojo is stored under "
"the children of the fqn. That is, we don't mixed the fqn with different "
"POJOs."
-msgstr ""
+msgstr "Observe que actualmente esta operación no tiene seguridad de hilos. Además asume que una vez se encuentra un pojo con un fqn, no se almacena más pojo bajo los hijos del fqn. En otras palabras no mezclamos el fqn con POJOs diferentes. "
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Instrumentation.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Instrumentation.po 2008-11-18 04:45:36 UTC (rev 7157)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Instrumentation.po 2008-11-19 03:17:03 UTC (rev 7158)
@@ -8,7 +8,7 @@
"Project-Id-Version: Instrumentation\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-17 12:04+1000\n"
+"PO-Revision-Date: 2008-11-19 10:38+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -376,6 +376,8 @@
"as the Java language <code>transient</code> keyword. That is, PojoCache "
"won't put this field into cache management (and therefore no replication)."
msgstr ""
+"En el lanzamiento 1.4 hemos añadido dos anotaciones adicionales a nivel de campo para un comportamiento personalizado. La primera es <code>@org.jboss.cache.aop.annotation."
+"Transient</code>. Cuando se aplica a una variable de campo tiene el mismo efecto que la palabra clave <code>transient</code> del lenguaje Java. Es decir que PojoCache no pondrá este campo en la administración del caché (y por lo tanto no replicación)."
#. Tag: para
#: Instrumentation.xml:85
@@ -387,6 +389,10 @@
"However, the field will need to implement the <code>Serializable</code> "
"interface such that it can be replicated."
msgstr ""
+"La segunda es <code>@org.jboss.cache.aop.annotation.Serializable</code>, cuando se aplica a una variable de campo, PojoCache tratará esta variable como "
+"<code>Serializable</code>, aun cuando es <code>PojoCacheable</code>. "
+"Sin embargo, el campo necesitará implementar la interfaz <code>Serializable</code> "
+"de tal manera que pueda ser replicada."
#. Tag: para
#: Instrumentation.xml:88
@@ -405,6 +411,18 @@
"}\n"
"</programlisting> Then when we do:"
msgstr ""
+"Aqui tiene un pedazo de código que ilustra el uso de estas dos anotaciones. "
+"Asumiendo que tiene una clase Gadget: <programlisting>\n"
+"public class Gadget\n"
+"{\n"
+" // resource won't be replicated\n"
+" @Transient Resource resource;\n"
+" // specialAddress is treated as a Serializable object but still has "
+"object relationship\n"
+" @Serializable SpecialAddress specialAddress;\n"
+" // other state variables\n"
+"}\n"
+"</programlisting> Entonces hacemos:"
#. Tag: programlisting
#: Instrumentation.xml:90
@@ -458,7 +476,7 @@
#: Instrumentation.xml:92
#, no-c-format
msgid "Weaving"
-msgstr ""
+msgstr "Entretejer"
#. Tag: para
#: Instrumentation.xml:93
@@ -470,6 +488,8 @@
"<literal>jboss-aop.xml</literal> and weave the POJO byte code at compile "
"time. This is a convenient feature to make the aop less intrusive."
msgstr ""
+"Como lo mencionamos anteriormente, un usuario puede utilizar el precompilador aop (<literal>aopc</"
+"literal>) para precompilar las clases POJO de manera que no se necesita un cargador de clase del sistema en tiempo de ejecución. El precompilador leerá en <literal>jboss-aop.xml</literal> y entreteje el código byte POJO en el momento de la compilación. Esta es una funcionalidad muy conveniente para que el aop sea menos intrusivo. "
#. Tag: para
#: Instrumentation.xml:96
@@ -479,6 +499,8 @@
"targets that we are listing here. User can refer to the <literal>build.xml</"
"literal> in the distribution for full details."
msgstr ""
+"A continuación hay un pedazo de Ant que define la biblioteca que se necesita para varios de los destinos Ant que estamos listando aqui. El usuario se puede referir al <literal>build.xml</"
+"literal> en la distribución para obtener mayores detalles. "
#. Tag: programlisting
#: Instrumentation.xml:97
@@ -508,7 +530,7 @@
msgid ""
"Ant target for running load-time instrumentation using specialized class "
"loader"
-msgstr ""
+msgstr "El destino Ant para ejecutar la instrumentación en tiempo de carga utilizando un cargador de clase especializado"
#. Tag: para
#: Instrumentation.xml:100
@@ -522,6 +544,8 @@
"<literal>GenerateInstrumentedClassLoader</literal> has been used since the "
"previous <literal>SystemClassLoader</literal> is error prone."
msgstr ""
+"A continuación encontrará un pedazo de código para el destino Ant que está realizando la instrumentación en tiempo de carga por medio de un cargador de clase especial. Básicamente, el destino Ant <literal>one.test.aop</literal> que utiliza el cargador bootclass generado por el destino Ant <literal>generateClassLoader</literal> para ejecutar un test individual. Observe que desde JBossAop 1.3, se utiliza un nuevo "
+"<literal>GenerateInstrumentedClassLoader</literal> desde el <literal>SystemClassLoader</literal> anterior"
#. Tag: programlisting
#: Instrumentation.xml:103
@@ -616,7 +640,7 @@
"If you are running JDK5.0, you can also use the <code>javaagent</code> "
"option that does not require a separate Classloader. Here are the ant "
"snippet from <code>one-test-aop50</code>, for example."
-msgstr ""
+msgstr "Si está ejecutando JDK5.0, también puede utilizar la opción <code>javaagent</code> que no requiere un cargador de clase por separado. Por ejemplo, aqui tiene un pedazo de ant de <code>one-test-aop50</code>."
#. Tag: programlisting
#: Instrumentation.xml:105
@@ -662,7 +686,7 @@
#: Instrumentation.xml:107
#, no-c-format
msgid "Ant target for aopc"
-msgstr ""
+msgstr "Ant de destino para aopc"
#. Tag: para
#: Instrumentation.xml:108
@@ -671,7 +695,7 @@
"Below is the code snippet for the <literal>aopc</literal> Ant target. "
"Running this target will do compile-time weaving of the POJO classes "
"specified."
-msgstr ""
+msgstr "A continuación puede ver un pedazo de código para el destino Ant <literal>aopc</literal>. El ejecutar este destino entretejerá en tiempo de compilación de las clases POJO especificadas."
#. Tag: programlisting
#: Instrumentation.xml:111
@@ -711,18 +735,20 @@
"that couple extra classes have been generated because of <literal>aopc</"
"literal>."
msgstr ""
+"A continuación puede ver una instantánea de los archivos que son generados cuando se aplica aopc. Observe que se han generado un par de extra clases gracias a <literal>aopc</"
+"literal>."
#. Tag: title
#: Instrumentation.xml:116
#, no-c-format
msgid "Classes generated after aopc"
-msgstr ""
+msgstr "Clases generadas después de aopc"
#. Tag: title
#: Instrumentation.xml:123
#, no-c-format
msgid "Ant target for annotation compiler"
-msgstr ""
+msgstr "Destino Ant para el compilador de anotaciones"
#. Tag: para
#: Instrumentation.xml:124
@@ -732,7 +758,7 @@
"run this step if you are using the JDK1.4 annotation. After this step is "
"successfully run, you decide either to use compile-time or load-time mode of "
"weaving."
-msgstr ""
+msgstr "A continuación puede ver un pedazo del destino Ant <literal>annoc</literal>. Ejecute este paso si está utilizando la anotación JDK1.4. Después de completar este paso exitosamente puede decidir el utilizar el modo en tiempo de compilación o en tiempo de carga al entretejer. "
#. Tag: programlisting
#: Instrumentation.xml:127
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Jbossaop.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Jbossaop.po 2008-11-18 04:45:36 UTC (rev 7157)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Jbossaop.po 2008-11-19 03:17:03 UTC (rev 7158)
@@ -8,7 +8,7 @@
"Project-Id-Version: Jbossaop\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-17 16:09+1000\n"
+"PO-Revision-Date: 2008-11-19 10:09+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -351,14 +351,13 @@
"aspects. You can attach your aspects to a specific Java class in your "
"application or you can use more complex compositional pointcuts to specify a "
"wide range of classes within one expression."
-msgstr ""
+msgstr "JBoss AOP tiene un gran grupo de expresiones de punto de corte que puede utilizar para definir varios puntos/eventos en su aplicación Java de manera que pueda aplicar sus aspectos. Puede adjuntar sus aspectos a una clase Java en especifico en su aplicación o puede utilizar puntos de corte más complejos para especificar un gran rango de clases dentro de una expresión. "
#. Tag: title
#: Jbossaop.xml:72
#, no-c-format
-#, fuzzy
msgid "Dynamic Aop"
-msgstr "Aop dinámico"
+msgstr "Aop dinámico "
#. Tag: para
#: Jbossaop.xml:73
@@ -370,6 +369,8 @@
"advice bindings at runtime. Getting an instance of <literal>org.jboss.aop."
"AspectManager.instance()</literal>, you can add your binding."
msgstr ""
+"Con JBoss AOP puede cambiar los enlaces advice e interceptor en tiempo de ejecución. También puede sacara del resgitro enlaces ya existentes y desplegar en caliente nuevos enlaces si los puntos dados han sido instrumentados. También hay una API en tiempo de ejecución para añadir enlaces advice en tiempo de ejecución. Al obtener una instancia de <literal>org.jboss.aop."
+"AspectManager.instance()</literal>, puede añadir su enlace."
#. Tag: programlisting
#: Jbossaop.xml:76
@@ -395,12 +396,14 @@
"AspectManager will iterate through ever loaded class to see if the pointcut "
"expression matches any of the joinpoints within those classes."
msgstr ""
+"Primero asigne un <literal>AdviceBinding</literal> pasando una expresión de punto de corte. Luego añada el interceptor por medio de su clase y luego añada el enlace a por medio del AspectManager. Cuando se añade el enlace el "
+"AspectManager iterarán a través de las clases cargadas para ver si la expresión del punto de corte coincide con alguno de los puntos de unión dentro de esas clases."
#. Tag: title
#: Jbossaop.xml:80
#, no-c-format
msgid "Per Instance AOP"
-msgstr ""
+msgstr "AOP por instancia"
#. Tag: para
#: Jbossaop.xml:81
@@ -409,6 +412,8 @@
"Any class that is instrumented by JBoss AOP, is forced to implement the "
"<literal>org.jboss.aop.Advised</literal> interface."
msgstr ""
+"Cualquier clase que sea instrumentada por JBoss AOP, es forzada a implementar la interfaz "
+"<literal>org.jboss.aop.Advised</literal>."
#. Tag: programlisting
#: Jbossaop.xml:84
@@ -443,7 +448,7 @@
"The InstanceAdvisor is the interesting interface here. InstanceAdvisor "
"allows you to insert Interceptors at the beginning or the end of the class's "
"advice chain."
-msgstr ""
+msgstr "Aquí la interfaz interesante es el InstanceAdvisor. InstanceAdvisor le permite insertar interceptores al principio o al final de la cadena advice de la clase. "
#. Tag: programlisting
#: Jbossaop.xml:88
@@ -490,6 +495,8 @@
"executed. You can also reference <literal>stack</literal>s and insert/append "
"full stacks into the pre/post chains."
msgstr ""
+"Así que hay tres cadenas advice que se ejecutan consecutivamente en la misma pila de llamadas java. Esos interceptorrs que se añaden con el método <literal>insertInterceptor()</literal> para la instancia de objeto dada se ejecutan primero. Después esos advices/interceptores que fueron enlazados utilizando "
+"<literal>bind</literal>s - enlaces - comunes. Finalmente, se ejecutan esos interceptores que se añadieron con el método <literal>appendInterceptor()</literal> a la instancia del objeto. También puede referenciar <literal>stack</literal>s e insertar/agreagar pilas completas en las pre/post cadenas."
#. Tag: title
#: Jbossaop.xml:92
@@ -505,6 +512,8 @@
"instrumented. You can force instrumentation with the <literal>prepare</"
"literal> functionality that declares in an xml file."
msgstr ""
+"El AOP dinámico no se puede utilizar a menos de que el punto de unión en particular haya sido instrumentado. Puede forzar la instrumentación con la funcionalidad <literal>prepare</"
+"literal> que declara en un archivo xml. "
#. Tag: title
#: Jbossaop.xml:96
@@ -518,7 +527,7 @@
msgid ""
"Annotations are only available in JDK 5.0, but using our annotation compiler "
"you can acheive similar functionality with JDK 1.4.2 as well."
-msgstr ""
+msgstr "Las anotaciones sólo están disponibles en JDK 5.0, pero utilizando nuestro compilador de anotaciones podemos lograr una funcionalidad similar con JDK 1.4.2 también. "
#. Tag: para
#: Jbossaop.xml:100
@@ -539,6 +548,17 @@
"that '@interface' is replaced by 'interface'. i.e. the similar annotation "
"type is a normal Java interface:"
msgstr ""
+"Las anotaciones tienen que mapear a un tipo de anotación type, en JDK 5.0 se definen así: "
+"<programlisting>\n"
+" package com.mypackage;\n"
+"\n"
+" public @interface MyAnnotation\n"
+" {\n"
+" String myString();\n"
+" int myInteger();\n"
+" }\n"
+" \n"
+"</programlisting> Los tipos de anotaciones a utilizar con el compilador de anotaciones son definidos en exactamente la misma manera para JDK 1.4.2, con la diferencia que '@interface' es reemplazado por 'interface'. i.e. el tipo de anotación similar es una interfaz Java normal:"
#. Tag: programlisting
#: Jbossaop.xml:102
@@ -566,19 +586,19 @@
msgid ""
"The syntax for using annotations in JDK 1.4.2 is almost exactly the same as "
"JDK 5.0 annotations except for these subtle differences:"
-msgstr ""
+msgstr "La sintaxis para utilizar anotaciones en JDK 1.4.2 es casi la misma que las anotaciones JDK 5.0 excepto por estas sutiles diferencias: "
#. Tag: para
#: Jbossaop.xml:107
#, no-c-format
msgid "they are embedded as doclet tags"
-msgstr ""
+msgstr "se encuentran incluidas como etiquetas doclet"
#. Tag: para
#: Jbossaop.xml:110
#, no-c-format
msgid "You use a double at sign, i.e. '@@'"
-msgstr ""
+msgstr "Utiliza un signo doble, por ejemplo '@@'"
#. Tag: para
#: Jbossaop.xml:113
@@ -587,7 +607,7 @@
"You MUST have a space after the tag name otherwise you will get a "
"compilation error. (This is the quirkiness of the QDox doclet compiler used "
"to compile the annotations.')"
-msgstr ""
+msgstr "Tiene que tener un espacio después del nombre de la etiqueta de otra manera obtendrá un error en la compilación (esa es la peculiaridad del compilador doclet QDox utilizado para compilar anotaciones). "
#. Tag: para
#: Jbossaop.xml:116
@@ -595,19 +615,19 @@
msgid ""
"You cannot import the annotation type, you must use the fully qualified name "
"of the interface."
-msgstr ""
+msgstr "No puede importar el tipo de anotación, debe utilizar el nombre completamente calificado de la interfaz."
#. Tag: para
#: Jbossaop.xml:119
#, no-c-format
msgid "You cannot specify default values for an annotation's value"
-msgstr ""
+msgstr "No puede especificar los valores predeterminados para un valor de una anotación. "
#. Tag: para
#: Jbossaop.xml:123
#, no-c-format
msgid "This example shows an annotated class in JDK 1.4.2:"
-msgstr ""
+msgstr "Este ejemplo muestra una clase anotada en JDK 1.4.2:"
#. Tag: programlisting
#: Jbossaop.xml:124
16 years, 2 months
JBoss Cache SVN: r7157 - enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES.
by jbosscache-commits@lists.jboss.org
Author: mospina
Date: 2008-11-17 23:45:36 -0500 (Mon, 17 Nov 2008)
New Revision: 7157
Modified:
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Architecture.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Configuration.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po
enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Troubleshooting.po
Log:
translation for Pojo cache in progress
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Architecture.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Architecture.po 2008-11-18 01:10:44 UTC (rev 7156)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Architecture.po 2008-11-18 04:45:36 UTC (rev 7157)
@@ -8,7 +8,7 @@
"Project-Id-Version: Architecture\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-13 10:00+1000\n"
+"PO-Revision-Date: 2008-11-18 11:04+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -125,7 +125,7 @@
#: Architecture.xml:42 Architecture.xml:85
#, no-c-format
msgid "Object mapping by reachability"
-msgstr ""
+msgstr "Mapeo de objetos por acceso"
#. Tag: para
#: Architecture.xml:43
@@ -140,6 +140,9 @@
"discussed above. In addition, the cache will map recursively the primitive "
"object fields into the corresponding cache nodes."
msgstr ""
+"Un objeto complejo por definición es un objeto que puede consistir de referencias compuestas de objetos. Una vez se declara \"prepared\" un objeto complejo (por ejemplo, un objeto <literal>Person</literal>), durante la operación <literal>putObject(Fqn fqn, "
+"Object pojo)</literal>, PojoCache añadirá una instancia <literal>CacheInterceptor</literal> al "
+"<literal>InstanceAdvisor</literal> asociado con ese objeto, como lo discutimos anteriormente. Además, el caché mapeará recursivamnete los campos primitivos de objetos en los correspondientes nodos de caché."
#. Tag: para
#: Architecture.xml:46
@@ -151,7 +154,7 @@
#: Architecture.xml:51
#, no-c-format
msgid "Create a tree node using <literal>fqn</literal>, if not yet existed."
-msgstr ""
+msgstr "Cree un árbol nodo utilizando <literal>fqn</literal>, si aún no existe."
#. Tag: para
#: Architecture.xml:56
@@ -160,6 +163,8 @@
"Go through all the fields (say, with an association <literal>java.lang."
"reflect.Field</literal> type field) in POJO,"
msgstr ""
+"Revise todos los campos (por ejemplo los campos de tipo <literal>java.lang."
+"reflect.Field</literal> con una asociación) en POJO, "
#. Tag: para
#: Architecture.xml:61
@@ -171,6 +176,9 @@
"types supported now: <literal>String, Boolean, Double, Float, Integer, Long, "
"Short, Character.</literal>"
msgstr ""
+"Si es un tipo primitivo, el valor del campo se almacenará bajo <literal>fqn</literal> con <literal>(key, value)</literal> de <literal>"
+"(field.getName(), field.getValue()).</literal> Los siguientes son tipos primitivos soportados: <literal>String, Boolean, Double, Float, Integer, Long, "
+"Short, Character.</literal>"
#. Tag: para
#: Architecture.xml:66
@@ -179,13 +187,13 @@
"If it is a non-primitive type, creates a child <literal>FQN</literal> and "
"then recursively executes another <literal>pubObject</literal> until it "
"reaches all primitive types."
-msgstr ""
+msgstr "Si es de tipo no-primitivo, crea un hijo <literal>FQN</literal> y luego ejecuta de manera recursiva otro <literal>pubObject</literal> hasta que alcanza todos los tipos primitivos."
#. Tag: para
#: Architecture.xml:73
#, no-c-format
msgid "Following is a code snippet that illustrates this mapping process"
-msgstr ""
+msgstr "A continuación encontrará un pedazo de código que ilustra este proceso de mapeo"
#. Tag: programlisting
#: Architecture.xml:76
@@ -221,6 +229,8 @@
"literal> call, the resulting tree node will schematically look like the "
"cache node in the following figures:"
msgstr ""
+"Vamos a tomar un ejemplo de definición de clase POJO del apéndice en donde tenemos un objeto <literal>Person</literal> que tiene tipos compuestos no-primitivos (por ejemplo, List y Address). Después de que ejecutamos la llamada <literal>putObject</"
+"literal>, el árbol de nodos resultante esquemáticamente se verá como el nodo caché en las siguientes figuras:"
#. Tag: programlisting
#: Architecture.xml:80
@@ -257,6 +267,14 @@
"will have <literal>Zip</literal> , <literal>Street</literal> , etc. stored "
"there)."
msgstr ""
+"Más adelante abordaremos en detalle las APIs PojoCache. Observe la ilustración del mapeo de objetos por acceso en la siguiente figura. El "
+"fqn <literal>/aop/joe</literal> es asociado con el POJO <literal>joe</"
+"literal>. Después bajo ese fqn, hay tres nodos hijos: <literal>addr,"
+"</literal><literal>skills,</literal> y <literal>languages.</literal> Si ve la declaración de clase <literal>Person</literal> encontrará que <literal>addr</literal> es una clase <literal>Address</literal>, "
+"<literal>skills</literal> es un <literal>Set</literal> y "
+"<literal>languages</literal> es un tipo <literal>List</literal>. Debido a que son no-primitivos, se insertan de manera recursiva bajo el objeto padre (<literal>joe</literal>) hasta que se alcancen todos los tipos primitivos. De esta manera, "
+"hemos dividido la gráfica objeto en tres vistas las cuales caben perfectamente en nuestra estructura interna. También observe que todos los tipos primitivos se almacenarán dentro del HashMap respectivo del nodo (por ejemplo, <literal>addr</literal> "
+"tendrá <literal>Zip</literal> , <literal>Street</literal> , etc. almacenados allí)."
#. Tag: para
#: Architecture.xml:92
@@ -266,7 +284,7 @@
"feature that we just explained. Notice how a <literal>Person</literal> "
"object (e.g., <literal>joe</literal>) that has complex object references "
"will be mapped into the underlying cache store as explained above."
-msgstr ""
+msgstr "Aquí tiene un pedazo del código para demostrar el mapeo de objetos por acceso que acabamos de explicar. Observe como un objeto <literal>Person</literal> (por ejemplo, <literal>joe</literal>) que tiene referencias complejas de objetos será mapeado en el almacenamiento caché subyacente como se explicó anteriormente. "
#. Tag: programlisting
#: Architecture.xml:95
@@ -334,7 +352,7 @@
"instantiating the <literal>PojoCache</literal> , configuring, and starting "
"the cache instance. Then, a user creates the aspectized POJO that will be "
"put into the cache using <literal>putObject()</literal> API."
-msgstr ""
+msgstr "Observe que un uso típico de <literal>PojoCache</literal> implica el instanciar el <literal>PojoCache</literal> , configurando e iniciando la instancia caché. Después un usuario crea el POJO aspectized que se pondrá en el caché utilizando la API <literal>putObject()</literal>. "
#. Tag: para
#: Architecture.xml:99
@@ -349,6 +367,10 @@
"replicated GUI point of view. Details of Collection class support will be "
"given later."
msgstr ""
+"Además, PojoCache también soporta get/set con el tipo parámetro de algunas clases <literal>Collection</literal> (por ejemplo, <literal>List</literal> , "
+"<literal>Map</literal> y <literal>Set</literal> ) automáticamente. Por "
+"ejemplo, el siguiente pedazo de código además del ejemplo anterior desparará PojoCache para administrar los estados para la lista de <literal>Languages</literal> también. La siguiente figura ilustra la estructura del nodo desde el punto de vista del GUI "
+"replicado. Más adelante proporcionaremos los detalles del soporte de clase de colección."
#. Tag: programlisting
#: Architecture.xml:102
@@ -368,13 +390,13 @@
#: Architecture.xml:104
#, no-c-format
msgid "Schematic illustration of List class mapping"
-msgstr ""
+msgstr "Ilustración esquemática del mapeo de clase List"
#. Tag: title
#: Architecture.xml:111
#, no-c-format
msgid "Object relationship management"
-msgstr ""
+msgstr "Administración de relaciones de objetos"
#. Tag: para
#: Architecture.xml:112
@@ -389,7 +411,7 @@
"mapping will be needed outside of the cache system to express the object "
"relationship. PojoCache, in contrast, can manage object relationship "
"transparently for users."
-msgstr ""
+msgstr "Como lo hemos mencionado anteriormente, el sistema de caché tradicional no soporta la administración de relaciones de objetos durante la serialización (ya sea al almacenamiento de datos persistentes o replicados a los otros nodos en memoria). Los ejemplos de relaciones de objetos son como un objeto de dirección que es compartido por los miembros de una casa y una relación padre e hijo. Todas estas relaciones se perderán una vez que los objetos sean replicados o persistidos. Como sonsecuencia se necesitará un mapeo explícito por fuera del sistema del caché para expresar la relación del objeto. Por otro lado PojoCache puede administrar la relación de objetos de manera transparente para los usuarios. "
#. Tag: para
#: Architecture.xml:115
@@ -402,6 +424,8 @@
"referenced <literal>fqn</literal> will be stored there to redirect any query "
"and update to the original node."
msgstr ""
+"Durante el proceso de mapeo verificaremos si cualquier objeto asociado es referenciado de manera múltiple o circular. Un mecanismo de conteo de referencias ha sido implementado asociandose con el <literal>CacheInterceptor</"
+"literal>. Si un nuevo objeto creado en el caché referenciaba otro POJO entonces se almacenará un <literal>fqn</literal> referenciado para redireccionar cualquier petición o actualización al nodo original. "
#. Tag: para
#: Architecture.xml:118
@@ -416,12 +440,17 @@
"we will keep track of the reference counting for the sub-object "
"<literal>addr.</literal>"
msgstr ""
+"Para ver un ejemplo, digamos que múltiples objetos <literal>Person</literal>as "
+"(\"joe\" y \"mary\") pueden tener la misma <literal>Address</literal> "
+"(por ejemplo, una casa). Gráficamente se verá así en el árbol de nodos. Como lo vimos en la sección anterior sobre el mapeo por acceso, el POJO mapeará de manera recursiva en el caché. Sin embargo, cuando detectamos una referencia múltiple (en este caso, la <literal>Address</literal>), "
+"vamos a rastrear el conteo de referencias para el sub-objeto "
+"<literal>addr.</literal>"
#. Tag: title
#: Architecture.xml:122
#, no-c-format
msgid "Schematic illustration of object relationship mapping"
-msgstr ""
+msgstr "Ilustración esquemática del mapeo de relaciones de objetos"
#. Tag: para
#: Architecture.xml:129
@@ -429,7 +458,7 @@
msgid ""
"In the following code snippet, we show programmatically the object sharing "
"example."
-msgstr ""
+msgstr "En el siguiente pedazo de código mostramos programáticamente el ejemplo donde se comparten objetos."
#. Tag: programlisting
#: Architecture.xml:132
@@ -521,6 +550,9 @@
"<literal>mary</literal> should still have reference the same "
"<literal>Address</literal> object in the cache store."
msgstr ""
+"Observe que después de que removemos la instancia <literal>joe</literal> del caché, "
+"<literal>mary</literal> todavía debe tener la referencia al mismo objeto "
+"<literal>Address</literal> en el almacenamiento de caché."
#. Tag: para
#: Architecture.xml:136
@@ -533,6 +565,9 @@
"literal> and <literal>mary</literal> under cache management as above. Then, "
"we failover to <literal>cache2.</literal> Here is the code snippet:"
msgstr ""
+"Para ilustrar un poco más esta administración de relaciones vamos a examinar el código Java bajo un entorno replicado. Imagine que tenemos dos instancias caché separadas en el clúster (<literal>cache1</literal> and <literal>cache2</"
+"literal>). Digamos que en la primera instancia del caché ponemos a <literal>joe</"
+"literal> y <literal>mary</literal> bajo la administración del caché. Luego cuando conmutamos en caso de fallo a <literal>cache2.</literal> aqui está el pedazo de código:"
#. Tag: programlisting
#: Architecture.xml:139
@@ -594,7 +629,7 @@
#: Architecture.xml:140
#, no-c-format
msgid "Object inheritance hierarchy"
-msgstr ""
+msgstr "Jerarquía de herencia de objetos"
#. Tag: para
#: Architecture.xml:141
@@ -607,6 +642,9 @@
"cache, all the class attributes of <literal>Person</literal> can be managed "
"as well."
msgstr ""
+"PojoCache preserva la jerarquía de herencia de objetos POJO de manera automática. Por "
+"ejemplo, si un <literal>Student</literal> extiende <literal>Person</literal> "
+"con un campo adicional <literal>year</literal> (vea la definición de POJO en el apéndice), luego una vez que se pone a <literal>Student</literal> en el caché, se puedene administrar todos los atributos de la clase de <literal>Person</literal>."
#. Tag: para
#: Architecture.xml:144
@@ -614,7 +652,7 @@
msgid ""
"Following is a code snippet that illustrates how the inheritance behavior of "
"a POJO is maintained. Again, no special configuration is needed."
-msgstr ""
+msgstr "A continuación encontrará un pedazo de código que ilustra la manera en que se mantiene el comportamiento de herencia de un POJO. De nuevo no se necesita ninguna configuración especial. "
#. Tag: programlisting
#: Architecture.xml:147
@@ -656,7 +694,7 @@
#: Architecture.xml:148
#, no-c-format
msgid "Collection class proxy"
-msgstr ""
+msgstr "Proxy de clase Collection"
#. Tag: para
#: Architecture.xml:149
@@ -678,6 +716,11 @@
"retrieve this proxy reference and use this reference to perform POJO "
"operations."
msgstr ""
+"Las clases POJO que heredan de <literal>Set</literal> , <literal>List</"
+"literal> y <literal>Map</literal> se tratan como \"aspectized\" de manera automátic. Es decir los usuarios no necesitan declararlas como \"prepared\" en el archivo de configuración xml o por medio de anotaciones. Ya que no se nos permite instrumentar "
+"la biblioteca del sistema Java, vamos a utilizar un enfoque proxy. Es decir cuando nos encontramos con cualquier instancia Collection vamos a: <itemizedlist> <listitem> "
+"<para>Crear una instancia proxy Collection y vamos a ponerla en el caché (en vez de la referencia original). El mapeo de los elementos Collection elements aún se llevará acabo de manera recursiva como se esperaba.</para> </listitem> <listitem> "
+"<para>Si la instancia Collection es un sub-objeto, por ejemplo, dentro de otro POJO, cambiaremos la referencia original con la nueva referencia proxy para promover el uso transparente.</para> </listitem> </itemizedlist> Para obtener la referencia proxy, los usuarios pueden utilizar otro <literal>getObject</literal> para recuperar esta referencia proxy y utilizar esta referencia para realizar operaciones POJO."
#. Tag: para
#: Architecture.xml:160
@@ -685,7 +728,7 @@
msgid ""
"Here is a code snippet that illustrates the usage of a Collection proxy "
"reference:"
-msgstr ""
+msgstr "Este es un pedazo de código que ilustra el uso de una referencia proxy Collection:"
#. Tag: programlisting
#: Architecture.xml:163
@@ -719,7 +762,7 @@
msgid ""
"Here is another snippet to illustrate the dynamic swapping of the Collection "
"reference when it is embedded inside another object:"
-msgstr ""
+msgstr "Aqui tiene otro pedazo que ilustra el cambio dinámico de la referencia Collection cuando se encuentra incluida dentro de otro proyecto:"
#. Tag: programlisting
#: Architecture.xml:167
@@ -755,7 +798,7 @@
msgid ""
"As you can see, <literal>getLanguages</literal> simply returns the field "
"reference that has been swapped out for the proxy reference counterpart."
-msgstr ""
+msgstr "Como lo puede ver, <literal>getLanguages</literal> simplemente retorna la referencia del campo que ha siso cambiada por la referencia proxy."
#. Tag: para
#: Architecture.xml:171
@@ -766,6 +809,8 @@
"since we will update the in-memory copy of that reference during detachment. "
"Below is a code snippet illustrating this:"
msgstr ""
+"Finalmente, cuando remueve una referencia Collection del caché (por ejemplo, por medio de "
+"<literal>removeObject</literal>), todavía puede utilizar la referencia proxy ya que actualizaremos la copia en la memoria de esa referencia durante el desprendimiento. Este pedazo de código ilustra esto:"
#. Tag: programlisting
#: Architecture.xml:174
@@ -808,7 +853,7 @@
"Use of Collection class in PojoCache helps you to track fine-grained changes "
"in your collection fields automatically. However, current implementation has "
"the follow limitation that we plan to address soon."
-msgstr ""
+msgstr "El uso de la clase Collection en PojoCache le ayuda a rastrear cambios detallados en sus campos collection de manera automática. Sin embargo, la implementación actual tiene la siguiente limitación que tenemos en mente abordar."
#. Tag: para
#: Architecture.xml:179
@@ -823,6 +868,10 @@
"ArrayList implementation. The Map interface maps to java.util.HashMap "
"implementation."
msgstr ""
+"Actualmente sólo soportamos una implementación limitada de clases Collection. Es decir que soportamos APIs en List, Set y Map. Sin embargo, ya que las APIs no estipulan restricciones como el valor o la clave NULL, esto hace que el mapeo de una instancia de usuario a nuestro proxy sea un poco dificil. Por ejemplo, ArrayList permitiría un valor NULL "
+"pero otras implementaciones no lo permitirían. La interfaz Set mapea a la implementación "
+"java.util.HashSet. La interfaz List mapea a la implementación java.util."
+"ArrayList. La interfaz Map mapea a la implementación java.util.HashMap."
#. Tag: para
#: Architecture.xml:182
@@ -833,5 +882,5 @@
"slow. Performance between Set, Map and List collections also vary. Adding "
"items to a Set is slower than a List or Map, since Set does not allow "
"duplicate entries."
-msgstr ""
+msgstr "Otro asunto relacionado es el rendimiento esperado. Por ejemplo, la implementación actual es ordenada de manera que los insert/delete de Collection se hagan despacio. En rendimiento entre las colecciones Set, Map y List también varian. El añadir cosas a Set toma más tiempo que añadirlas a List o Map ya que Set no permite entradas duplicadas. "
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Configuration.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Configuration.po 2008-11-18 01:10:44 UTC (rev 7156)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Configuration.po 2008-11-18 04:45:36 UTC (rev 7157)
@@ -8,7 +8,7 @@
"Project-Id-Version: Configuration\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-13 10:03+1000\n"
+"PO-Revision-Date: 2008-11-18 14:15+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -32,13 +32,13 @@
"JGroups stack, for example, are still the same. There are two differences, "
"however, when using the xml file--- configuring as a MBean service and "
"eviction policy."
-msgstr ""
+msgstr "Ya que PojoCache hereda de TreeCache, los atributos del archivo de configuración xml son casi idénticos a los del último. Atributos tal como el modo de replicación, el administrador de transacciones, la política de eliminación, el cargador de caché y la pila JGroups, por ejemplo, son aún los mismos. Sin embargo, hay dos diferencias al utilizar el archivo xml--- configurando como un servicio MBean y la política de eliminación."
#. Tag: title
#: Configuration.xml:9
#, no-c-format
msgid "PojoCache MBean service"
-msgstr ""
+msgstr "Servicio MBean PojoCache"
#. Tag: para
#: Configuration.xml:10
@@ -51,12 +51,17 @@
"\"jboss.cache:service=PojoCache\"></programlisting> You can modify the "
"object service name to your liking, of course."
msgstr ""
+"PojoCache también se puede desplegar como un servicio MBean bajo JBoss Application "
+"Server. Sin embargo, necesitará utilizar la clase correcta para instanciar. Por "
+"ejemplo, este es un pedazo de código para el atributo MBean en el archivo xml: "
+"<programlisting><mbean code=\"org.jboss.cache.aop.PojoCache\" name="
+"\"jboss.cache:service=PojoCache\"></programlisting> Puede modificar el nombre del servicio de objetos de acuerdo a sus preferencias."
#. Tag: title
#: Configuration.xml:14
#, no-c-format
msgid "PojoCache eviction policy"
-msgstr ""
+msgstr "Política de eliminación de PojoCache"
#. Tag: para
#: Configuration.xml:15
@@ -70,6 +75,11 @@
"world, a unit is a FQN node, while in the aop world, the concept of a unit "
"is an object (which can have multiple nodes and children nodes!)."
msgstr ""
+"PojoCache también proporciona una política de eliminación, <literal>org.jboss.cache.aop."
+"eviction.AopLRUPolicy</literal> , que es una subclase de <literal>org.jboss."
+"cache.eviction.LRUPolicy</literal> (con los mismos parámetros de configuración). "
+"La razón por la cual necesitamos una implementación diferente es porque la eliminación en "
+"PojoCache es diferente del TreeCache normal. En el mundo del caché normal, una unidad es un nodo FQN, mientras que en el mundo aop, el concepto de una unidad es un objeto (el cual puede tener ¡múltiples nodos e hijos nodos!)."
#. Tag: para
#: Configuration.xml:18
@@ -83,6 +93,8 @@
"reference. So all operations will succeed but then a user has no way of "
"knowing that it is merely updating the in-memory reference!"
msgstr ""
+"Además una vez que un usuario obtiene una referencia POJO se supone que todo es transparente, por ejemplo, operaciones de actualización y recuperación de caché. Pero si se elimina un objeto eso significa que que no hay un <literal>CacheInterceptor</"
+"literal> para el POJO y el contenido no es interceptado por el caché. En su lugar, todo acceso de una operación será encausado a la referencia en memoria. Así que todas las operaciones tendrán éxito pero entonces el usuario no tiene manera de saber que simplemente ¡está actualizando la referencia en memoria!"
#. Tag: para
#: Configuration.xml:21
@@ -96,4 +108,6 @@
"persistent all time unless a specific user-based <literal>removeObject</"
"literal> is called."
msgstr ""
+"Para solucionar este problema actualmente requerimos que la política de eliminación sea utilizada en combinación con un cargador de caché para persistir los datos. Puede ser completamente de persistencia o de pasivación (por ejemplo, solo persiste cuando se elimina). De esta manera, cuando el nodo no está disponible será recuperado del almacenamiento persistente. La desventaja es que el POJO no será transitorio, por ejemplo, siempre es persistente a menos de que se llame un usuario basado <literal>removeObject</"
+"literal> especifico."
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po 2008-11-18 01:10:44 UTC (rev 7156)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Introduction.po 2008-11-18 04:45:36 UTC (rev 7157)
@@ -8,7 +8,7 @@
"Project-Id-Version: Introduction\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2008-11-13 10:11+1000\n"
+"PO-Revision-Date: 2008-11-18 13:54+1000\n"
"Last-Translator: Angela Garcia\n"
"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
@@ -228,7 +228,7 @@
"modified and under transaction context, pojo2 is not under the same "
"transaction context. So you can start another transaction on pojo2 and it "
"will succeed."
-msgstr ""
+msgstr "Transacción. La operación POJO se puede llevar a acabo una vez que se ha especificado apropiadamente el TransactionManager. Cuando el usuario deshaga una transacción entonces también se desharán todas las operaciones POJO también. Observe que el contexto de transacción solo aplica a nivel de nodo. En otras palabras en una gráfica de objeto complejo en donde tiene múltiples sub-nodos, solo los nodos (o campos) que un usuario accede se encuentran bajo el contexto de la transacción. Para dar un ejemplo, si tiene un POJO que tiene referencias de campo en otros dos POJOs (digamos que pojo1 y pojo2). Cuando pojo1 se modifica y bajo el contexto de transacción, pojo2 no se encuentra bajo el mismo contexto de transacción. Así que puede iniciar otra transacción en pojo2 y tendrá éxito. "
#. Tag: para
#: Introduction.xml:77
@@ -238,7 +238,7 @@
"transaction is batched. That is, the update is not performed until the "
"<literal>commit</literal> phase. And if it is rolled back, we will simply "
"discard the modifications."
-msgstr ""
+msgstr "Además operaciones detalladas (replicación o persistencia) bajo transacción se hacen en tandas. En otras palabras, la actualización no se realiza si no hasta la fase <literal>commit</literal>. En caso de que se deshaga la operación simplemente deshecharemos las modificaciones. "
#. Tag: para
#: Introduction.xml:82
@@ -255,6 +255,9 @@
"\"Region\" is used to define the eviction policy, if you define a \"Region\" "
"inside a POJO sub-tree, it may not be desirable."
msgstr ""
+"Política de eliminación. PojoCache soporta la política de eliminación que puede eliminar todo un objeto POJO (y cualquier referencia de objeto de campo de manera recursiva). Actualmente hay una clase de política de eliminación llamada <literal>org.jboss.cache.aop.eviction."
+"AopLRUPolicy</literal> (que es sub-clase de <literal>org.jboss.cache."
+"eviction.LRUPolicy</literal>). Los parámetros de configuración son los mismos que los de su contraparte TreeCache. Observe que es necesario definir cuidadosamente el concepto de \"Region\" en la eliminación en la parte superior del nivel FQN del objeto. De otra manera, la política de eliminación no operará correctamente. Es decir ya que la \"Region\" se utiliza para definir la política de eliminación puede que no sea muy conveniente el definir una \"Region\" dentro de un sub-árbol POJO. "
#. Tag: para
#: Introduction.xml:87
@@ -268,6 +271,8 @@
"accordingly to the internal TreeCache nodes. This feature is explained in "
"full details later."
msgstr ""
+"Caché de objetos por acceso, por ejemplo, el mapeo recursivo de objetos en el almacenamiento de caché. Por ejemplo, si un POJO tiene una referencia a otro POJO, <literal>PojoCache</literal> también administrará de manera transparente los estados de los sub-objetos. Durante la llamada inicial <literal>putObject()</literal>, "
+"<literal>PojoCache</literal> atravesará el árbol de objetos y lo mapeará de acuerdo con esto a los nodos TreeCache internos. Esta funcionalidad se explica detalladamente más adelante. "
#. Tag: para
#: Introduction.xml:92
@@ -278,7 +283,7 @@
"declare any object relationship (e.g., one-to-one, or one-to-many) to use "
"the cache. Therefore, there is no need to specify object relationship via "
"xml file."
-msgstr ""
+msgstr "Manejo de referencias a objetos. En PojoCache, las referencias a objetos múltiples y recursivas se manejan automáticamente. Es decir que el usuario no necesita declarar ninguna relación de objetos (por ejemplo, uno-a-uno o uno-a-muchos) para utilizar el caché. Por lo tanto no hay necesidad de especificar la relación de objetos por medio de un archivo xml. "
#. Tag: para
#: Introduction.xml:97
@@ -292,6 +297,9 @@
"literal>). The objects retrieved from <literal>joe.getAddress()</literal> "
"and <literal>mary.getAddress()</literal> should be identical."
msgstr ""
+"Soporte automático de identidad de objetos. En PojoCache, cada objeto es identificado de manera única por medio de un FQN interno. El cliente puede determinar la ecualidad del objeto por medio del método <literal>equal</literal>. Por ejemplo, un objeto tal como <literal>Address</literal> puede ser referenciado de manera múltiple por dos <literal>Person</literal>as (por ejemplo, <literal>joe</literal> y <literal>mary</"
+"literal>). Los objetos recuperados de <literal>joe.getAddress()</literal> "
+"y <literal>mary.getAddress()</literal> deben ser idénticos."
#. Tag: para
#: Introduction.xml:100
@@ -301,6 +309,8 @@
"as well, and its identity is still preserved when retrieved from both places "
"(after replication)."
msgstr ""
+"Finalmente, un POJO se puede almacenar bajo múltiples <code>Fqn</code>s en el caché y su identidad aún se preserva cuando se recupera de ambos lugares "
+"(después de la replicación)."
#. Tag: para
#: Introduction.xml:105
@@ -313,6 +323,9 @@
"g., <literal>putObject</literal> call), the attributes in base class "
"<literal>Person</literal> is \"aspectized\" as well."
msgstr ""
+"Herencia de relaciones. PojoCache preserva la jerarquía de herencia POJO después de que el objeto se almacena en el caché. Por ejemplo, si una clase "
+"<literal>Student</literal> hereda de una clase <keycode>Person</keycode>, una vez que un objeto <literal>Student</literal> sea mapeado a PojoCache (por ejemplo, llamada <literal>putObject</literal>), los atributos en la clase base "
+"<literal>Person</literal> se \"aspectiza\" también."
#. Tag: para
#: Introduction.xml:110
@@ -323,7 +336,7 @@
"them either as a plain POJO or a sub-object to POJO without declaring them "
"as \"aspectized\". In addition, it supports runtime swapping of the proxy "
"reference as well."
-msgstr ""
+msgstr "Soporta automáticamente las clases Collection (por ejemplo, los objetos basados List, Set y Map) sin declararlas como aop-enabled. Es decir que las puede utilizar como POJO simple o como un sub-objeto para POJO sin declararlas como \"aspectizadas\". Además también soporta el intercambio en tiempo de ejecución de la referencia proxy."
#. Tag: para
#: Introduction.xml:115
@@ -337,6 +350,12 @@
"JBossAop system classloader. A user can treat the pre-generated classes as "
"regular ones and use PojoCache in a non-intrusive way."
msgstr ""
+"Soporta la pre-compilación de POJOs. El último JBossAop tiene una funcionalidad para pre-"
+"compilar (llamada <literal>aopc</literal>, también llamado modo en tiempo de compilación en "
+"JBossAop) y genera el código byte necesario para el sistema AOP. Al pre-"
+"compilar los POJOs especificados por el usuario, no hay necesidad de un archivo adicional de declaración"
+" (por ejemplo, <literal>jboss-aop.xml</literal> ) o de especificar un cargador de clase del sistema "
+"JBossAop. Un usuario puede tratar las clases pre-generadas como normales y utilizar PojoCache de una manera no-intrusiva."
#. Tag: para
#: Introduction.xml:118
@@ -345,13 +364,13 @@
"This provides easy integration to existing Java runtime programs, "
"eliminating the need for ad-hoc specification of a system class loader, for "
"example. Details will be provided later."
-msgstr ""
+msgstr "Esto proporciona una fácil integración con los programas Java ya existentes en tiempo de ejecución, eliminando la necesidad de especificaciones ad-hoc de un cargador de clase del sistema, por ejemplo. Más detalles sobre esto más adelante. "
#. Tag: para
#: Introduction.xml:123
#, no-c-format
msgid "POJO needs not implement the <code>Serializable</code> interface."
-msgstr ""
+msgstr "POJO no necesita implementar la interfaz <code>Serializable</code>"
#. Tag: para
#: Introduction.xml:128
@@ -364,6 +383,9 @@
"literal> file declaration for POJOs, if annotation is preferred. The JDK5.0 "
"annotation will be supported in the next release."
msgstr ""
+"Soporta el uso de anotaciones. Desde el lanzamiento 1.2.3, PojoCache también soporta la declaración de POJO por medio de anotaciones bajo JDK1.4. JBossAop "
+"proporciona un precompilador de anotaciones que un usuario puede utilizar para pre-procesar la anotación. Como resultado no habrá necesidad de declarar el archivo <literal>jboss-aop.xml</"
+"literal> para los POJOs, si prefiere las anotaciones. La anotación JDK5.0 se soportará en el próximo lanzamiento."
#. Tag: para
#: Introduction.xml:133
@@ -373,13 +395,13 @@
"cache, the POJO object is mapped into the cache store behind the scene. "
"Client will have no need to manage any object relationship and cache "
"contents synchronization."
-msgstr ""
+msgstr "De fácil uso y transparencia. Una vez se ha declarado que un POJO es administrado por el caché, el objeto POJO es mapeado en el almacenamiento caché. Los clientes no tendran la necesidad de administrar ninguna relación de objetos ni la sincronización del contenido del caché. "
#. Tag: title
#: Introduction.xml:138
#, no-c-format
msgid "Usage"
-msgstr ""
+msgstr "Uso"
#. Tag: para
#: Introduction.xml:139
@@ -390,7 +412,7 @@
"it programmatically or through an external xml file. Finally, you call the "
"cache life cycle method to start the cache. Below is a code snippet that "
"creates and starts the cache through an external xml file:"
-msgstr ""
+msgstr "Para utilizar PojoCache es similar a su contraparte TreeCache. Básicamente, primero usted instancia un PojoCache. Luego puede configurarlo programáticamente o por medio de un archivo xml externo. Finalmente, llama el método de ciclo de vida caché para iniciar el caché. A continuación verá un pedazo de código que crea e inicia el caché por medio de un archivo xml externo:"
#. Tag: programlisting
#: Introduction.xml:140
@@ -418,7 +440,7 @@
#: Introduction.xml:142
#, no-c-format
msgid "Requirement"
-msgstr ""
+msgstr "Requerimiento"
#. Tag: para
#: Introduction.xml:143
@@ -428,6 +450,9 @@
"JDK50. For JDK1.4, it requires the following libraries (in addition to jboss-"
"cache.jar and the required libraries for the plain TreeCache) to start up:"
msgstr ""
+"Actualmente <literal>PojoCache</literal> es soportado en JDK1.4 y"
+"JDK50. Para JDK1.4, requiere las siguientes bibliotecas (ademas de jboss-"
+"cache.jary las bibliotecas requeridas para el TreeCache simple) para iniciar:"
#. Tag: para
#: Introduction.xml:148
@@ -439,13 +464,13 @@
#: Introduction.xml:153
#, no-c-format
msgid "jboss-aop.jar. Main JBossAop library."
-msgstr ""
+msgstr "jboss-aop.jar. Biblioteca JBossAop principal."
#. Tag: para
#: Introduction.xml:156
#, no-c-format
msgid "javassist.jar. Java byte code manipulation library."
-msgstr ""
+msgstr "javassist.jar. Biblioteca de manipulación de código byte Java."
#. Tag: para
#: Introduction.xml:159
@@ -457,7 +482,7 @@
#: Introduction.xml:162
#, no-c-format
msgid "qdox.jar. Javadoc parser for annotation."
-msgstr ""
+msgstr "qdox.jar. Analizador sintáctico Javadoc para anotaciones."
#. Tag: para
#: Introduction.xml:167
@@ -467,4 +492,7 @@
"jboss-cache.jar with jboss-cache-jdk50.jar and jboss-aop.jar with jboss-aop-"
"jdk50.jar from lib-50 directory."
msgstr ""
+"Para JDK5.0, además de las bibliotecas anteriores, necesitará reemplazar "
+"jboss-cache.jar con jboss-cache-jdk50.jar y jboss-aop.jar con jboss-aop-"
+"jdk50.jar del directorio lib-50."
Modified: enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Troubleshooting.po
===================================================================
--- enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Troubleshooting.po 2008-11-18 01:10:44 UTC (rev 7156)
+++ enterprise-docs/tags/JBoss_EAP_4_3/Cache_Pojo_Cache_Guide/es-ES/Troubleshooting.po 2008-11-18 04:45:36 UTC (rev 7157)
@@ -1,24 +1,26 @@
+# translation of Troubleshooting.po to
# Language /tmp/mike/JBEAP420/Cache translations for JBEAP package.
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
# Automatically generated, 2007.
#
msgid ""
msgstr ""
-"Project-Id-Version: JBEAP 420\n"
+"Project-Id-Version: Troubleshooting\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2008-09-21 04:57+0000\n"
-"PO-Revision-Date: 2001-02-09 01:25+0100\n"
-"Last-Translator: Automatically generated\n"
-"Language-Team: none\n"
+"PO-Revision-Date: 2008-11-18 14:24+1000\n"
+"Last-Translator: Angela Garcia\n"
+"Language-Team: <en(a)li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: KBabel 1.11.4\n"
#. Tag: title
#: Troubleshooting.xml:5
#, no-c-format
msgid "TroubleShooting"
-msgstr ""
+msgstr "Resolución de problemas"
#. Tag: para
#: Troubleshooting.xml:6
@@ -28,6 +30,9 @@
"page=PojoCacheTroubleshooting\">PojoCache wiki troubleshooting page</ulink>. "
"Please refer it first. We will keep adding troubleshooting tips there."
msgstr ""
+"Mantenemos una página wiki para resolución de problemas de PojoCache en <ulink url=\"http://wiki.jboss.org/wiki/Wiki.jsp?"
+"page=PojoCacheTroubleshooting\"></ulink>. "
+"Consúltela primero. Allí seguiremos añadiendo tips para resolución de problemas."
#. Tag: para
#: Troubleshooting.xml:9
@@ -38,3 +43,6 @@
"page</ulink> . Please check it for details. If you have discovered "
"additional issues, please report it there as well."
msgstr ""
+"Todos los asuntos que falta están documentados en <ulink url=\"http://"
+"jira.jboss.com/jira/secure/BrowseProject.jspa?id=10051\">la página JBossCache Jira</ulink>. Consúltela para obtener mayores detalles. Si encuentra algun otro problema lo puede reportar allí también. "
+
16 years, 2 months