Author: asoldano
Date: 2014-02-19 13:37:09 -0500 (Wed, 19 Feb 2014)
New Revision: 18398
Modified:
stack/cxf/trunk/modules/testsuite/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
Log:
Prevent transient failure due to https low level connection reuse (when different htts
configurations are used by following tests)
Modified:
stack/cxf/trunk/modules/testsuite/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2014-02-19
18:13:54 UTC (rev 18397)
+++
stack/cxf/trunk/modules/testsuite/test-utils/src/main/java/org/jboss/wsf/test/JBossWSTestSetup.java 2014-02-19
18:37:09 UTC (rev 18398)
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicLong;
import javax.management.MBeanServerConnection;
import javax.naming.NamingException;
@@ -57,6 +58,8 @@
private static Logger log = Logger.getLogger(JBossWSTestSetup.class);
private static final String JBOSSWS_SEC_DOMAIN = "JBossWS";
+ private static final String SYSPROP_HTTPS_CONNECTION_REUSE_TIMEOUT =
"test.https.connection.reuse.timeout";
+ private static final int HTTPS_CONNECTION_REUSE_TIMEOUT =
Integer.getInteger(SYSPROP_HTTPS_CONNECTION_REUSE_TIMEOUT, 5000);
private String[] archives = new String[0];
private OutputStream appclientOutputStream;
@@ -66,6 +69,8 @@
private boolean defaultSecurityDomainRequirement = false;
private Map<String, String> httpsConnOptions;
private CleanupOperation cleanupOp;
+
+ private static volatile AtomicLong lastHttpsConnectorRemoval = new AtomicLong(0);
public JBossWSTestSetup(Class<?> testClass, String archiveList)
{
@@ -249,6 +254,17 @@
URLClassLoader cl = new URLClassLoader(urls, parent);
Thread.currentThread().setContextClassLoader(cl);
}
+ if (httpsConnOptions != null) {
+ final long lr = lastHttpsConnectorRemoval.get();
+ if (lr != 0) {
+ final long wait = HTTPS_CONNECTION_REUSE_TIMEOUT -
(System.currentTimeMillis() - lr);
+ if (wait > 0) {
+ log.info("Will sleep for " + wait + " ms...");
+ Thread.sleep(wait);
+ log.debug("Going on!");
+ }
+ }
+ }
}
private static void performDeploy(String archive) throws Exception
@@ -311,6 +327,7 @@
if (httpsConnOptions != null)
{
JBossWSTestHelper.removeHttpsConnector();
+ lastHttpsConnectorRemoval.set(System.currentTimeMillis());
}
}
}
Show replies by date