[jboss-cvs] JBoss Messaging SVN: r5651 - branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 16 01:04:55 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-01-16 01:04:54 -0500 (Fri, 16 Jan 2009)
New Revision: 5651

Modified:
   branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
Log:
cleanup

Modified: branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java	2009-01-16 05:58:07 UTC (rev 5650)
+++ branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PagingFailoverTest.java	2009-01-16 06:04:54 UTC (rev 5651)
@@ -77,7 +77,7 @@
       testPaging(false);
    }
 
-   private void testPaging(boolean fail) throws Exception
+   private void testPaging(final boolean fail) throws Exception
    {
       setUpFileBased(100 * 1024);
 
@@ -86,12 +86,6 @@
       {
          ClientSessionFactory sf1 = createFailoverFactory();
 
-         // sf1.setBlockOnAcknowledge(true);
-         // sf1.setBlockOnNonPersistentSend(true);
-         // sf1.setBlockOnPersistentSend(true);
-
-         // sf1.setMinLargeMessageSize(10 * 1024);
-
          session = sf1.createSession(null, null, false, true, true, false, 0);
 
          session.createQueue(ADDRESS, ADDRESS, null, true, false);
@@ -144,18 +138,15 @@
 
             if (fail && i == numMessages / 2)
             {
-               System.out.println("Failing");
                conn.fail(new MessagingException(MessagingException.NOT_CONNECTED));
             }
 
-            ClientMessage message = consumer.receive(1000);
+            ClientMessage message = consumer.receive(10000);
 
-            // System.out.println("message = " + message);
 
             assertNotNull(message);
 
             message.acknowledge();
-            // session.commit();
 
             message.getBody().rewind();
 
@@ -239,9 +230,9 @@
     * @throws InterruptedException
     * @throws Throwable
     */
-   private int multiThreadConsumer(boolean connectedOnBackup, boolean fail) throws Exception,
-                                                                           InterruptedException,
-                                                                           Throwable
+   private int multiThreadConsumer(final boolean connectedOnBackup, final boolean fail) throws Exception,
+                                                                                       InterruptedException,
+                                                                                       Throwable
    {
       ClientSession session = null;
       try
@@ -256,12 +247,12 @@
          if (connectedOnBackup)
          {
             factory = createBackupFactory();
-            store = this.backupService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+            store = backupService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
          }
          else
          {
             factory = createFailoverFactory();
-            store = this.liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+            store = liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
          }
 
          session = factory.createSession(false, true, true, false);
@@ -283,9 +274,10 @@
 
             public Consumer() throws Exception
             {
-               session = factory.createSession(false, true, true);
+               session = factory.createSession(null, null, false, true, true, false, 0);
             }
 
+            @Override
             public void run()
             {
                boolean started = false;
@@ -319,8 +311,6 @@
                         }
 
                         msg.acknowledge();
-
-                        session.commit();
                      }
 
                   }
@@ -359,10 +349,10 @@
 
          if (fail)
          {
-            Thread.sleep(2000);
+            Thread.sleep(1000);
             while (store.getNumberOfPages() == initialNumberOfPages)
             {
-               Thread.sleep(500);
+               Thread.sleep(100);
             }
 
             System.out.println("The system has already depaged " + (initialNumberOfPages - store.getNumberOfPages()) +
@@ -407,14 +397,14 @@
     * @throws InterruptedException
     * @throws Throwable
     */
-   private int multiThreadProducer(boolean failover) throws Exception,
-                                                    MessagingException,
-                                                    InterruptedException,
-                                                    Throwable
+   private int multiThreadProducer(final boolean failover) throws Exception,
+                                                          MessagingException,
+                                                          InterruptedException,
+                                                          Throwable
    {
 
       final AtomicInteger numberOfMessages = new AtomicInteger(0);
-      final PagingStore store = this.liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
+      final PagingStore store = liveService.getServer().getPostOffice().getPagingManager().getPageStore(ADDRESS);
 
       final ClientSessionFactory factory = createFailoverFactory();
 
@@ -423,13 +413,8 @@
       {
          session.createQueue(ADDRESS, ADDRESS, null, true, false);
 
-         // Block on everything ,just because we want to stop sending as soon as the destination gets in page-mode
-         factory.setBlockOnAcknowledge(true);
-         factory.setBlockOnNonPersistentSend(true);
-         factory.setBlockOnPersistentSend(true);
+         final int THREAD_PRODUCERS = 30;
 
-         final int THREAD_PRODUCERS = 20;
-
          final CountDownLatch startFlag = new CountDownLatch(1);
          final CountDownLatch alignSemaphore = new CountDownLatch(THREAD_PRODUCERS);
          final CountDownLatch flagPaging = new CountDownLatch(THREAD_PRODUCERS);
@@ -438,6 +423,7 @@
          {
             volatile Throwable e;
 
+            @Override
             public void run()
             {
                boolean started = false;
@@ -464,7 +450,7 @@
 
                      flagPaging.countDown();
 
-                     for (int i = 0; i < 10000; i++)
+                     for (int i = 0; i < 1000; i++)
                      {
 
                         ClientMessage msg = session.createClientMessage(true);
@@ -544,6 +530,7 @@
 
    // Protected -----------------------------------------------------
 
+   @Override
    protected void tearDown() throws Exception
    {
       super.tearDown();
@@ -560,6 +547,7 @@
 
    }
 
+   @Override
    protected void setUp() throws Exception
    {
       super.setUp();




More information about the jboss-cvs-commits mailing list