Author: richard.opalka(a)jboss.com
Date: 2012-10-12 09:31:58 -0400 (Fri, 12 Oct 2012)
New Revision: 16866
Modified:
shared-testsuite/branches/jbossws-shared-testsuite-4.0.x/
shared-testsuite/branches/jbossws-shared-testsuite-4.0.x/src/main/java/org/jboss/wsf/test/AppclientHelper.java
Log:
[JBPAPP-10027] backport appclient fix - svn merge -r 16864:16865
https://svn.jboss.org/repos/jbossws/shared-testsuite/trunk
Property changes on: shared-testsuite/branches/jbossws-shared-testsuite-4.0.x
___________________________________________________________________
Modified: svn:mergeinfo
- /shared-testsuite/branches/asoldano:14040-14045
/shared-testsuite/trunk:15976,16022,16066,16068,16272,16346
+ /shared-testsuite/branches/asoldano:14040-14045
/shared-testsuite/trunk:15976,16022,16066,16068,16272,16346,16865
Modified:
shared-testsuite/branches/jbossws-shared-testsuite-4.0.x/src/main/java/org/jboss/wsf/test/AppclientHelper.java
===================================================================
---
shared-testsuite/branches/jbossws-shared-testsuite-4.0.x/src/main/java/org/jboss/wsf/test/AppclientHelper.java 2012-10-12
13:19:39 UTC (rev 16865)
+++
shared-testsuite/branches/jbossws-shared-testsuite-4.0.x/src/main/java/org/jboss/wsf/test/AppclientHelper.java 2012-10-12
13:31:58 UTC (rev 16866)
@@ -49,7 +49,7 @@
private static final String EXT = ":".equals(PS) ? ".sh" :
".bat";
private static final String appclientScript = JBOSS_HOME + FS + "bin" + FS +
"appclient" + EXT;
private static Map<String, AppclientProcess> appclients = new HashMap<String,
AppclientProcess>();
- private static ExecutorService es = Executors.newCachedThreadPool();
+ private static ExecutorService es =
Executors.newCachedThreadPool(AppclientDaemonFactory.INSTANCE);
private static String appclientOutputDir;
private static class AppclientProcess {
@@ -222,4 +222,24 @@
final int sharpIndex = archive.indexOf('#');
return archive.substring(0, sharpIndex);
}
+
+ // [JBPAPP-10027] appclient threads are always daemons (to don't block JVM
shutdown)
+ private static class AppclientDaemonFactory implements ThreadFactory {
+ static final AppclientDaemonFactory INSTANCE = new AppclientDaemonFactory();
+ final ThreadGroup group;
+ final AtomicInteger threadNumber = new AtomicInteger(1);
+ final String namePrefix;
+
+ AppclientDaemonFactory() {
+ group = Thread.currentThread().getThreadGroup();
+ namePrefix = "appclient-output-processing-daemon-";
+ }
+
+ public Thread newThread(final Runnable r) {
+ final Thread t = new Thread(group, r, namePrefix +
threadNumber.getAndIncrement());
+ t.setDaemon(true);
+ t.setPriority(Thread.NORM_PRIORITY);
+ return t;
+ }
+ }
}