changeset 40449:5fbe26f13a4e

8164100: com/sun/crypto/provider/KeyFactory/TestProviderLeak.java fails with java.util.concurrent.TimeoutException Reviewed-by: valeriep
author asmotrak
date Fri, 19 Aug 2016 10:57:44 -0700
parents 228cfe395a58
children ff23a3122b79
files jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Fri Aug 19 10:41:29 2016 -0700
+++ b/jdk/test/com/sun/crypto/provider/KeyFactory/TestProviderLeak.java	Fri Aug 19 10:57:44 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
@@ -53,7 +53,20 @@
     // or throws out TimeoutException.
     private static final int RESERVATION = 3;
     // The maximum time, 5 seconds, to wait for each iteration.
-    private static final int TIME_OUT = 5;
+    private static final int TIME_OUT;
+    static {
+        int timeout = 5;
+        try {
+            double timeoutFactor = Double.parseDouble(
+                    System.getProperty("test.timeout.factor", "1.0"));
+            timeout = (int) (timeout * timeoutFactor);
+        } catch (Exception e) {
+            System.out.println("Warning: " + e);
+        }
+        TIME_OUT = timeout;
+        System.out.println("Timeout for each iteration is "
+                + TIME_OUT + " seconds");
+    }
 
     private static Deque<byte []> eatupMemory() throws Exception {
         dumpMemoryStats("Before memory allocation");