JBoss Cache SVN: r6766 - in core/trunk/src: main/java/org/jboss/cache/interceptors and 6 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 19:39:45 -0400 (Fri, 19 Sep 2008)
New Revision: 6766
Added:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyAssignmentStateTransferTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationRejoinTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithPassivationTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java
Removed:
core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java
Modified:
core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
Log:
Added BR tests for MVCC, and fixed a few MVCC/BR related issues.
Modified: core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/DataContainerImpl.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -221,18 +221,18 @@
public List<NodeData> buildNodeData(List<NodeData> list, NodeSPI node, boolean mapSafe)
{
if (usingMvcc)
- return buildNodeData(list, node.getDelegationTarget(), mapSafe);
+ return buildNodeData(list, node.getDelegationTarget(), node.getData(), mapSafe);
else
return buildNodeDataLegacy(list, node, mapSafe);
}
- private List<NodeData> buildNodeData(List<NodeData> list, InternalNode<?, ?> node, boolean mapSafe)
+ private List<NodeData> buildNodeData(List<NodeData> list, InternalNode<?, ?> node, Map dataInNode, boolean mapSafe)
{
- NodeData data = new NodeData(buddyFqnTransformer.getActualFqn(node.getFqn()), node.getData(), mapSafe);
+ NodeData data = new NodeData(buddyFqnTransformer.getActualFqn(node.getFqn()), dataInNode, mapSafe);
list.add(data);
for (InternalNode childNode : node.getChildrenMap().values())
{
- buildNodeData(list, childNode, true);
+ buildNodeData(list, childNode, childNode.getData(), true);
}
return list;
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/CacheLoaderInterceptor.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -6,8 +6,6 @@
import org.jboss.cache.InternalNode;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.NodeSPI;
-import org.jboss.cache.jmx.annotations.ManagedAttribute;
-import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
@@ -27,6 +25,8 @@
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.Start;
import org.jboss.cache.interceptors.base.JmxStatsCommandInterceptor;
+import org.jboss.cache.jmx.annotations.ManagedAttribute;
+import org.jboss.cache.jmx.annotations.ManagedOperation;
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.mvcc.MVCCNodeHelper;
@@ -244,7 +244,7 @@
private void loadIfNeeded(InvocationContext ctx, Fqn fqn, Object key, boolean allKeys, boolean initNode, boolean acquireWriteLock, boolean recursive, boolean isMove, boolean bypassLoadingData, boolean shouldLoadIfNodeIsNull) throws Throwable
{
- NodeSPI n = helper.wrapNodeForReading(ctx, fqn);
+ NodeSPI n = helper.wrapNodeForReading(ctx, fqn, true);
if (n instanceof NullMarkerNode)
{
ctx.getLookedUpNodes().remove(fqn);
@@ -459,13 +459,13 @@
return nodeData;
}
- @ManagedAttribute (description = "number of cache loader node loads")
+ @ManagedAttribute(description = "number of cache loader node loads")
public long getCacheLoaderLoads()
{
return cacheLoads;
}
- @ManagedAttribute (description = "number of cache loader node misses")
+ @ManagedAttribute(description = "number of cache loader node misses")
public long getCacheLoaderMisses()
{
return cacheMisses;
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/DataGravitatorInterceptor.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -24,6 +24,6 @@
@Override
protected void wrapIfNeeded(InvocationContext ctx, Fqn fqnToWrap) throws InterruptedException
{
- helper.wrapNodeForReading(ctx, fqnToWrap);
+ helper.wrapNodeForReading(ctx, fqnToWrap, true);
}
}
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/LegacyDataGravitatorInterceptor.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -17,7 +17,6 @@
import org.jboss.cache.commands.CommandsFactory;
import org.jboss.cache.commands.DataCommand;
import org.jboss.cache.commands.ReplicableCommand;
-import org.jboss.cache.commands.read.ExistsCommand;
import org.jboss.cache.commands.read.GetChildrenNamesCommand;
import org.jboss.cache.commands.read.GetDataMapCommand;
import org.jboss.cache.commands.read.GetKeyValueCommand;
@@ -99,12 +98,6 @@
}
@Override
- public Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command) throws Throwable
- {
- return handleGetMethod(ctx, command);
- }
-
- @Override
public Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
{
return handleGetMethod(ctx, command);
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/MVCCLockingInterceptor.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -155,10 +155,10 @@
if (command.getFqn().isRoot())
{
// if this is the root node, do not attempt to lock this for writing but instead just get all direct children of root.
- Map<Object, NodeSPI> children = dataContainer.peekInternalNode(Fqn.ROOT, false).getChildrenMap();
+ Map<Object, InternalNode> children = dataContainer.peekInternalNode(Fqn.ROOT, false).getChildrenMap();
if (!children.isEmpty())
{
- for (NodeSPI child : children.values())
+ for (InternalNode child : children.values())
helper.wrapNodeForWriting(ctx, child.getFqn(), true, false, false, true, true);
}
}
@@ -188,42 +188,42 @@
@Override
public Object handleGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@Override
public Object handleExistsNodeCommand(InvocationContext ctx, ExistsCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@Override
public Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@Override
public Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@Override
public Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@Override
public Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
@@ -259,7 +259,7 @@
@Override
public Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command) throws Throwable
{
- helper.wrapNodeForReading(ctx, command.getFqn());
+ helper.wrapNodeForReading(ctx, command.getFqn(), true);
return invokeNextInterceptor(ctx, command);
}
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/CacheInvocationDelegate.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -36,10 +36,10 @@
import org.jboss.cache.config.Configuration.NodeLockingScheme;
import org.jboss.cache.config.ConfigurationException;
import org.jboss.cache.config.Option;
+import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
import org.jboss.cache.factories.annotations.Start;
-import org.jboss.cache.factories.ComponentRegistry;
import org.jboss.cache.interceptors.base.CommandInterceptor;
import org.jboss.cache.loader.CacheLoaderManager;
import org.jboss.cache.marshall.Marshaller;
@@ -299,7 +299,7 @@
NodeSPI<K, V> n;
try
{
- n = mvccHelper.wrapNodeForReading(getInvocationContext(), f);
+ n = mvccHelper.wrapNodeForReading(getInvocationContext(), f, false);
}
catch (InterruptedException e)
{
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/MVCCNodeHelper.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -83,25 +83,26 @@
boolean forceWriteLock = ctx.getOptionOverrides().isForceWriteLock();
// does the node exist in the context?
- for (Fqn f : fqns) wrapNodeForReading(ctx, f, forceWriteLock);
+ for (Fqn f : fqns) wrapNodeForReading(ctx, f, forceWriteLock, true);
}
/**
* Similar to {@link #wrapNodesForReading(org.jboss.cache.InvocationContext, java.util.Collection)} except
* that this version takes a single Fqn parameter to wrap a single node.
*
- * @param ctx current invocation context
- * @param fqn fqn to fetch and wrap
+ * @param ctx current invocation context
+ * @param fqn fqn to fetch and wrap
+ * @param putInContext
* @return read committed node, or null if one is not found.
* @throws InterruptedException if write locks are forced and the lock manager is interrupted.
*/
- public NodeSPI wrapNodeForReading(InvocationContext ctx, Fqn fqn) throws InterruptedException
+ public NodeSPI wrapNodeForReading(InvocationContext ctx, Fqn fqn, boolean putInContext) throws InterruptedException
{
- return wrapNodeForReading(ctx, fqn, ctx.getOptionOverrides().isForceWriteLock());
+ return wrapNodeForReading(ctx, fqn, ctx.getOptionOverrides().isForceWriteLock(), putInContext);
}
@SuppressWarnings("unchecked")
- private NodeSPI wrapNodeForReading(InvocationContext ctx, Fqn f, boolean writeLockForced) throws InterruptedException
+ private NodeSPI wrapNodeForReading(InvocationContext ctx, Fqn f, boolean writeLockForced, boolean putInContext) throws InterruptedException
{
NodeSPI n;
if (writeLockForced)
@@ -115,7 +116,7 @@
// simple implementation. Peek the node, wrap it, put wrapped node in the context.
InternalNode[] nodes = dataContainer.peekInternalNodeAndDirectParent(f, false);
ReadCommittedNode wrapped = nodeFactory.createWrappedNode(nodes[0], nodes[1]); // even though parents aren't needed for reading, we hold on to this ref in case the node is later written to.
- if (wrapped != null) ctx.putLookedUpNode(f, wrapped);
+ if (putInContext && wrapped != null) ctx.putLookedUpNode(f, wrapped);
return wrapped;
}
else
Added: core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/BuddyReplicationConcurrencyTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,41 @@
+package org.jboss.cache.api.mvcc;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.buddyreplication.BuddyReplicationTestsBase;
+import org.jboss.cache.util.TestingUtil;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationConcurrencyTest extends BuddyReplicationTestsBase
+{
+ public static final Fqn f = Fqn.fromString("/a/b/c");
+ public static final String k = "k";
+ public static final String v = "v";
+
+ public void testConcurrency() throws Exception
+ {
+ Cache<Object, Object> cache1 = null, cache2 = null;
+
+ try
+ {
+ cache1 = createCache(1, null, true, true);
+ cache2 = createCache(1, null, true, true);
+
+ TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
+
+ // put stuff in cache 1. And ensure they exist in cache 2.
+
+ for (int i = 0; i < 10; i++)
+ {
+ cache1.put(Fqn.fromRelativeElements(f, i), k, v);
+ assert v.equals(cache1.get(Fqn.fromRelativeElements(f, i), k));
+ assert v.equals(cache2.get(Fqn.fromRelativeElements(f, i), k));
+ }
+ }
+ finally
+ {
+ TestingUtil.killCaches(cache1, cache2);
+ }
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationTestsBase.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -142,7 +142,7 @@
c.getConfiguration().setBuddyReplicationConfig(brc);
c.getConfiguration().setFetchInMemoryState(true);
- c.getConfiguration().setNodeLockingScheme(optimisticLocks ? NodeLockingScheme.OPTIMISTIC : NodeLockingScheme.PESSIMISTIC);
+ c.getConfiguration().setNodeLockingScheme(optimisticLocks ? NodeLockingScheme.OPTIMISTIC : getNonOptimisticLockingScheme());
c.getConfiguration().setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
c.getConfiguration().setSyncCommitPhase(true);// helps track down breakages
@@ -158,6 +158,11 @@
return c;
}
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.PESSIMISTIC;
+ }
+
/**
* Provides a hook for multiplexer integration. This default implementation
* is a no-op; subclasses that test mux integration would override
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationWithCacheLoaderTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -17,6 +17,7 @@
import org.jboss.cache.loader.CacheLoader;
import org.jboss.cache.util.TestingUtil;
import static org.jboss.cache.util.TestingUtil.dumpCacheContents;
+import org.jboss.cache.util.internals.EvictionController;
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.Test;
@@ -65,12 +66,9 @@
private void dataGravitationDefaultTest(boolean autoGravitate)
throws Exception
{
-
// create 3 caches
caches = createCachesWithCacheLoader(3, autoGravitate, true, passivation);
- TestingUtil.sleepThread(1000);
-
CacheLoader[] loaders = getLoaders(caches);
// cleanup
@@ -270,7 +268,8 @@
assert cache1.exists(backupFoo) : "Buddy should have data";
// Sleep long enough for eviction to run twice plus a bit
- TestingUtil.sleepThread(3050);
+ new EvictionController(cache0).startEviction();
+ new EvictionController(cache1).startEviction();
// test that the data we're looking for has been evicted in both the data owner and the buddy.
assert !cache0.exists(foo) : "Data should have evicted in data owner";
@@ -325,8 +324,9 @@
assert cache0.exists(foo) : "Data should exist in data owner";
assert cache1.exists(backupFoo) : "Buddy should have data";
- // Sleep long enough for eviction to run twice plus a bit
- TestingUtil.sleepThread(3050);
+ // Kick eviction off!
+ new EvictionController(cache0).startEviction();
+ new EvictionController(cache1).startEviction();
// test that the data we're looking for has been evicted in both the data owner and the buddy.
assert !cache0.exists(foo) : "Data should have evicted in data owner";
@@ -343,12 +343,12 @@
private void configureEviction(Configuration cfg)
{
EvictionConfig ec = new EvictionConfig();
- ec.setWakeupInterval(1000);
+ ec.setWakeupInterval(5000);
EvictionRegionConfig erc = new EvictionRegionConfig();
erc.setRegionFqn(Fqn.ROOT);
LRUAlgorithmConfig lruAlgorithmConfig = new LRUAlgorithmConfig();
- lruAlgorithmConfig.setMaxAge(2000);
- lruAlgorithmConfig.setTimeToLive(1000);
+ lruAlgorithmConfig.setMaxAge(0);
+ lruAlgorithmConfig.setTimeToLive(0);
lruAlgorithmConfig.setMaxNodes(1);
erc.setEvictionAlgorithmConfig(lruAlgorithmConfig);
ec.setDefaultEvictionRegionConfig(erc);
Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/GravitationCleanupTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -2,8 +2,8 @@
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.util.TestingUtil;
-import org.jboss.cache.util.CachePrinter;
import org.testng.annotations.Test;
/**
@@ -47,8 +47,8 @@
dataOwner.put(fqn, key, value);
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
+ System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
assert dataOwner.peek(fqn, false) != null : "Should have data";
assert dataOwner.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(buddy.getLocalAddress())), false) != null : "Should have backup node for buddy";
@@ -64,8 +64,8 @@
// gravitation cleanup calls are async.
cleanupDelay();
- System.out.println("dataOwner: " + CachePrinter.printCacheLockingInfo(dataOwner));
- System.out.println("buddy: " + CachePrinter.printCacheLockingInfo(buddy));
+ System.out.println("dataOwner: " + CachePrinter.printCacheDetails(dataOwner));
+ System.out.println("buddy: " + CachePrinter.printCacheDetails(buddy));
assert buddy.peek(fqn, false) != null : "Should have data";
assert buddy.peek(Fqn.fromRelativeElements(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN, fqnTransformer.getGroupNameFromAddress(dataOwner.getLocalAddress())), false) != null : "Should have backup node for buddy";
Deleted: core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/MvccBuddyReplicationTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -1,89 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt 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.buddyreplication;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.CacheSPI;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.config.Option;
-import org.jboss.cache.config.parsing.XmlConfigurationParser;
-import org.jboss.cache.util.TestingUtil;
-import org.testng.annotations.Test;
-
-/**
- * @author Mircea.Markus(a)jboss.com
- * @since 3.0
- */
-@Test(groups = "functional")
-public class MvccBuddyReplicationTest
-{
- private static final String FILE = "configs/mvcc-repl-sync-br.xml";
-
- public void testSimpleFailure()
- {
- Cache<String, String> cache1 = null, cache2 = null;
- try
- {
- cache1 = createCache();
- TestingUtil.sleepThread(1000);
- cache2 = createCache();
-
- cache1.put("/test", "key", "value");
- cache1.stop();
-
- Option option = cache2.getInvocationContext().getOptionOverrides();
- option.setForceDataGravitation(true);
- assert cache2.get("/test", "key").equals("value");
- }
- finally
- {
- TestingUtil.killCaches(cache1, cache2);
-
- }
- }
-
- private Cache<String, String> createCache()
- {
- Configuration fileConfig = new XmlConfigurationParser().parseFile(FILE);
- DefaultCacheFactory<String, String> dcf = new DefaultCacheFactory<String, String>();
- return dcf.createCache(fileConfig);
- }
-
- public void testSimple() throws Exception
- {
- Configuration fileConfig = new XmlConfigurationParser().parseFile(FILE);
- fileConfig.setCacheMode(Configuration.CacheMode.LOCAL);
- DefaultCacheFactory<String, String> dcf = new DefaultCacheFactory<String, String>();
- CacheSPI cache = (CacheSPI) dcf.createCache(fileConfig);
- cache.getTransactionManager().begin();
- cache.put("/a/b/c","key","value");
- cache.put("/a/b/c","key1","value");
- cache.put("/a/b/c","key2","value");
- cache.put("/a/b/c","key2","value");
- cache.put("/a/b/c","key3","value");
- cache.put("/a/b/c","key4","value");
- cache.put("/a/b/c","key5","value");
- cache.getTransactionManager().commit();
- cache.stop();
- }
-}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyAssignmentStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyAssignmentStateTransferTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyAssignmentStateTransferTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyAssignmentStateTransferTest extends org.jboss.cache.buddyreplication.BuddyAssignmentStateTransferTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyBackupActivationInactivationTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyBackupActivationInactivationTest extends org.jboss.cache.buddyreplication.BuddyBackupActivationInactivationTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyGroupAssignmentTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyGroupAssignmentTest extends org.jboss.cache.buddyreplication.BuddyGroupAssignmentTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationContentTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationContentTest extends org.jboss.cache.buddyreplication.BuddyReplicationContentTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationFailoverTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationFailoverTest extends org.jboss.cache.buddyreplication.BuddyReplicationFailoverTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationRejoinTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationRejoinTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationRejoinTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationRejoinTest extends org.jboss.cache.buddyreplication.BuddyReplicationRejoinTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithCacheLoaderTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithCacheLoaderTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithCacheLoaderTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationWithCacheLoaderTest extends org.jboss.cache.buddyreplication.BuddyReplicationWithCacheLoaderTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithPassivationTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithPassivationTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithPassivationTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationWithPassivationTest extends org.jboss.cache.buddyreplication.BuddyReplicationWithPassivationTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/BuddyReplicationWithTransactionsTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,14 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class BuddyReplicationWithTransactionsTest extends org.jboss.cache.buddyreplication.BuddyReplicationWithTransactionsTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+}
Added: core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/mvcc/GravitationCleanupTest.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -0,0 +1,26 @@
+package org.jboss.cache.buddyreplication.mvcc;
+
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.testng.annotations.Test;
+
+@Test(groups = {"functional", "mvcc"})
+public class GravitationCleanupTest extends org.jboss.cache.buddyreplication.GravitationCleanupTest
+{
+ @Override
+ protected NodeLockingScheme getNonOptimisticLockingScheme()
+ {
+ return NodeLockingScheme.MVCC;
+ }
+
+ @Override
+ public void testStaleRegionOnDataOwnerOptimistic()
+ {
+ // noop
+ }
+
+ @Override
+ public void testStaleRegionOnBuddyOptimistic()
+ {
+ // noop
+ }
+}
Modified: core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-09-19 23:04:12 UTC (rev 6765)
+++ core/trunk/src/test/java/org/jboss/cache/util/TestingUtil.java 2008-09-19 23:39:45 UTC (rev 6766)
@@ -628,7 +628,7 @@
else
{
System.out.println(" ** Cache " + count + " is " + c.getLocalAddress());
- System.out.println(" " + CachePrinter.printCacheLockingInfo(c));
+ System.out.println(" " + CachePrinter.printCacheDetails(c));
}
count++;
}
16 years, 5 months
JBoss Cache SVN: r6765 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 19:04:12 -0400 (Fri, 19 Sep 2008)
New Revision: 6765
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Removed unnecessary logging
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 17:51:19 UTC (rev 6764)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 23:04:12 UTC (rev 6765)
@@ -674,22 +674,14 @@
private ReplicableCommand unmarshallCommand(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
- if (trace) log.trace("Unmarshalling method call!!");
short methodId = in.readShort();
- if (trace) log.trace("Method ID for command is " + methodId);
byte numArgs = in.readByte();
- if (trace) log.trace("NumArgs for command is " + numArgs);
Object[] args = null;
if (numArgs > 0)
{
args = new Object[numArgs];
-
- for (int i = 0; i < numArgs; i++)
- {
- args[i] = unmarshallObject(in, refMap);
- if (trace) log.trace("Arg " + i + " is " + args[i]);
- }
+ for (int i = 0; i < numArgs; i++) args[i] = unmarshallObject(in, refMap);
}
return commandsFactory.fromStream(methodId, args);
16 years, 5 months
JBoss Cache SVN: r6764 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 13:51:19 -0400 (Fri, 19 Sep 2008)
New Revision: 6764
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java
Log:
wc
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java 2008-09-19 16:55:20 UTC (rev 6763)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ThroughputChartGenerator.java 2008-09-19 17:51:19 UTC (rev 6764)
@@ -1,5 +1,7 @@
package org.cachebench.reportgenerators;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
@@ -28,6 +30,7 @@
{
private DefaultCategoryDataset averageThroughput, totalThroughput;
private String chartNameAverage = "chart-averageThroughput.png", chartNameTotal = "chart-totalThroughput.png";
+ private Log log = LogFactory.getLog(ThroughputChartGenerator.class);
public void generateChart() throws IOException
{
@@ -127,6 +130,7 @@
private void readData(File f) throws IOException
{
+ log.info("Parsing file " + f.getAbsoluteFile());
// chop up the file name to get productAndConfiguration and clusterSize.
Integer clusterSize = 0;
DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
16 years, 5 months
JBoss Cache SVN: r6763 - searchable/trunk/src/main/java/org/jboss/cache/search.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-09-19 12:55:20 -0400 (Fri, 19 Sep 2008)
New Revision: 6763
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java
Log:
Implemented fetchSize changes in CQI and used the changes in LQRI
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java 2008-09-19 14:41:57 UTC (rev 6762)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/LazyQueryResultIterator.java 2008-09-19 16:55:20 UTC (rev 6763)
@@ -26,11 +26,9 @@
import org.hibernate.search.engine.SearchFactoryImplementor;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
-import org.jboss.util.Objects;
import java.util.NoSuchElementException;
-import java.util.List;
-import java.util.ArrayList;
+import java.util.Arrays;
import java.io.IOException;
/**
@@ -43,7 +41,7 @@
public class LazyQueryResultIterator implements QueryResultIterator
{
private int index = 0;
- private int oldIndex;
+ private int bufferIndex = -1; // this is the index at which the buffer was populated. Hence, the first element of the buffer is at this index in the overall result set.
private int max = 0;
private int first = 0;
private int fetchSize = 0; // difference between fetchsize and index must always be the value for first. fetchSize has to be at least 1.
@@ -52,7 +50,7 @@
private Hits hits;
private IndexSearcher searcher;
private SearchFactoryImplementor searchFactory;
- private List<Object> bufferObjects;
+ private Object[] buffer;
public LazyQueryResultIterator(DocumentExtractor extractor, CacheEntityLoader entityLoader, Hits hits,
IndexSearcher searcher, SearchFactoryImplementor searchFactory, int first, int max, int fetchSize)
@@ -67,13 +65,13 @@
index = first;
this.first = first;
this.max = max;
- this.fetchSize = fetchSize + first;
+ this.fetchSize = fetchSize;
this.hits = hits;
this.searcher = searcher;
this.searchFactory = searchFactory;
- //Create an ArrayList with size fetchSize - 1 (which is the size of the required buffer.
- bufferObjects = new ArrayList<Object>(this.fetchSize - 1);
+ //Create an buffer with size fetchSize (which is the size of the required buffer.
+ buffer = new Object[fetchSize];
}
public void jumpToResult(int index) throws IndexOutOfBoundsException
@@ -82,7 +80,7 @@
{
throw new IndexOutOfBoundsException("The given index is incorrect. Please check and try again.");
}
-
+
this.index = first + index;
}
@@ -140,42 +138,51 @@
public Object next()
{
Object toReturn = null;
- int bufferSize = fetchSize - 1;
+ int bufferSize = buffer.length;
- if (index <= oldIndex + bufferSize)
+ // make sure the index we are after is in the buffer. If it is, then index >= bufferIndex and index <= (bufferIndex + bufferSize).
+ if (bufferIndex >= 0 // buffer init check
+ && index >= bufferIndex // lower boundary
+ && index <= (bufferIndex + bufferSize)) // upper boundary
{
- oldIndex = index;
- index++;
- return bufferObjects.get(oldIndex);
+ // now we can get this from the buffer. Sweet!
+ int indexToReturn = index - bufferIndex;
+ toReturn = buffer[indexToReturn];
}
-
- try
+ else
{
- String documentId = (String) extractor.extract(hits, index).id;
- CacheEntityId id = new CacheEntityId(documentId);
- toReturn = entityLoader.load(id);
+ // else we need to populate the buffer and get what we need.
- //now loop through bufferSize times to add the rest of the objects into the list.
- for (int i = 1; i <= bufferSize; i++)
+ try
{
- //Wiping bufferObjects and the oldIndex so that there is no stale data.
- bufferObjects.clear();
- oldIndex = 0;
+ String documentId = (String) extractor.extract(hits, index).id;
+ CacheEntityId id = new CacheEntityId(documentId);
+ toReturn = entityLoader.load(id);
- String bufferDocumentId = (String) extractor.extract(hits, index + i).id;
- CacheEntityId bufferId = new CacheEntityId(bufferDocumentId);
- Object toBuffer = entityLoader.load(bufferId);
- bufferObjects.add(toBuffer);
+ //Wiping bufferObjects and the bufferIndex so that there is no stale data.
+ Arrays.fill(buffer, null);
+ buffer[0] = toReturn;
+ // we now need to buffer item at index "index", as well as the next "fetchsize - 1" elements. I.e., a total of fetchsize elements will be buffered.
+ // ignore loop below, in needs fixing
+ //now loop through bufferSize times to add the rest of the objects into the list.
+
+ for (int i = 1; i <= bufferSize; i++)
+ {
+ String bufferDocumentId = (String) extractor.extract(hits, index + i).id;
+ CacheEntityId bufferId = new CacheEntityId(bufferDocumentId);
+ Object toBuffer = entityLoader.load(bufferId);
+ buffer[i] = toBuffer;
+ }
+ bufferIndex = index;
}
- oldIndex = index;
- index++;
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
- catch (IOException e)
- {
- e.printStackTrace();
- }
+ index++;
return toReturn;
}
@@ -186,43 +193,47 @@
public Object previous()
{
- int bufferSize = fetchSize - 1;
Object toReturn = null;
+ int bufferSize = buffer.length;
- if (index >= oldIndex - bufferSize)
+ // make sure the index we are after is in the buffer. If it is, then index >= bufferIndex and index <= (bufferIndex + bufferSize).
+
+ if (bufferIndex >= 0 // buffer init check
+ && index <= bufferIndex // lower boundary
+ && index >= (bufferIndex + bufferSize)) // upper boundary
{
- oldIndex = index;
- index--;
- return bufferObjects.get(oldIndex);
+ // now we can get this from the buffer. Sweet!
+ int indexToReturn = bufferIndex - index; // Unlike next() we have to make sure that we are subtracting index from bufferIndex
+ toReturn = buffer[indexToReturn];
}
try
{
+ //Wiping the buffer
+ Arrays.fill(buffer, null);
+
String documentId = (String) extractor.extract(hits, index).id;
CacheEntityId id = new CacheEntityId(documentId);
toReturn = entityLoader.load(id);
+ buffer[0] = toReturn;
+
//now loop through bufferSize times to add the rest of the objects into the list.
for (int i = 1; i <= bufferSize; i++)
{
- //Wiping bufferObjects and oldIndex so that there is no stale data.
- bufferObjects.clear();
- oldIndex = 0;
-
String bufferDocumentId = (String) extractor.extract(hits, index - i).id; //In this case it has to be index - i because previous() is called.
CacheEntityId bufferId = new CacheEntityId(bufferDocumentId);
Object toBuffer = entityLoader.load(bufferId);
- bufferObjects.add(toBuffer);
-
+ buffer[i] = toBuffer;
}
- oldIndex = index;
- index--;
+ bufferIndex = index;
}
catch (IOException e)
{
e.printStackTrace();
}
+ index--;
return toReturn;
}
16 years, 5 months
Build failed in Hudson: jboss-cache-searchable-trunk-jdk1.6 » JBoss Cache - Searchable Edition #7
by jboss-qa-internal@redhat.com
See http://hudson.qa.jboss.com/hudson/job/jboss-cache-searchable-trunk-jdk1.6...
Changes:
[navssurtani] Started profiling
[navssurtani] Started profiling
------------------------------------------
started
Building remotely on soavmg2-linux
$ /qa/tools/opt/jdk1.6.0_03/bin/java -Xmx512m -cp /home/hudson/hudson_workspace/maven-agent.jar:/qa/tools/opt/maven-2.0.9/boot/classworlds-1.1.jar hudson.maven.agent.Main /qa/tools/opt/maven-2.0.9 /qa/services/hudson/hudson_release/WEB-INF/slave.jar /home/hudson/hudson_workspace/maven-interceptor.jar
channel started
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ------------------------------------------------------------------------
[INFO] Building JBoss Cache - Searchable Edition
[INFO] task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from Main Maven Repo
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.repository.codehaus.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from repository.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from repository.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from e-xml.sourceforge.net
Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/emma-maven-plu...
32K downloaded
[HUDSON] Archiving /home/hudson/hudson_workspace/workspace/jboss-cache-searchable-trunk-jdk1.6/./pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.codehaus.mojo
ArtifactId: emma-maven-plugin
Version: 1.0-20080124.223752-5
Reason: Downloaded file does not exist: /home/hudson/.m2/repository/org/codehaus/mojo/emma-maven-plugin/1.0-SNAPSHOT/emma-maven-plugin-1.0-20080124.223752-5.jar.tmp
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=emma-maven-plugin -Dversion=1.0-20080124.223752-5 -Dpackaging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=emma-maven-plugin -Dversion=1.0-20080124.223752-5 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
org.codehaus.mojo:emma-maven-plugin:maven-plugin:1.0-20080124.223752-5
from the specified remote repositories:
snapshots.repository.codehaus.org (http://snapshots.repository.codehaus.org),
Main Maven Repo (http://repo1.maven.org/maven2/),
snapshots.jboss.org (http://snapshots.jboss.org/maven2),
central (http://repo1.maven.org/maven2),
repository.jboss.org (http://repository.jboss.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33 seconds
[INFO] Finished at: Wed Sep 03 12:03:47 EDT 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
Waiting for Hudson to finish collecting data
16 years, 5 months
Build failed in Hudson: jboss-cache-searchable-trunk-jdk1.5 » JBoss Cache - Searchable Edition #7
by jboss-qa-internal@redhat.com
See http://hudson.qa.jboss.com/hudson/job/jboss-cache-searchable-trunk-jdk1.5...
Changes:
[navssurtani] Started profiling
[navssurtani] Started profiling
------------------------------------------
started
Building remotely on dev47-linux
$ /qa/tools/opt/jdk1.5.0_15/bin/java -Xmx512m -cp /mnt/hudson_workspace/maven-agent.jar:/qa/tools/opt/maven-2.0.9/boot/classworlds-1.1.jar hudson.maven.agent.Main /qa/tools/opt/maven-2.0.9 /qa/services/hudson/hudson_release/WEB-INF/slave.jar /mnt/hudson_workspace/maven-interceptor.jar
channel started
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO] ------------------------------------------------------------------------
[INFO] Building JBoss Cache - Searchable Edition
[INFO] task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from Main Maven Repo
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.repository.codehaus.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from repository.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from repository.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from snapshots.jboss.org
[INFO] snapshot org.codehaus.mojo:emma-maven-plugin:1.0-SNAPSHOT: checking for updates from e-xml.sourceforge.net
Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/emma-maven-plu...
7K downloaded
Downloading: http://repo1.maven.org/maven2//org/codehaus/mojo/mojo-sandbox/4/mojo-sand...
2K downloaded
Downloading: http://snapshots.repository.codehaus.org/org/codehaus/mojo/emma-maven-plu...
32K downloaded
[HUDSON] Archiving /mnt/hudson_workspace/workspace/jboss-cache-searchable-trunk-jdk1.5/./pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The PluginDescriptor for the plugin Plugin [org.codehaus.mojo:emma-maven-plugin] was not found.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: The PluginDescriptor for the plugin Plugin [org.codehaus.mojo:emma-maven-plugin] was not found.
at org.apache.maven.plugin.DefaultPluginManager.addPlugin(DefaultPluginManager.java:325)
at org.apache.maven.plugin.DefaultPluginManager.verifyVersionedPlugin(DefaultPluginManager.java:212)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:176)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1274)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.bindPluginToLifecycle(DefaultLifecycleExecutor.java:1238)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.constructLifecycleMappings(DefaultLifecycleExecutor.java:1004)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:477)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:42)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at hudson.maven.agent.Main.launch(Main.java:97)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:129)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:52)
at hudson.remoting.UserRequest.perform(UserRequest.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:23)
at hudson.remoting.Request$2.run(Request.java:200)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33 seconds
[INFO] Finished at: Wed Sep 03 16:51:57 EDT 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
Waiting for Hudson to finish collecting data
16 years, 5 months
JBoss Cache SVN: r6762 - core/trunk/src/test/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 10:41:57 -0400 (Fri, 19 Sep 2008)
New Revision: 6762
Added:
core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
Log:
Tests marshalling of arrays
Added: core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java (rev 0)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/SimpleArrayReplTest.java 2008-09-19 14:41:57 UTC (rev 6762)
@@ -0,0 +1,45 @@
+package org.jboss.cache.marshall;
+
+import org.jboss.cache.Cache;
+import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.config.Configuration.NodeLockingScheme;
+import org.jboss.cache.util.TestingUtil;
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Random;
+
+@Test(groups = "functional")
+public class SimpleArrayReplTest
+{
+ public void testArrayRepl() throws CloneNotSupportedException
+ {
+ int streamsize = 11000;
+ byte[] b = new byte[streamsize];
+ new Random().nextBytes(b);
+ Cache<String, byte[]> cache1 = null, cache2 = null;
+
+ try
+ {
+ Configuration c = new Configuration();
+ c.setCacheMode(CacheMode.REPL_SYNC);
+ c.setNodeLockingScheme(NodeLockingScheme.MVCC);
+ cache1 = new DefaultCacheFactory<String, byte[]>().createCache(c.clone());
+ cache2 = new DefaultCacheFactory<String, byte[]>().createCache(c.clone());
+
+ TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
+
+ cache1.put(Fqn.fromString("/a"), "test", b);
+ byte[] bytesBack = cache2.get(Fqn.fromString("/a"), "test");
+
+ assert Arrays.equals(b, bytesBack);
+ }
+ finally
+ {
+ TestingUtil.killCaches(cache1, cache2);
+ }
+ }
+}
16 years, 6 months
JBoss Cache SVN: r6761 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 10:34:58 -0400 (Fri, 19 Sep 2008)
New Revision: 6761
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
Buffered read for byte arrays
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 13:01:33 UTC (rev 6760)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 14:34:58 UTC (rev 6761)
@@ -937,7 +937,15 @@
if (isPrim)
{
byte[] a = new byte[sz];
- in.read(a);
+ int bsize = 10240;
+ int offset = 0;
+ int bytesLeft = sz;
+ while (bytesLeft > 0)
+ {
+ int read = in.read(a, offset, Math.min(bsize, bytesLeft));
+ offset += read;
+ bytesLeft -= read;
+ }
return a;
}
else
16 years, 6 months
JBoss Cache SVN: r6760 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-09-19 09:01:33 -0400 (Fri, 19 Sep 2008)
New Revision: 6760
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
More logging
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 11:15:40 UTC (rev 6759)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-09-19 13:01:33 UTC (rev 6760)
@@ -674,8 +674,11 @@
private ReplicableCommand unmarshallCommand(ObjectInputStream in, UnmarshalledReferences refMap) throws Exception
{
+ if (trace) log.trace("Unmarshalling method call!!");
short methodId = in.readShort();
+ if (trace) log.trace("Method ID for command is " + methodId);
byte numArgs = in.readByte();
+ if (trace) log.trace("NumArgs for command is " + numArgs);
Object[] args = null;
if (numArgs > 0)
@@ -685,6 +688,7 @@
for (int i = 0; i < numArgs; i++)
{
args[i] = unmarshallObject(in, refMap);
+ if (trace) log.trace("Arg " + i + " is " + args[i]);
}
}
16 years, 6 months