You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ai...@apache.org on 2008/02/20 18:12:34 UTC

svn commit: r629540 - in /incubator/qpid/branches/M2.1/java: client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java

Author: aidan
Date: Wed Feb 20 09:12:32 2008
New Revision: 629540

URL: http://svn.apache.org/viewvc?rev=629540&view=rev
Log:
QPID-786 Remove bogus Failover timeout, add test.

Modified:
    incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java
    incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java

Modified: incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java?rev=629540&r1=629539&r2=629540&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java (original)
+++ incubator/qpid/branches/M2.1/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java Wed Feb 20 09:12:32 2008
@@ -34,7 +34,6 @@
     private static final long MINUTE = 60000L;
 
     private static final long DEFAULT_METHOD_TIMEOUT = 1 * MINUTE;
-    private static final long DEFAULT_FAILOVER_TIMEOUT = 4 * MINUTE;
 
     private FailoverMethod[] _methods = new FailoverMethod[1];
 
@@ -161,16 +160,7 @@
             }
             else
             {
-                if ((now - _lastFailTime) >= DEFAULT_FAILOVER_TIMEOUT)
-                {
-                    _logger.info("Failover timeout");
-
-                    return false;
-                }
-                else
-                {
-                    _lastMethodTime = now;
-                }
+                _lastMethodTime = now;
             }
         }
         else

Modified: incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java?rev=629540&r1=629539&r2=629540&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java (original)
+++ incubator/qpid/branches/M2.1/java/systests/src/main/java/org/apache/qpid/test/client/failover/FailoverTest.java Wed Feb 20 09:12:32 2008
@@ -7,6 +7,7 @@
 import org.apache.qpid.client.transport.TransportConnection;
 import org.apache.qpid.jms.ConnectionListener;
 import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.url.URLSyntaxException;
 import org.apache.log4j.Logger;
 
 import javax.jms.Connection;
@@ -49,7 +50,6 @@
 
             TransportConnection.createVMBroker(usedBrokers);
         }
-        //undo last addition
 
         conFactory = new AMQConnectionFactory(String.format(BROKER, usedBrokers - 1, usedBrokers));
         _logger.info("Connecting on:" + conFactory.getConnectionURL());
@@ -195,6 +195,20 @@
             failure = e;
         }
         assertNotNull("Exception should be thrown", failure);
+    }
+
+    // This test disabled so that it doesn't add 4 minnutes to the length of time it takes to run, which would be lame
+    public void txest4MinuteFailover() throws Exception
+    {
+        conFactory = new AMQConnectionFactory("amqp://guest:guest@/test?brokerlist='vm://:"+(usedBrokers-1)+"?connectdelay='60000'&retries='2''");
+        _logger.info("Connecting on:" + conFactory.getConnectionURL());
+        con = conFactory.createConnection();
+        ((AMQConnection) con).setConnectionListener(this);
+        con.start();
+
+        long failTime = System.currentTimeMillis() + 60000;
+        causeFailure();
+        assertTrue("Failover did not take long enough", System.currentTimeMillis() > failTime);
     }
 
     public void bytesSent(long count)