[jboss-cvs] JBoss Messaging SVN: r5552 - in trunk: src/main/org/jboss/messaging/core/paging/impl and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Dec 20 12:40:43 EST 2008


Author: timfox
Date: 2008-12-20 12:40:43 -0500 (Sat, 20 Dec 2008)
New Revision: 5552

Modified:
   trunk/build-messaging.xml
   trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
   trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java
   trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
   trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
Log:
Fix tests, tweaks etc


Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/build-messaging.xml	2008-12-20 17:40:43 UTC (rev 5552)
@@ -1022,7 +1022,7 @@
 
    <target name="all-tests" depends="unit-tests, integration-tests, concurrent-tests, stress-tests, jms-tests"/>
 
-   <target name="hudson-tests" depends="unit-tests, integration-tests, concurrent-tests, stress-tests, timing-tests, jms-tests"/>
+   <target name="hudson-tests" depends="unit-tests, integration-tests, concurrent-tests, timing-tests, jms-tests"/>
 
    <target name="compile-reports">
       <mkdir dir="${test.stylesheets.dir}"/>

Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -705,22 +705,18 @@
 
    /**
     * This method will remove files from the page system and and route them, doing it transactionally
-    * 
-    * A Transaction will be opened only if persistent messages are used.
-    * 
+    *     
     * If persistent messages are also used, it will update eventual PageTransactions
     */
    
    private void onDepage(final int pageId, final SimpleString destination, final List<PagedMessage> pagedMessages) throws Exception
    {
       trace("Depaging....");
-      
-      log.info("depaging " + pagedMessages.size() + " messages");
-            
+
       // Depage has to be done atomically, in case of failure it should be
       // back to where it was
 
-      Transaction depageTransaction = new TransactionImpl(storageManager, postOffice);
+      Transaction depageTransaction = new TransactionImpl(storageManager, postOffice, true);
 
       LastPageRecord lastPageRecord = getLastPageRecord();
 
@@ -857,6 +853,8 @@
    private void openNewPage() throws Exception
    {
       currentPageLock.writeLock().lock();
+      
+   //   log.info("Opening new page");
 
       try
       {

Modified: trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -83,6 +83,9 @@
    private final Object timeoutLock = new Object();
 
    private final long createTime;
+   
+   //For a transaction used for depaging, we never want to immediately page the refs again
+   private final boolean depage;
 
    public TransactionImpl(final StorageManager storageManager, final PostOffice postOffice)
    {
@@ -104,8 +107,34 @@
       id = storageManager.generateUniqueID();
 
       createTime = System.currentTimeMillis();
+      
+      this.depage = false;
    }
+   
+   public TransactionImpl(final StorageManager storageManager, final PostOffice postOffice, final boolean depage)
+   {
+      this.storageManager = storageManager;
 
+      this.postOffice = postOffice;
+
+      if (postOffice == null)
+      {
+         pagingManager = null;
+      }
+      else
+      {
+         pagingManager = postOffice.getPagingManager();
+      }
+
+      xid = null;
+
+      id = storageManager.generateUniqueID();
+
+      createTime = System.currentTimeMillis();
+      
+      this.depage = depage;
+   }
+
    public TransactionImpl(final Xid xid, final StorageManager storageManager, final PostOffice postOffice)
    {
       this.storageManager = storageManager;
@@ -126,6 +155,8 @@
       id = storageManager.generateUniqueID();
 
       createTime = System.currentTimeMillis();
+      
+      this.depage = false;
    }
 
    public TransactionImpl(final long id, final Xid xid, final StorageManager storageManager, final PostOffice postOffice)
@@ -148,6 +179,8 @@
       }
 
       createTime = System.currentTimeMillis();
+      
+      this.depage = false;
    }
 
    // Transaction implementation
@@ -174,7 +207,7 @@
 
       SimpleString destination = message.getDestination();
 
-      if (destinationsInPageMode.contains(destination) || pagingManager.isPaging(destination))
+      if (!depage && (destinationsInPageMode.contains(destination) || pagingManager.isPaging(destination)))
       {
          destinationsInPageMode.add(destination);
          pagedMessages.add(message);
@@ -319,7 +352,6 @@
             storageManager.commit(id);
          }
 
-         log.info("delivering " + refsToAdd.size() + " refs");
          postOffice.deliver(refsToAdd);
 
          // If part of the transaction goes to the queue, and part goes to paging, we can't let depage start for the
@@ -529,8 +561,7 @@
    private void route(final ServerMessage message) throws Exception
    {
       List<MessageReference> refs = postOffice.route(message, this, false);
-      
-      log.info("routed to " + refs.size() + " refs");
+            
       refsToAdd.addAll(refs);
 
       if (message.getDurableRefCount() != 0)

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareQueueControlWrapperTest.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -22,6 +22,26 @@
 
 package org.jboss.messaging.tests.integration.cluster.management;
 
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_CONNECTIONS;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_AFTER_FAILOVER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MAX_RETRIES_BEFORE_FAILOVER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PING_PERIOD;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER;
+import static org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl.DEFAULT_SEND_WINDOW_SIZE;
 import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
 import static org.jboss.messaging.tests.util.RandomUtil.randomSimpleString;
 import static org.jboss.messaging.tests.util.RandomUtil.randomString;
@@ -58,8 +78,6 @@
 
    private SimpleString address;
 
-   private final long timeToSleep = 100;
-
    // Static --------------------------------------------------------
 
    private static QueueControlMBean createQueueControl(SimpleString address, SimpleString name, MBeanServer mbeanServer) throws Exception
@@ -93,9 +111,6 @@
       message.setPriority(oldPriority);
       producer.send(message);
       
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -137,9 +152,6 @@
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createClientMessage(false));
       
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -177,9 +189,6 @@
       matchingMessage.putLongProperty(key, matchingValue);
       producer.send(matchingMessage);
       
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check messages are on both live & backup nodes
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
@@ -215,9 +224,6 @@
       message.putLongProperty(key, value);
       producer.send(message);
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep);
-
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
       assertEquals(0, liveOtherQueueControl.getMessageCount());
