db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1596749 - in /db/derby/code/branches/10.10: ./ java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Date Thu, 22 May 2014 05:09:36 GMT
Author: mamta
Date: Thu May 22 05:09:35 2014
New Revision: 1596749

URL: http://svn.apache.org/r1596749
Log:
DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints exception java.lang.Exception:
DRDA_InvalidReplyTooShort.S:Invalid reply f rom network server: Insufficient data. but test
passes)

Backporting changes from trunk to 10.10


Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/trunk:r1594435

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1596749&r1=1596748&r2=1596749&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Thu May 22 05:09:35 2014
@@ -600,6 +600,22 @@ final public class NetworkServerTestSetu
         boolean expectServerUp)
         throws InterruptedException
     {
+        //DERBY-6337(derbynet.ServerPropertiesTest.ttestSetPortPriority prints 
+        // exception java.lang.Exception: 
+        // DRDA_InvalidReplyTooShort.S:Invalidreply from network 
+        // server:Insufficent data. but test passes)
+        //Sometimes, when server is coming down and a ping is sent to it, ping
+        // may get DRDA_InvalidReplyTooShort.S:Invalidreply rather than server
+        // is down depending on the timing of the server shutdown. If we do run
+        // into DRDA_InvalidReplyTooShort.S:Invalidreply, we will now send 
+        // another ping after a little wait, and this time around we should 
+        // get expected server down exception.
+        //Following boolean will be set to true if we get reply too short
+        // during the ping and it will try to ping again. But if we get
+        // the reply too short on that ping attempt as well, we will just
+        // print the exception on the console and conclude that server is
+        // down.
+        boolean alreadyGotReplyTooShort=false;
         // If we expect the server to be or come up, then
         // it makes sense to sleep (if ping unsuccessful), then ping 
         // and repeat this for the duration of wait-time, but stop
@@ -624,8 +640,13 @@ final public class NetworkServerTestSetu
             } catch (Throwable e) {
                 if ( !vetPing( e ) )
                 {
+                    if ( !alreadyGotReplyTooShort && 
+                            (e.getMessage().startsWith( "DRDA_InvalidReplyTooShort.S:" )
) ){
+                        alreadyGotReplyTooShort = true;
+                        Thread.sleep(SLEEP_TIME);
+                        continue;
+                    }
                     e.printStackTrace( System.out );
-
                     // at this point, we don't have the usual "server not up
                     // yet" error. get out. at this point, you may have to
                     // manually kill the server.



Mime
View raw message