JBoss Cache SVN: r6342 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 14:02:19 -0400 (Fri, 18 Jul 2008)
New Revision: 6342
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 17:53:49 UTC (rev 6341)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 18:02:19 UTC (rev 6342)
@@ -300,7 +300,7 @@
}
catch (Exception ex)
{
- log.warn("problems closing the connection", ex);
+// log.warn("problems closing the connection", ex);
}
}
17 years, 5 months
JBoss Cache SVN: r6341 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 13:53:49 -0400 (Fri, 18 Jul 2008)
New Revision: 6341
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 17:33:30 UTC (rev 6340)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 17:53:49 UTC (rev 6341)
@@ -213,7 +213,7 @@
recieversCount++;
}
catch (Exception e) {
- log.warn("failure sending message to " + c, e);
+// log.warn("failure sending message to " + c, e);
}
}
}
17 years, 5 months
JBoss Cache SVN: r6340 - benchmarks/benchmark-fwk/trunk.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 13:33:30 -0400 (Fri, 18 Jul 2008)
New Revision: 6340
Modified:
benchmarks/benchmark-fwk/trunk/killNode.sh
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/killNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/killNode.sh 2008-07-18 16:59:00 UTC (rev 6339)
+++ benchmarks/benchmark-fwk/trunk/killNode.sh 2008-07-18 17:33:30 UTC (rev 6340)
@@ -4,19 +4,9 @@
#
# This script allows you to kill benchmark runner instances started with runNode.sh
#
-# Note that runNode.sh will create a PID.pid file in the current directory, which
-# this script will use to get the process id of the process to kill.
-#
##################################################################################
-PIDFILE=PID.`hostname -s`.pid
-
-if [ -e ${PIDFILE} ]
-then
- pid=`cat ${PIDFILE}`
- echo "Killing process ${pid}"
- kill -9 ${pid}
- rm ${PIDFILE}
-fi
-
+ps -elf | grep cacheBenchFwk.cacheWrapperClassName | grep -v grep | cut -d \ -f 5 | xargs kill -9
+ps -elf | grep allJBossCacheTests.sh | grep -v grep | cut -d \ -f 5 | xargs kill -9
+ps -elf | grep /runNode.sh | grep -v grep | cut -d \ -f 5 | xargs kill -9
exit 0
\ No newline at end of file
17 years, 5 months
JBoss Cache SVN: r6339 - in searchable/trunk: src/main/java/org/jboss/cache/search and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: navssurtani
Date: 2008-07-18 12:59:00 -0400 (Fri, 18 Jul 2008)
New Revision: 6339
Modified:
searchable/trunk/pom.xml
searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCoreListener.java
Log:
Changed pom dependency for HS, refactored searchFactoryImpl to SearchFactoryImplementor
Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/pom.xml 2008-07-18 16:59:00 UTC (rev 6339)
@@ -36,9 +36,9 @@
</dependency>
<dependency>
- <groupId>org.hibernate.sandbox</groupId>
- <artifactId>hibernate-search-gsoc</artifactId>
- <version>3.1.1-SNAPSHOT</version>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-search</artifactId>
+ <version>3.1.0.Beta1</version>
</dependency>
<dependency>
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/CacheQueryImpl.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -5,7 +5,6 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.*;
-import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.search.FullTextFilter;
import org.hibernate.search.SearchException;
@@ -46,7 +45,7 @@
private Sort sort;
private Filter filter;
private Map<String, FullTextFilterImpl> filterDefinitions;
- private SearchFactoryImpl searchFactory;
+ private SearchFactoryImplementor searchFactory;
private Integer firstResult;
private Integer resultSize;
private Integer maxResults;
@@ -60,7 +59,7 @@
CacheEntityLoader entityLoader;
- public CacheQueryImpl(Query luceneQuery, SearchFactoryImpl searchFactory, Cache cache)
+ public CacheQueryImpl(Query luceneQuery, SearchFactoryImplementor searchFactory, Cache cache)
{
this.luceneQuery = luceneQuery;
// this.cache = cache;
@@ -68,7 +67,7 @@
this.searchFactory = searchFactory;
}
- public CacheQueryImpl(Query luceneQuery, SearchFactoryImpl searchFactory, Cache cache, Class... classes)
+ public CacheQueryImpl(Query luceneQuery, SearchFactoryImplementor searchFactory, Cache cache, Class... classes)
{
this(luceneQuery, searchFactory, cache);
this.classes = classes;
@@ -217,7 +216,7 @@
int size = max - first + 1 < 0 ? 0 : max - first + 1;
ids = new ArrayList<CacheEntityId>(size);
- DocumentExtractor extractor = new DocumentExtractor(searchFactory, indexProjection);
+ DocumentExtractor extractor = new DocumentExtractor(luceneQuery, searcher, searchFactory, indexProjection);
for (int index = first; index <= max; index++)
{
String documentId = (String) extractor.extract(hits, index).id;
@@ -266,7 +265,7 @@
int size = max - first + 1 < 0 ? 0 : max - first + 1;
List<CacheEntityId> ids = new ArrayList<CacheEntityId>(size);
- DocumentExtractor extractor = new DocumentExtractor(searchFactory, indexProjection);
+ DocumentExtractor extractor = new DocumentExtractor(luceneQuery, searcher, searchFactory, indexProjection);
for (int index = first; index <= max; index++)
{
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/NodeModifiedTransactionContext.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -1,13 +1,13 @@
package org.jboss.cache.search;
-import org.hibernate.search.transaction.TransactionContext;
+import org.hibernate.search.backend.TransactionContext;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
import javax.transaction.Synchronization;
import javax.transaction.Transaction;
/**
- * This class implements the {@link org.hibernate.search.transaction.TransactionContext} interface. It
+ * This class implements the {@link org.hibernate.search.backend.TransactionContext} interface. It
* retrieves transaction context information from the {@link org.jboss.cache.notifications.event.NodeModifiedEvent} that gets passed in.
* <p />
* It is used by the {@link SearchableCoreListener} to pass transaction information to a Hibernate Search {@link org.hibernate.search.backend.Work} object.
@@ -37,7 +37,7 @@
* an org.hibernate transaction).
* @return true if a transaction is in progress, false otherwise.
*/
- public boolean isTxInProgress()
+ public boolean isTransactionInProgress()
{
return (event.getTransaction() != null);
}
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/QueryResultIteratorImpl.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -7,7 +7,7 @@
/**
* This is the implementation class for the interface QueryResultIterator which extends ListIterator. It is what is
- * returned when the iterate() method is run on a CacheQuery instance.
+ * returned when the iterator() method is run on a CacheQuery instance.
*
* @author Navin Surtani - navin(a)surtani.org
*/
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheFactory.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -2,6 +2,7 @@
import org.hibernate.search.impl.SearchFactoryImpl;
import org.hibernate.search.cfg.SearchConfiguration;
+import org.hibernate.search.engine.SearchFactoryImplementor;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheStatus;
import org.apache.commons.logging.Log;
@@ -62,7 +63,7 @@
SearchConfiguration cfg = new SearchableCacheCfgImpl(classes, properties);
// set classes in the cfg
- SearchFactoryImpl searchFactory = new SearchFactoryImpl(cfg);
+ SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
// boolean isPojoCache = c instanceof PojoCache; keep this for later usage
// Step 2: Add cache listener to listen for events happening in the cache.
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCacheImpl.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -2,6 +2,7 @@
import org.apache.lucene.search.Query;
import org.hibernate.search.impl.SearchFactoryImpl;
+import org.hibernate.search.engine.SearchFactoryImplementor;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheStatus;
@@ -28,9 +29,9 @@
private Cache<K, V> cache;
- private SearchFactoryImpl searchFactory;
+ private SearchFactoryImplementor searchFactory;
- public SearchableCacheImpl(Cache<K, V> cache, SearchFactoryImpl searchFactory)
+ public SearchableCacheImpl(Cache<K, V> cache, SearchFactoryImplementor searchFactory)
{
if (cache == null) throw new NullPointerException("Cache is null");
if (searchFactory == null) throw new NullPointerException("searchFactory is null");
Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCoreListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCoreListener.java 2008-07-18 16:48:45 UTC (rev 6338)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchableCoreListener.java 2008-07-18 16:59:00 UTC (rev 6339)
@@ -1,9 +1,10 @@
package org.jboss.cache.search;
import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.transaction.TransactionContext;
+import org.hibernate.search.backend.TransactionContext;
import org.hibernate.search.backend.Work;
import org.hibernate.search.backend.WorkType;
+import org.hibernate.search.engine.SearchFactoryImplementor;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeModified;
import org.jboss.cache.notifications.event.NodeModifiedEvent;
@@ -20,10 +21,10 @@
@CacheListener
public class SearchableCoreListener
{
- private SearchFactoryImpl searchFactory;
+ private SearchFactoryImplementor searchFactory;
private static final Log log = LogFactory.getLog(SearchableCoreListener.class);
- public SearchableCoreListener(SearchFactoryImpl searchFactory)
+ public SearchableCoreListener(SearchFactoryImplementor searchFactory)
{
this.searchFactory = searchFactory;
@@ -68,7 +69,7 @@
*/
- protected void handlePutData(NodeModifiedEvent event, SearchFactoryImpl searchFactory) throws InvalidKeyException
+ protected void handlePutData(NodeModifiedEvent event, SearchFactoryImplementor searchFactory) throws InvalidKeyException
{
Map dataMap = event.getData();
if (log.isTraceEnabled()) log.trace("Called event.getData() and saved to a Map");
@@ -109,7 +110,7 @@
* @param searchFactory - a SearchFactoryImpl instance.
* @throws InvalidKeyException
*/
- protected void handleDeleteData(NodeModifiedEvent event, SearchFactoryImpl searchFactory) throws InvalidKeyException
+ protected void handleDeleteData(NodeModifiedEvent event, SearchFactoryImplementor searchFactory) throws InvalidKeyException
{
Map dataMap = event.getData();
17 years, 5 months
JBoss Cache SVN: r6338 - in benchmarks/benchmark-fwk/trunk/src/org/cachebench: tests and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 12:48:45 -0400 (Fri, 18 Jul 2008)
New Revision: 6338
Added:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Message.java
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/ClusterBarrier.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Transport.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/ClusterBarrier.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/ClusterBarrier.java 2008-07-18 15:52:27 UTC (rev 6337)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/ClusterBarrier.java 2008-07-18 16:48:45 UTC (rev 6338)
@@ -82,7 +82,7 @@
if (errorMessage != null)
{
//might be that I am the intruder, give other members a chance to fail aswell
- transport.send(null, message);
+ transport.send(message);
transport.stop();
Thread.sleep(2000);
throw new IllegalStateException(errorMessage);
@@ -91,11 +91,11 @@
}
}
log.trace("sending message " + message + ", expecting " + getMissingMembersCount() + " member(s)");
- transport.send(null, message);
+ transport.send(message);
if (acknowledge)
{
log.trace("Send ack also");
- transport.send(null, getAcknowledgeMessage(message));
+ transport.send(getAcknowledgeMessage(message));
}
}
}
@@ -111,7 +111,7 @@
if (acknowledge && !isAcknowledgeMessage(payload))
{
log.trace("Sending ack, still expecting " + getMissingMembersCount() + " members.");
- transport.send(null, getAcknowledgeMessage(message));
+ transport.send(getAcknowledgeMessage(message));
return;
}
Added: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Message.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Message.java (rev 0)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Message.java 2008-07-18 16:48:45 UTC (rev 6338)
@@ -0,0 +1,27 @@
+package org.cachebench.cluster;
+
+import java.io.Serializable;
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+
+/**
+ * Encapsulates an message to be send on the wire.
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class Message implements Serializable {
+ private InetSocketAddress source;
+ private Object payload;
+
+ public Message(InetSocketAddress source, Object payload) {
+ this.source = source;
+ this.payload = payload;
+ }
+
+ public InetSocketAddress getSource() {
+ return source;
+ }
+
+ public Object getPayload() {
+ return payload;
+ }
+}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 15:52:27 UTC (rev 6337)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/TcpTransport.java 2008-07-18 16:48:45 UTC (rev 6338)
@@ -29,7 +29,7 @@
int startPort = 7800;
ServerSocket srvSock = null;
InetAddress bindAddr = null;
- SocketAddress localAddr = null;
+ InetSocketAddress localAddr = null;
List receivers = new ArrayList();
private ServerSocket server;
private boolean isStoping;
@@ -162,10 +162,8 @@
return null;
}
- public void send(Object destination, Object payload) throws Exception
+ public void send(Object payload) throws Exception
{
- if (destination != null)
- throw new Exception("TcpTransport.send(): unicasts not supported");
connectionTable.writeMessage(payload);
}
@@ -208,19 +206,14 @@
void writeMessage(Object msg) throws Exception
{
int recieversCount = 0;
- for (int i = 0; i < connections.length; i++)
- {
- Connection c = connections[i];
- if (c != null)
- {
- try
- {
+ for (Connection c : connections) {
+ if (c != null) {
+ try {
c.writeMessage(msg);
- recieversCount ++;
+ recieversCount++;
}
- catch (Exception e)
- {
- // System.err.println("failed sending msg on " + c);
+ catch (Exception e) {
+ log.warn("failure sending message to " + c, e);
}
}
}
@@ -291,7 +284,8 @@
createSocket();
}
ObjectOutputStream oos = new ObjectOutputStream(out);
- oos.writeObject(msg);
+ Message message = new Message(localAddr, msg);
+ oos.writeObject(message);
}
out.flush();
}
@@ -306,6 +300,7 @@
}
catch (Exception ex)
{
+ log.warn("problems closing the connection", ex);
}
}
@@ -336,9 +331,9 @@
{
try
{
- Object message = new ObjectInputStream(in).readObject();
+ Message message = (Message) new ObjectInputStream(in).readObject();
if (receiver != null)
- receiver.receive(remote, message);
+ receiver.receive(message.getSource(), message.getPayload());
}
catch (Exception e) {
break;
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Transport.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Transport.java 2008-07-18 15:52:27 UTC (rev 6337)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/cluster/Transport.java 2008-07-18 16:48:45 UTC (rev 6338)
@@ -46,9 +46,8 @@
/**
* Send a message
- * @param destination A destination. If null, send a message to all members
* @param payload A buffer to be sent
* @throws Exception
*/
- void send(Object destination, Object payload) throws Exception;
+ void send(Object payload) throws Exception;
}
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java 2008-07-18 15:52:27 UTC (rev 6337)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/ReplicationOccursTest.java 2008-07-18 16:48:45 UTC (rev 6338)
@@ -212,7 +212,7 @@
{
totalValue += Integer.valueOf(val.toString());
}
- log.info("********** Overall replication count is: " + totalValue);
+ log.info("Overall replication count is: " + totalValue);
//this means SOME replication occurred. This does not mean, though, that all nodes replicated successfuly.
//correct condition would be >= this.conf.getClusterConfig().getClusterSize()
//todo/FIXME - this seem not to work with all the products, so we will accept 'some replication'
@@ -221,7 +221,6 @@
log.warn("The replication was not total, but partial!!");
}
boolean isReplicationSuccess = totalValue > 0;
- log.info("Is replication passed? " + isReplicationSuccess);
return isReplicationSuccess;
}
}
17 years, 5 months
JBoss Cache SVN: r6337 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 11:52:27 -0400 (Fri, 18 Jul 2008)
New Revision: 6337
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java 2008-07-18 15:52:14 UTC (rev 6336)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java 2008-07-18 15:52:27 UTC (rev 6337)
@@ -39,6 +39,6 @@
}
private String appendNodeIndex(String s) {
- return s + "_" + conf.getCurrentNodeIndex();
+ return conf.getCurrentNodeIndex() + "_" + s;
}
}
17 years, 5 months
JBoss Cache SVN: r6336 - benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 11:52:14 -0400 (Fri, 18 Jul 2008)
New Revision: 6336
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
Log:
Modified: benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
17 years, 5 months
JBoss Cache SVN: r6335 - in core/trunk/src/main/java/org/jboss/cache: mvcc and 1 other directory.
by jbosscache-commits@lists.jboss.org
Author: manik.surtani(a)jboss.com
Date: 2008-07-18 11:47:42 -0400 (Fri, 18 Jul 2008)
New Revision: 6335
Modified:
core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
Log:
Further enhancements
Modified: core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-18 15:03:00 UTC (rev 6334)
+++ core/trunk/src/main/java/org/jboss/cache/PessimisticUnversionedNode.java 2008-07-18 15:47:42 UTC (rev 6335)
@@ -71,6 +71,15 @@
return sb.toString();
}
+ @SuppressWarnings("unchecked")
+ @Override
+ public InternalNode<K, V> copy()
+ {
+ PessimisticUnversionedNode<K, V> n = new PessimisticUnversionedNode<K, V>(fqn.getLastElement(), fqn, data, cache);
+ copyInternals(n);
+ return n;
+ }
+
// ------ legacy addChild methods that used a lot of implicit locks.
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-18 15:03:00 UTC (rev 6334)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/ReadCommittedNode.java 2008-07-18 15:47:42 UTC (rev 6335)
@@ -10,6 +10,7 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.invocation.NodeInvocationDelegate;
+import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.*;
/**
* A node delegate that encapsulates read committed semantics when writes are initiated, committed or rolled back.
@@ -23,15 +24,55 @@
private static final boolean trace = log.isTraceEnabled();
protected volatile InternalNode backup;
- protected boolean changed;
- protected boolean created;
- protected boolean deleted;
+ protected byte flags = 0;
+ protected static enum Flags
+ {
+ CHANGED(0x1), CREATED(0x2), DELETED(0x4);
+ final byte mask;
+
+ Flags(int mask)
+ {
+ this.mask = (byte) mask;
+ }
+ }
+
public ReadCommittedNode(InternalNode node)
{
super(node);
}
+ /**
+ * Tests whether a flag is set.
+ *
+ * @param flag flag to test
+ * @return true if set, false otherwise.
+ */
+ protected final boolean isFlagSet(Flags flag)
+ {
+ return (flags & flag.mask) != 0;
+ }
+
+ /**
+ * Unility method that sets the value of the given flag to true.
+ *
+ * @param flag flag to set
+ */
+ protected final void setFlag(Flags flag)
+ {
+ flags |= flag.mask;
+ }
+
+ /**
+ * Utility method that sets the value of the flag to false.
+ *
+ * @param flag flag to unset
+ */
+ protected final void unsetFlag(Flags flag)
+ {
+ flags ^= flag.mask;
+ }
+
public boolean isNullNode()
{
return false;
@@ -48,10 +89,10 @@
*/
public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
{
- if (changed) return; // already copied
+ if (isFlagSet(CHANGED)) return; // already copied
- changed = true;
- if (!created)
+ setFlag(CHANGED);
+ if (!isFlagSet(CREATED))
{
backup = node;
InternalNode backupDelegationTarget = ((NodeReference) backup).getDelegate();
@@ -68,14 +109,14 @@
*/
public void commitUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory)
{
- if (changed)
+ if (isFlagSet(CHANGED))
{
Fqn fqn = getFqn();
if (trace)
- log.trace("Updating node [" + fqn + "]. deleted=" + isDeleted() + " valid=" + isValid() + " changed=" + isChanged() + " created=" + created);
+ log.trace("Updating node [" + fqn + "]. deleted=" + isDeleted() + " valid=" + isValid() + " changed=" + isChanged() + " created=" + isFlagSet(CREATED));
// check if node has been deleted.
- if (deleted)
+ if (isFlagSet(DELETED))
{
if (!fqn.isRoot())
{
@@ -89,7 +130,7 @@
log.warn("Attempting to remove the root node. Not doing anything!");
}
}
- else if (created)
+ else if (isFlagSet(CREATED))
{
// add newly created nodes to parents.
NodeSPI parent = lookupParent(fqn, ctx, container);
@@ -107,9 +148,7 @@
private void reset()
{
backup = null;
- changed = false;
- created = false;
- deleted = false;
+ flags = 0;
}
/**
@@ -143,15 +182,14 @@
protected void updateNode(InvocationContext ctx, DataContainer dataContainer, NodeFactory nf)
{
// swap refs
- if (!created) ((NodeReference) backup).setDelegate(node);
+ if (!isFlagSet(CREATED)) ((NodeReference) backup).setDelegate(node);
node = backup;
}
public void rollbackUpdate()
{
node = backup;
- backup = null;
- changed = false;
+ reset();
}
/**
@@ -159,7 +197,7 @@
*/
public boolean isChanged()
{
- return changed;
+ return isFlagSet(CHANGED);
}
/**
@@ -167,12 +205,15 @@
*/
public boolean isCreated()
{
- return created;
+ return isFlagSet(CREATED);
}
public void setCreated(boolean created)
{
- this.created = created;
+ if (created)
+ setFlag(CREATED);
+ else
+ unsetFlag(CREATED);
}
// do not propagate deletion flags to the underlying node.
@@ -180,13 +221,16 @@
@Override
public boolean isDeleted()
{
- return deleted;
+ return isFlagSet(DELETED);
}
@Override
public void markAsDeleted(boolean deleted)
{
- this.deleted = deleted;
+ if (deleted)
+ setFlag(DELETED);
+ else
+ unsetFlag(DELETED);
}
@Override
Modified: core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java
===================================================================
--- core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-18 15:03:00 UTC (rev 6334)
+++ core/trunk/src/main/java/org/jboss/cache/mvcc/RepeatableReadNode.java 2008-07-18 15:47:42 UTC (rev 6335)
@@ -9,6 +9,8 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.invocation.InvocationContext;
import org.jboss.cache.invocation.NodeInvocationDelegate;
+import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.CHANGED;
+import static org.jboss.cache.mvcc.ReadCommittedNode.Flags.DELETED;
import org.jboss.cache.optimistic.DataVersioningException;
/**
@@ -29,12 +31,12 @@
@Override
public void markForUpdate(InvocationContext ctx, DataContainer container, NodeFactory nodeFactory, boolean writeSkewCheck)
{
- if (changed) return; // already copied
+ if (isFlagSet(CHANGED)) return; // already copied
Fqn fqn = getFqn();
// mark node as changed.
- changed = true;
+ setFlag(CHANGED);
if (writeSkewCheck)
{
@@ -61,7 +63,7 @@
{
dataContainer.setRoot(nf.createNodeInvocationDelegate(node, false));
}
- else if (!deleted)
+ else if (!isFlagSet(DELETED))
{
NodeSPI parent = lookupParent(getFqn(), ctx, dataContainer);
parent.addChildDirect(nf.createNodeInvocationDelegate(node, false));
17 years, 5 months
JBoss Cache SVN: r6334 - benchmarks/benchmark-fwk/trunk/conf.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 11:03:00 -0400 (Fri, 18 Jul 2008)
New Revision: 6334
Modified:
benchmarks/benchmark-fwk/trunk/conf/log4j.xml
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/conf/log4j.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-18 15:02:20 UTC (rev 6333)
+++ benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-18 15:03:00 UTC (rev 6334)
@@ -82,8 +82,8 @@
<!-- Here goes the root -->
<root>
<priority value="INFO"/>
- <!--<appender-ref ref="FILE" />-->
- <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE" />
+ <!--<appender-ref ref="CONSOLE"/>-->
</root>
</log4j:configuration>
17 years, 5 months
JBoss Cache SVN: r6333 - in benchmarks/benchmark-fwk/trunk: conf and 1 other directories.
by jbosscache-commits@lists.jboss.org
Author: mircea.markus
Date: 2008-07-18 11:02:20 -0400 (Fri, 18 Jul 2008)
New Revision: 6333
Added:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java
Modified:
benchmarks/benchmark-fwk/trunk/conf/log4j.xml
benchmarks/benchmark-fwk/trunk/runNode.sh
Log:
enhanced logging
Modified: benchmarks/benchmark-fwk/trunk/conf/log4j.xml
===================================================================
--- benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-18 15:00:44 UTC (rev 6332)
+++ benchmarks/benchmark-fwk/trunk/conf/log4j.xml 2008-07-18 15:02:20 UTC (rev 6333)
@@ -5,7 +5,7 @@
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- The list of appenders -->
<!-- The rolling file appender -->
- <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <appender name="FILE" class="org.cachebench.utils.PerNodeRollingFileAppender">
<param name="File" value="cachebench.log"/>
<param name="Append" value="true"/>
<param name="Threshold" value="TRACE"/>
Modified: benchmarks/benchmark-fwk/trunk/runNode.sh
===================================================================
--- benchmarks/benchmark-fwk/trunk/runNode.sh 2008-07-18 15:00:44 UTC (rev 6332)
+++ benchmarks/benchmark-fwk/trunk/runNode.sh 2008-07-18 15:02:20 UTC (rev 6333)
@@ -22,7 +22,7 @@
echo param [test config file] : configuration file to use with the cache product. Typically resides in './cache-products/XXX/conf/'
echo param [cluster size] : total number of nodes that will run tests.
echo
- echo Example: './runNode.sh 0 jbosscache-2.0.0 repl_async.xml 3' will start the 1st node running an instance of jbc2.0.0 on a cluster made out of 3 nodes, using the repl_async configuration.
+ echo Example: './runNode.sh 0 jbosscache-2.2.0 pess-repl-sync.xml 3' will start the 1st node running an instance of jbc2.0.0 on a cluster made out of 3 nodes, using the repl_async configuration.
exit 1
fi
Added: benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java (rev 0)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/utils/PerNodeRollingFileAppender.java 2008-07-18 15:02:20 UTC (rev 6333)
@@ -0,0 +1,44 @@
+/*
+ * 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.cachebench.utils;
+
+import org.apache.log4j.RollingFileAppender;
+import org.cachebench.config.ClusterConfig;
+
+/**
+ * Apends an node instance identifier at the end of the filename.
+ *
+ * @author Mircea.Markus(a)jboss.com
+ */
+public class PerNodeRollingFileAppender extends RollingFileAppender
+{
+ ClusterConfig conf = new ClusterConfig();
+
+ @Override
+ public void setFile(String s) {
+ super.setFile(appendNodeIndex(s));
+ }
+
+ private String appendNodeIndex(String s) {
+ return s + "_" + conf.getCurrentNodeIndex();
+ }
+}
17 years, 5 months