@@ -260,9 +266,6 @@
       matchingMessage.putLongProperty(key, matchingValue);
       producer.send(matchingMessage);
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep);
-      
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
       assertEquals(0, liveOtherQueueControl.getMessageCount());
@@ -298,9 +301,6 @@
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createClientMessage(false));
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -335,9 +335,6 @@
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createClientMessage(false));
 
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -369,9 +366,6 @@
       matchingMessage.putLongProperty(key, matchingValue);
       producer.send(matchingMessage);
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep );
-      
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
 
@@ -395,9 +389,6 @@
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createClientMessage(false));
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -426,9 +417,6 @@
       ClientProducer producer = session.createProducer(address);
       producer.send(session.createClientMessage(false));
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -496,7 +484,27 @@
 
       ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new TransportConfiguration(InVMConnectorFactory.class.getName()),
                                                                      new TransportConfiguration(InVMConnectorFactory.class.getName(),
-                                                                                                backupParams));
+                                                                                                backupParams),
+                                                                                                DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+                                                                                                DEFAULT_PING_PERIOD,
+                                                                                                DEFAULT_CONNECTION_TTL,
+                                                                                                DEFAULT_CALL_TIMEOUT,
+                                                                                                DEFAULT_CONSUMER_WINDOW_SIZE,
+                                                                                                DEFAULT_CONSUMER_MAX_RATE,
+                                                                                                DEFAULT_SEND_WINDOW_SIZE,
+                                                                                                DEFAULT_PRODUCER_MAX_RATE,
+                                                                                                DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+                                                                                                DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+                                                                                                true,
+                                                                                                true,
+                                                                                                DEFAULT_AUTO_GROUP,
+                                                                                                DEFAULT_MAX_CONNECTIONS,
+                                                                                                DEFAULT_PRE_ACKNOWLEDGE,
+                                                                                                DEFAULT_ACK_BATCH_SIZE,                                 
+                                                                                                DEFAULT_RETRY_INTERVAL,
+                                                                                                DEFAULT_RETRY_INTERVAL_MULTIPLIER,                                        
+                                                                                                DEFAULT_MAX_RETRIES_BEFORE_FAILOVER,
+                                                                                                DEFAULT_MAX_RETRIES_AFTER_FAILOVER);
 
       session = sf.createSession(false, true, true);
 

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/cluster/management/ReplicationAwareJMSQueueControlWrapperTest.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -32,12 +32,7 @@
 import javax.jms.TextMessage;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerInvocationHandler;
