< prev index next >

test/jdk/java/rmi/testlibrary/RMID.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -42,15 +42,16 @@
     // Also consider the test.timeout.factor property (a float).
     private static final long TIMEOUT_SHUTDOWN_MS = 60_000L;
     private static final long TIMEOUT_DESTROY_MS  = 10_000L;
     private static final long STARTTIME_MS        = 15_000L;
     private static final long POLLTIME_MS         = 100L;
+    private static final long TIMEOUT_BASE        = 240_000L;
 
     // when restart rmid, it may take more time than usual because of
     // "port in use" by a possible interloper (check JDK-8168975),
     // so need to set a longer timeout for restart.
-    private static long restartTimeout;
+    private static final long RESTART_TIMEOUT = (long)(TIMEOUT_BASE * 0.9);
     // Same reason to inheritedChannel in RMIDSelectorProvider.
     // Put it here rather than in RMIDSelectorProvider to adjust
     // both timeout values together.
     private static long inheritedChannelTimeout;
 

@@ -262,12 +263,11 @@
     private RMID(String classname, String options, String args,
                    OutputStream out, OutputStream err, int port)
     {
         super(classname, options, args, out, err);
         this.port = port;
-        long waitTime = (long)(240_000 * TestLibrary.getTimeoutFactor());
-        restartTimeout = (long)(waitTime * 0.9);
+        long waitTime = (long)(TIMEOUT_BASE * TestLibrary.getTimeoutFactor());
         inheritedChannelTimeout = (long)(waitTime * 0.8);
     }
 
     /**
      * Removes rmid's log file directory.

@@ -404,11 +404,11 @@
     public void restart() throws IOException {
         destroy();
         options = makeOptions(port, true, true);
         args = makeArgs();
 
-        start(restartTimeout);
+        start(RESTART_TIMEOUT);
     }
 
     /**
      * Ask rmid to shutdown gracefully using a remote method call.
      * catch any errors that might occur from rmid not being present
< prev index next >