JBoss Cache SVN: r5041 - demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 20:12:04 -0500 (Mon, 07 Jan 2008)
New Revision: 5041
Modified:
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
Log:
Updated GUI
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-08 00:26:22 UTC (rev 5040)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.form 2008-01-08 01:12:04 UTC (rev 5041)
@@ -612,6 +612,48 @@
</component>
</children>
</grid>
+ <grid id="ffd9b" binding="debugTab" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
+ <margin top="0" left="0" bottom="0" right="0"/>
+ <constraints>
+ <tabbedpane title="Debug" enabled="false"/>
+ </constraints>
+ <properties/>
+ <border type="none"/>
+ <children>
+ <component id="cda62" class="javax.swing.JButton" binding="cacheDetailsButton">
+ <constraints>
+ <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Print cache details"/>
+ </properties>
+ </component>
+ <component id="3a0c2" class="javax.swing.JButton" binding="cacheLockInfoButton">
+ <constraints>
+ <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ <properties>
+ <text value="Print cache locking info"/>
+ </properties>
+ </component>
+ <component id="7423b" class="javax.swing.JTextArea" binding="debugTextArea">
+ <constraints>
+ <grid row="1" column="0" row-span="1" col-span="3" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false">
+ <preferred-size width="150" height="50"/>
+ </grid>
+ </constraints>
+ <properties>
+ <background color="-3355444"/>
+ <font name="Courier New" size="10"/>
+ </properties>
+ </component>
+ <hspacer id="75f56">
+ <constraints>
+ <grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
+ </constraints>
+ </hspacer>
+ </children>
+ </grid>
</children>
</tabbedpane>
<component id="97005" class="javax.swing.JLabel" binding="cacheStatus">
Modified: demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java
===================================================================
--- demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-08 00:26:22 UTC (rev 5040)
+++ demos/core-demo-gui/trunk/src/main/java/org/jboss/cache/demo/JBossCacheDemo.java 2008-01-08 01:12:04 UTC (rev 5041)
@@ -9,6 +9,7 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import org.jboss.cache.util.CachePrinter;
import org.jboss.cache.notifications.annotation.BuddyGroupChanged;
import org.jboss.cache.notifications.annotation.NodeCreated;
import org.jboss.cache.notifications.annotation.NodeModified;
@@ -48,6 +49,9 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.AbstractExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.LinkedBlockingQueue;
/**
* @author Manik Surtani (<a href="mailto:manik@jboss.org">manik(a)jboss.org</a>)
@@ -92,6 +96,10 @@
private JTextArea configFileContents;
private JRadioButton getNodeRadioButton;
private JScrollPane treeScrollPane;
+ private JPanel debugTab;
+ private JButton cacheDetailsButton;
+ private JButton cacheLockInfoButton;
+ private JTextArea debugTextArea;
private String cacheConfigFile;
private Cache<String, String> cache;
private String startCacheButtonLabel = "Start Cache", stopCacheButtonLabel = "Stop Cache";
@@ -374,6 +382,20 @@
});
}
});
+ cacheDetailsButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (cache != null) debugTextArea.setText(CachePrinter.printCacheDetails(cache));
+ }
+ });
+ cacheLockInfoButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ if (cache != null) debugTextArea.setText(CachePrinter.printCacheLockingInfo(cache));
+ }
+ });
}
private void updateStats()
17 years
JBoss Cache SVN: r5040 - in core/trunk/src: test/java/org/jboss/cache/notifications and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 19:26:22 -0500 (Mon, 07 Jan 2008)
New Revision: 5040
Modified:
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
Log:
Added tests for notifications on removal on nonexistent node and fixed typo
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-07 18:09:53 UTC (rev 5039)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-08 00:26:22 UTC (rev 5040)
@@ -464,7 +464,7 @@
if (f.size() == 1)
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(f.getLastElement(), gtx, notify, notify);
+ return getOrCreateChild(f.getLastElement(), gtx, true, notify);
}
else
{
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java 2008-01-07 18:09:53 UTC (rev 5039)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerOptimisticTest.java 2008-01-08 00:26:22 UTC (rev 5040)
@@ -6,6 +6,9 @@
*/
package org.jboss.cache.notifications;
+import org.testng.annotations.Test;
+
+@Test(groups = "functional")
public class CacheListenerOptimisticTest extends CacheListenerTest
{
public CacheListenerOptimisticTest()
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-01-07 18:09:53 UTC (rev 5039)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/CacheListenerTest.java 2008-01-08 00:26:22 UTC (rev 5040)
@@ -38,7 +38,7 @@
*
* @since 2.0.0
*/
-@Test(groups = {"functional"})
+@Test(groups = "functional")
public class CacheListenerTest
{
protected boolean optLocking = false;
@@ -165,6 +165,20 @@
assertNull("Should be null", cache.getRoot().getChild(fqn));
}
+ public void testNonexistentRemove() throws Exception
+ {
+ cache.removeNode("/does/not/exist");
+ List<Event> expected = new ArrayList<Event>();
+
+ if (optLocking)
+ {
+ expected.add(new EventImpl(false, cache, null, null, null, null, true, null, false, null, TRANSACTION_REGISTERED));
+ expected.add(new EventImpl(false, cache, null, null, null, null, true, null, true, null, TRANSACTION_COMPLETED));
+ eventLog.scrubImplicitTransactions();
+ }
+ assertEquals(expected, eventLog.events);
+ }
+
public void testRemoveData() throws Exception
{
assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
@@ -262,6 +276,18 @@
// -- now the transactional ones
+ public void testTxNonexistentRemove() throws Exception
+ {
+ tm.begin();
+ Transaction tx = tm.getTransaction();
+ cache.removeNode("/does/not/exist");
+ tm.commit();
+ List<Event> expected = new ArrayList<Event>();
+ expected.add(new EventImpl(false, cache, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
+ expected.add(new EventImpl(false, cache, null, null, null, tx, true, null, true, null, TRANSACTION_COMPLETED));
+ assertEquals(expected, eventLog.events);
+ }
+
public void testTxCreationCommit() throws Exception
{
assertEquals("Event log should be empty", Collections.emptyList(), eventLog.events);
Modified: core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-01-07 18:09:53 UTC (rev 5039)
+++ core/trunk/src/test/java/org/jboss/cache/notifications/RemoteCacheListenerTest.java 2008-01-08 00:26:22 UTC (rev 5040)
@@ -160,6 +160,25 @@
assertEquals("value", cache1.get(fqn, "key"));
}
+ public void testNonexistentRemove() throws Exception
+ {
+ cache1.removeNode("/does/not/exist");
+ List<Event> expected = new ArrayList<Event>();
+
+ if (optLocking)
+ {
+ expected.add(new EventImpl(false, cache1, null, null, null, null, true, null, false, null, TRANSACTION_REGISTERED));
+ expected.add(new EventImpl(false, cache1, null, null, null, null, true, null, true, null, TRANSACTION_COMPLETED));
+ eventLog1.scrubImplicitTransactions();
+ eventLog2.scrubImplicitTransactions();
+ }
+ assertEquals(expected, eventLog1.events);
+ setCache(cache2, expected);
+ markOriginRemote(expected);
+ assertEquals(expected, eventLog2.events);
+ }
+
+
public void testOnlyModification() throws Exception
{
assertNull(cache1.get(fqn, "key"));
@@ -405,6 +424,23 @@
assertEquals("value", cache2.get(fqn, "key"));
}
+ public void testTxNonexistentRemove() throws Exception
+ {
+ tm1.begin();
+ Transaction tx = tm1.getTransaction();
+ cache1.removeNode("/does/not/exist");
+ tm1.commit();
+ List<Event> expected = new ArrayList<Event>();
+ expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, false, null, TRANSACTION_REGISTERED));
+ expected.add(new EventImpl(false, cache1, null, null, null, tx, true, null, true, null, TRANSACTION_COMPLETED));
+ assertEquals(expected, eventLog1.events);
+ setCache(cache2, expected);
+ markOriginRemote(expected);
+ scrubTransactions(expected);
+ eventLog2.scrubImplicitTransactions();
+ assertEquals(expected, eventLog2.events);
+ }
+
public void testTxCreationRollback() throws Exception
{
assertEquals("Event log should be empty", Collections.emptyList(), eventLog2.events);
17 years
JBoss Cache SVN: r5039 - in core/trunk/src/main/java/org/jboss/cache: interceptors and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 13:09:53 -0500 (Mon, 07 Jan 2008)
New Revision: 5039
Modified:
core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
Log:
Suppress notifications for nodes created as a part of removeNode()
Modified: core/trunk/src/main/java/org/jboss/cache/NodeSPI.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2008-01-07 17:04:24 UTC (rev 5038)
+++ core/trunk/src/main/java/org/jboss/cache/NodeSPI.java 2008-01-07 18:09:53 UTC (rev 5039)
@@ -246,6 +246,19 @@
NodeSPI<K, V> addChildDirect(Fqn childName);
/**
+ * Same as {@link #addChildDirect(Fqn)} except that it optionally allows you to suppress notification events for
+ * the creation of this node.
+ *
+ * @param f name of child
+ * @param notify if true, notification events are sent; if false, they are not
+ * @return child node
+ * @throws org.jboss.cache.lock.LockingException
+ * if locking was not obtained
+ * @see #addChild(Fqn)
+ */
+ NodeSPI<K, V> addChildDirect(Fqn f, boolean notify);
+
+ /**
* Directly adds the node passed in to the children map of the current node. Will throw a CacheException if
* <tt>child.getFqn().getParent().equals(getFqn())</tt> returns false.
*
@@ -443,9 +456,9 @@
* using special <tt>_JBOSS_INTERNAL_XXX</tt> Strings as keys. Designed to be used by {@link org.jboss.cache.statetransfer.StateTransferGenerator}
* and {@link org.jboss.cache.interceptors.CacheStoreInterceptor} which attempt to serialize nodes into a stream for storage or transfer.
*
+ * @param onlyInternalState if true, the map will only contain internal state and no other data.
* @return a map containing data as well as additional information about this node.
* @since 2.1.0
- * @param onlyInternalState if true, the map will only contain internal state and no other data.
*/
Map getInternalState(boolean onlyInternalState);
@@ -463,7 +476,8 @@
/**
* Sets the validity of a node. By default, all nodes are valid unless they are deleted, invalidated or moved, either
* locally or remotely. To be used in conjunction with {@link #isValid()}.
- * @param valid if true, the node is marked as valid; if false, the node is invalid.
+ *
+ * @param valid if true, the node is marked as valid; if false, the node is invalid.
* @param recursive if true, the validity flag passed in is applied to all children as well.
* @since 2.1.0
*/
Modified: core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-07 17:04:24 UTC (rev 5038)
+++ core/trunk/src/main/java/org/jboss/cache/UnversionedNode.java 2008-01-07 18:09:53 UTC (rev 5039)
@@ -248,12 +248,12 @@
return data.put(key, value);
}
- public NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx)
+ public NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean notify)
{
- return getOrCreateChild(child_name, gtx, true);
+ return getOrCreateChild(child_name, gtx, true, notify);
}
- private NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
+ private NodeSPI<K, V> getOrCreateChild(Object child_name, GlobalTransaction gtx, boolean createIfNotExists, boolean notify)
{
NodeSPI<K, V> child;
@@ -281,7 +281,7 @@
child = (NodeSPI<K, V>) children().get(child_name);
if (child == null)
{
- cache.getNotifier().notifyNodeCreated(child_fqn, true, ctx);
+ if (notify) cache.getNotifier().notifyNodeCreated(child_fqn, true, ctx);
child = newChild;
children.put(child_name, child);
if (gtx != null)
@@ -303,7 +303,7 @@
{
log.trace("created child: fqn=" + child_fqn);
}
- cache.getNotifier().notifyNodeCreated(child_fqn, false, ctx);
+ if (notify) cache.getNotifier().notifyNodeCreated(child_fqn, false, ctx);
}
}
return child;
@@ -456,10 +456,15 @@
public NodeSPI<K, V> addChildDirect(Fqn f)
{
+ return addChildDirect(f, true);
+ }
+
+ public NodeSPI<K, V> addChildDirect(Fqn f, boolean notify)
+ {
if (f.size() == 1)
{
GlobalTransaction gtx = cache.getInvocationContext().getGlobalTransaction();
- return getOrCreateChild(f.getLastElement(), gtx);
+ return getOrCreateChild(f.getLastElement(), gtx, notify, notify);
}
else
{
Modified: core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-07 17:04:24 UTC (rev 5038)
+++ core/trunk/src/main/java/org/jboss/cache/interceptors/PessimisticLockInterceptor.java 2008-01-07 18:09:53 UTC (rev 5039)
@@ -390,7 +390,8 @@
{
if (createIfNotExists)
{
- currentNode = parent.addChildDirect(new Fqn(childName));
+ // if the new node is to be marked as deleted, do not notify!
+ currentNode = parent.addChildDirect(new Fqn(childName), !markNewNodesAsDeleted);
created = true;
if (trace) log.trace("Child node was null, so created child node " + childName);
if (createdNodes != null) createdNodes.add(currentNode.getFqn());
Modified: core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-01-07 17:04:24 UTC (rev 5038)
+++ core/trunk/src/main/java/org/jboss/cache/invocation/NodeInvocationDelegate.java 2008-01-07 18:09:53 UTC (rev 5039)
@@ -77,7 +77,7 @@
public NodeSPI<K, V> getOrCreateChild(Object name, GlobalTransaction tx)
{
- return node.getOrCreateChild(name, tx);
+ return node.getOrCreateChild(name, tx, true);
}
public NodeLock getLock()
@@ -155,6 +155,11 @@
return node.addChildDirect(childName);
}
+ public NodeSPI<K, V> addChildDirect(Fqn f, boolean notify)
+ {
+ return node.addChildDirect(f, notify);
+ }
+
public void addChildDirect(NodeSPI<K, V> child)
{
node.addChildDirect(child);
17 years
Build failed in Hudson: jboss-cache-core-jdk1.6 » JBoss Cache - Core Edition #153
by jboss-qa-internal@redhat.com
See https://hudson.jboss.org/hudson/job/jboss-cache-core-jdk1.6/org.jboss.cac...
Changes:
[manik.surtani(a)jboss.com] fixed class cast exceptions when comparing IpAddress instances
------------------------------------------
started
Building remotely on dev03-linux
$ /qa/tools/opt/jdk1.6.0_02/bin/java -Xmx256m -cp /home/hudson/hudson_workspace/maven-agent.jar:/qa/tools/opt/maven-2.0.6/boot/classworlds-1.1.jar hudson.maven.agent.Main /qa/tools/opt/maven-2.0.6 /qa/services/hudson/hudson_1.149/slave.jar /home/hudson/hudson_workspace/maven-interceptor.jar
FATAL: null
java.io.InterruptedIOException
at java.io.PipedInputStream.read(PipedInputStream.java:262)
at hudson.remoting.Channel.<init>(Channel.java:155)
at hudson.remoting.Channel.<init>(Channel.java:116)
at hudson.Launcher$RemoteLauncher.launchChannel(Launcher.java:356)
at hudson.maven.MavenProcessFactory.newProcess(MavenProcessFactory.java:57)
at hudson.maven.ProcessCache.get(ProcessCache.java:166)
at hudson.maven.MavenBuild$RunnerImpl.doRun(MavenBuild.java:322)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:182)
at hudson.model.Run.run(Run.java:579)
at hudson.maven.MavenBuild.run(MavenBuild.java:106)
at hudson.model.ResourceController.execute(ResourceController.java:70)
at hudson.model.Executor.run(Executor.java:62)
17 years
JBoss Cache SVN: r5038 - core/trunk/src/main/java/org/jboss/cache/marshall.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 12:04:24 -0500 (Mon, 07 Jan 2008)
New Revision: 5038
Modified:
core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
Log:
reverting back to this for now
Modified: core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-07 15:37:50 UTC (rev 5037)
+++ core/trunk/src/main/java/org/jboss/cache/marshall/CacheMarshaller200.java 2008-01-07 17:04:24 UTC (rev 5038)
@@ -117,7 +117,7 @@
{
// not region based!
if (trace) log.trace("Marshalling object " + o);
- ReferencesMap refMap = new ReferencesMap();
+ Map<Object, Integer> refMap = new HashMap<Object, Integer>();
marshallObject(o, out, refMap);
}
}
@@ -140,7 +140,7 @@
public void objectToObjectStream(Object o, ObjectOutputStream out, Fqn region) throws Exception
{
if (trace) log.trace("Marshalling object " + o);
- ReferencesMap refMap = new ReferencesMap();
+ Map<Object, Integer> refMap = new HashMap<Object, Integer>();
if (useRegionBasedMarshalling) // got to check again in case this meth is called directly
{
log.trace("Writing region " + region + " to stream");
@@ -257,18 +257,16 @@
}
// --------- Marshalling methods
- private void marshallObject(Object o, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallObject(Object o, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
- int reference;
-
if (o == null)
{
out.writeByte(MAGICNUMBER_NULL);
}
- else if ((reference = refMap.getReference(o)) > -1)// see if this object has been marshalled before.
+ else if (refMap.containsKey(o))// see if this object has been marshalled before.
{
out.writeByte(MAGICNUMBER_REF);
- writeReference(out, reference);
+ writeReference(out, refMap.get(o));
}
else if (o instanceof MethodCall)
{
@@ -404,7 +402,7 @@
}
}
- private void marshallGravitateResult(GravitateResult gravitateResult, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallGravitateResult(GravitateResult gravitateResult, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
marshallObject(gravitateResult.isDataFound(), out, refMap);
if (gravitateResult.isDataFound())
@@ -415,19 +413,20 @@
}
- private int createReference(Object o, ReferencesMap refMap)
+ private int createReference(Object o, Map<Object, Integer> refMap)
{
- int reference = refMap.nextAvailableReference();
- refMap.put(reference, o);
+ int reference = refMap.size();
+ refMap.put(o, reference);
return reference;
}
private void marshallString(String s, ObjectOutputStream out) throws Exception
{
+ //StringUtil.saveString(out, s);
out.writeObject(s);
}
- private void marshallMethodCall(MethodCall methodCall, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallMethodCall(MethodCall methodCall, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
out.writeShort(methodCall.getMethodId());
Object[] args = methodCall.getArgs();
@@ -440,14 +439,14 @@
}
}
- private void marshallGlobalTransaction(GlobalTransaction globalTransaction, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallGlobalTransaction(GlobalTransaction globalTransaction, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
out.writeLong(globalTransaction.getId());
marshallObject(globalTransaction.getAddress(), out, refMap);
}
- private void marshallFqn(Fqn fqn, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallFqn(Fqn fqn, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
boolean isRoot = fqn.isRoot();
out.writeBoolean(isRoot);
@@ -466,7 +465,7 @@
ipAddress.writeExternal(out);
}
- private void marshallCollection(Collection c, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallCollection(Collection c, ObjectOutputStream out, Map refMap) throws Exception
{
writeUnsignedInt(out, c.size());
for (Object o : c)
@@ -475,7 +474,7 @@
}
}
- private void marshallMap(Map map, ObjectOutputStream out, ReferencesMap refMap) throws Exception
+ private void marshallMap(Map map, ObjectOutputStream out, Map<Object, Integer> refMap) throws Exception
{
int mapSize = map.size();
writeUnsignedInt(out, mapSize);
@@ -810,50 +809,3 @@
out.writeLong(i);
}
}
-
-class ReferencesMap
-{
- private ArrayList<Object> referencedObjects = new ArrayList<Object>()
- {
- @Override
- public int indexOf(Object elem)
- {
- if (elem == null)
- {
- for (int i = 0; i < size(); i++)
- {
- if (get(i) == null) return i;
- }
- }
- else
- {
- for (int i = 0; i < size(); i++)
- {
- Object elInList = get(i);
- if (elInList.getClass().equals(elem.getClass()) && elem.equals(elInList)) return i;
- }
- }
- return -1;
- }
- };
-
- void put(int reference, Object object)
- {
- referencedObjects.add(reference, object);
- }
-
- Object get(int reference)
- {
- return referencedObjects.get(reference);
- }
-
- int nextAvailableReference()
- {
- return referencedObjects.size();
- }
-
- int getReference(Object object)
- {
- return referencedObjects.indexOf(object);
- }
-}
17 years
JBoss Cache SVN: r5037 - /.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-01-07 10:37:50 -0500 (Mon, 07 Jan 2008)
New Revision: 5037
Added:
benchmarks/
Log:
17 years
JBoss Cache SVN: r5036 - cache-bench-fwk/trunk/src/org/cachebench/tests.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-07 10:34:10 -0500 (Mon, 07 Jan 2008)
New Revision: 5036
Modified:
cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
Log:
added session simulator test + refactoring
Modified: cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-01-07 14:18:23 UTC (rev 5035)
+++ cache-bench-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-01-07 15:34:10 UTC (rev 5036)
@@ -20,11 +20,13 @@
private static final Log log = LogFactory.getLog(SessionSimulatorTest.class);
public static final String SESSION_PREFIX = "SESSION_";
+ private static int LOG_AFTER_OPERATION_COUNT = 5000;
Configuration configuration;
private TestConfig thisTestConfig;
private String sessionId;
private CacheWrapper cacheWrapper;
+
/**
* total number of request to be made against this session: reads + writes
*/
@@ -75,6 +77,7 @@
long start=System.currentTimeMillis();
for (int i = 0; i < numberOfRequests; i++)
{
+ logRunCount(i);
randomAction = r.nextInt(100);
randomAttribute = r.nextInt(numberOfAttributes - 1);
byte[] buf;
@@ -113,6 +116,14 @@
return result;
}
+ private void logRunCount(int i)
+ {
+ if (i % LOG_AFTER_OPERATION_COUNT == 0)
+ {
+ log.info("SessionSimulatorTest performed " + i + " oprations");
+ }
+ }
+
private void initSession() throws Exception
{
for (int i = 0; i < numberOfAttributes; i++)
17 years
JBoss Cache SVN: r5035 - cache-bench-fwk/trunk/src/org/cachebench/reportgenerators.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-01-07 09:18:23 -0500 (Mon, 07 Jan 2008)
New Revision: 5035
Added:
cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java
Log:
added session simulator test + refactoring
Added: cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java
===================================================================
--- cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java (rev 0)
+++ cache-bench-fwk/trunk/src/org/cachebench/reportgenerators/CsvStatisticReportGenerator.java 2008-01-07 14:18:23 UTC (rev 5035)
@@ -0,0 +1,106 @@
+package org.cachebench.reportgenerators;
+
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.cachebench.tests.results.StatisticTestResult;
+import org.cachebench.tests.results.TestResult;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+
+/**
+ * @author Manik Surtani (manik(a)surtani.org)
+ * @version $Id: CsvStatisticReportGenerator.java,v 1.5 2007/04/18 19:09:31 msurtani Exp $
+ */
+public class CsvStatisticReportGenerator extends CsvBaseReportGenerator
+{
+ public CsvStatisticReportGenerator()
+ {
+ log = LogFactory.getLog(this.getClass());
+ }
+
+ /**
+ * Writes out the report.
+ * The method checkes whether the result is passed or failed. And based on the status would generate the report with
+ * appropriate content. The method also checks whether the report has any foot notes attached to the test case. If
+ * any foot note is found, then its added to the <code>footNotes</code> ArrayList for later processing.
+ */
+ protected void writeTestResult(TestResult results, BufferedWriter writer) throws IOException
+ {
+ StatisticTestResult stResults = (StatisticTestResult) results;
+ log.debug("Writing the Result to the Report");
+ StringBuffer buf = new StringBuffer();
+ if (stResults.isTestPassed())
+ {
+ // This test has pased. Lets add this test results to the report.
+ DescriptiveStatistics putData = stResults.getPutData();
+ DescriptiveStatistics getData = stResults.getGetData();
+
+ buf.append(stResults.getTestName());
+ buf.append(",");
+ buf.append(stResults.getTestTime());
+ buf.append(",");
+ buf.append(stResults.getTestType());
+ buf.append(",");
+ buf.append(stResults.getNumMembers());
+ buf.append(",");
+ buf.append(stResults.getNumThreads());
+ buf.append(",");
+ buf.append(putData.getSum()/1000);
+ buf.append(",");
+ buf.append(getData.getSum()/1000);
+ buf.append(",");
+ buf.append(putData.getMean());
+ buf.append(",");
+ buf.append(getData.getMean());
+ buf.append(",");
+ // medians are the 50th percentile...
+ buf.append(putData.getPercentile(50));
+ buf.append(",");
+ buf.append(getData.getPercentile(50));
+ buf.append(",");
+ buf.append(putData.getStandardDeviation());
+ buf.append(",");
+ buf.append(getData.getStandardDeviation());
+ buf.append(",");
+ buf.append(putData.getMax());
+ buf.append(",");
+ buf.append(getData.getMax());
+ buf.append(",");
+ buf.append(putData.getMin());
+ buf.append(",");
+ buf.append(getData.getMin());
+ buf.append(",");
+ buf.append(stResults.getThroughputTransactionsPerSecond());
+ buf.append(",");
+ buf.append(stResults.getThroughputBytesPerSecond());
+ }
+ else
+ {
+ // This test has failed. Need to add this to the report.
+ buf.append(stResults.getTestName());
+ buf.append(",");
+ buf.append(stResults.getTestTime());
+ buf.append(",");
+ buf.append(stResults.getTestType());
+ buf.append(",");
+ buf.append(stResults.getErrorMsg());
+ }
+
+ // write details of this test to file.
+ writer.write(buf.toString());
+ writer.newLine();
+ }
+
+ protected void writeHeaderLine(BufferedWriter writer) throws IOException
+ {
+ log.debug("Write the Report Header");
+ writer.write("TEST NAME, TEST DATE, TEST TYPE, NUM MEMBERS, NUM THREADS, TOTAL PUT TIME (secs), TOTAL GET TIME (secs), MEAN PUT TIME, MEAN GET TIME, MEDIAN PUT TIME, MEDIAN GET TIME, STANDARD DEVIATION PUT TIME, STANDARD DEVIATION GET TIME, MAX PUT TIME, MAX GET TIME, MIN PUT TIME, MIN GET TIME, THROUGHPUT TRANSACTIONS PER SEC, THROUGHPUT BYTES PER SEC");
+ writer.newLine();
+ log.debug("Complted the Report Header");
+ }
+
+
+}
17 years