[jboss-cvs] JBoss Messaging SVN: r7559 - in branches/Branch_MultiThreaded_Replication: src/main/org/jboss/messaging/core/server/replication/impl and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 10 08:41:48 EDT 2009


Author: timfox
Date: 2009-07-10 08:41:48 -0400 (Fri, 10 Jul 2009)
New Revision: 7559

Modified:
   branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
   branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/server/replication/impl/ReplicationAwareReadWriteLock.java
   branches/Branch_MultiThreaded_Replication/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
Log:
MT replication

Modified: branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java	2009-07-10 12:19:49 UTC (rev 7558)
+++ branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java	2009-07-10 12:41:48 UTC (rev 7559)
@@ -725,7 +725,7 @@
 
       try
       {
-         log.info(System.identityHashCode(this) + " session handling failover");
+        // log.info(System.identityHashCode(this) + " session handling failover");
          
          //Prevent any more packets being handled on the old connection
          channel.getConnection().freeze();
@@ -738,7 +738,7 @@
 
          int lid = channel.getLastConfirmedCommandID();
          
-         log.info(System.identityHashCode(this) + " last received command id on client side is " + lid);
+      //   log.info(System.identityHashCode(this) + " last received command id on client side is " + lid);
          
          Packet request = new ReattachSessionMessage(name, lid);
 

Modified: branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/server/replication/impl/ReplicationAwareReadWriteLock.java
===================================================================
--- branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/server/replication/impl/ReplicationAwareReadWriteLock.java	2009-07-10 12:19:49 UTC (rev 7558)
+++ branches/Branch_MultiThreaded_Replication/src/main/org/jboss/messaging/core/server/replication/impl/ReplicationAwareReadWriteLock.java	2009-07-10 12:41:48 UTC (rev 7559)
@@ -22,14 +22,10 @@
 
 package org.jboss.messaging.core.server.replication.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
@@ -150,6 +146,8 @@
 //      }
 //   }
 
+   private AtomicLong lastSequence = new AtomicLong(0);
+   
    private boolean doLock(long time, TimeUnit unit, boolean read) throws InterruptedException
    {
       JBMThread thread = JBMThread.currentThread();
@@ -167,7 +165,20 @@
 
       if (thread.isReplay())
       {
-         long sequence = thread.getNextSequence();
+         long sequence;
+         
+         try
+         {
+            sequence = thread.getNextSequence();
+            
+            lastSequence.set(sequence);
+         }
+         catch (IndexOutOfBoundsException e)
+         {
+            //This can occur if waiting for thread to complete on failover and we've allowed threads to executing in a different
+            //order due to setting non strict, so we just set sequence to last sequence + 1
+            sequence = lastSequence.incrementAndGet();            
+         }
 
 //         if (debug)
 //         {

Modified: branches/Branch_MultiThreaded_Replication/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- branches/Branch_MultiThreaded_Replication/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java	2009-07-10 12:19:49 UTC (rev 7558)
+++ branches/Branch_MultiThreaded_Replication/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java	2009-07-10 12:41:48 UTC (rev 7559)
@@ -326,7 +326,7 @@
 
       final int numMessages = 100;
 
-      final int numSessions = 1;
+      final int numSessions = 10;
 
       Set<ClientConsumer> consumers = new HashSet<ClientConsumer>();
       Set<ClientSession> sessions = new HashSet<ClientSession>();




More information about the jboss-cvs-commits mailing list