-import javax.management.openmbean.TabularData;
 
-import org.jboss.messaging.core.client.ClientMessage;
-import org.jboss.messaging.core.client.ClientProducer;
-import org.jboss.messaging.core.management.MessageInfo;
-import org.jboss.messaging.core.management.QueueControlMBean;
 import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
 import org.jboss.messaging.jms.JBossQueue;
 import org.jboss.messaging.jms.server.impl.JMSServerManagerImpl;
@@ -58,8 +53,6 @@
 
    // Attributes ----------------------------------------------------
 
-   private final long timeToSleep = 100;
-
    private JMSServerManagerImpl liveServerManager;
 
    private JMSServerManagerImpl backupServerManager;
@@ -103,9 +96,6 @@
       message.setJMSPriority(oldPriority);
       producer.send(message);
 
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -120,9 +110,6 @@
       TextMessage message = session.createTextMessage(randomString());
       producer.send(message);
 
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -144,9 +131,6 @@
       JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
       JMSUtil.sendMessageWithProperty(session, queue, key, matchingValue);
 
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check messages are on both live & backup nodes
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
@@ -164,9 +148,6 @@
       MessageProducer producer = session.createProducer(queue);
       producer.send(session.createMessage());
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep);
-
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
       assertEquals(0, liveOtherQueueControl.getMessageCount());
@@ -192,9 +173,6 @@
       JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
       JMSUtil.sendMessageWithProperty(session, queue, key, matchingValue);
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep);
-      
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
       assertEquals(0, liveOtherQueueControl.getMessageCount());
@@ -217,9 +195,6 @@
       Message message = session.createMessage();
       producer.send(message);
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -241,9 +216,6 @@
       MessageProducer producer = session.createProducer(queue);
       producer.send(session.createMessage());
 
-      // wiat a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -267,9 +239,6 @@
       JMSUtil.sendMessageWithProperty(session, queue, key, unmatchingValue);
       JMSUtil.sendMessageWithProperty(session, queue, key, matchingValue);
 
-      // wait a little bit to ensure the message is handled by the server
-      Thread.sleep(timeToSleep );
-      
       assertEquals(2, liveQueueControl.getMessageCount());
       assertEquals(2, backupQueueControl.getMessageCount());
 
@@ -288,9 +257,6 @@
       Message message = session.createMessage();
       producer.send(message);
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());
@@ -309,9 +275,6 @@
       Message message = session.createMessage();
       producer.send(message);
       
-      // wait a little bit to give time for the message to be handled by the server
-      Thread.sleep(timeToSleep);
-
       // check it is on both live & backup nodes
       assertEquals(1, liveQueueControl.getMessageCount());
       assertEquals(1, backupQueueControl.getMessageCount());

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/management/JMSUtil.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -91,8 +91,8 @@
                                                              DEFAULT_PRODUCER_MAX_RATE,
                                                              DEFAULT_MIN_LARGE_MESSAGE_SIZE,
                                                              DEFAULT_BLOCK_ON_ACKNOWLEDGE,
-                                                             DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
                                                              true,
+                                                             true,
                                                              DEFAULT_AUTO_GROUP,
                                                              DEFAULT_MAX_CONNECTIONS,
                                                              DEFAULT_PRE_ACKNOWLEDGE,                                                  

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java	2008-12-20 13:41:27 UTC (rev 5551)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java	2008-12-20 17:40:43 UTC (rev 5552)
@@ -300,7 +300,6 @@
       {
          ClientMessage m = pageConsumer.receive(10000);
          
-         log.info("Got message " + i);
          assertNotNull(m);
          m.acknowledge();
          clientSession.commit();




More information about the jboss-cvs-commits mailing list