Author: david.lloyd(a)jboss.com
Date: 2009-10-23 18:30:53 -0400 (Fri, 23 Oct 2009)
New Revision: 5570
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java
Log:
Prevent the problem where an executor task awaits termination of its own executor
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java 2009-10-23
22:24:45 UTC (rev 5569)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Remoting.java 2009-10-23
22:30:53 UTC (rev 5570)
@@ -156,7 +156,16 @@
* @return a closeable executor
*/
public static CloseableExecutor createExecutor(final int maxThreads) {
- return IoUtils.closeableExecutor(new ThreadPoolExecutor(1, maxThreads, 30L,
TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50), OUR_THREAD_FACTORY, new
ThreadPoolExecutor.CallerRunsPolicy()), 30L, TimeUnit.SECONDS);
+ final ThreadPoolExecutor executor = new ThreadPoolExecutor(1, maxThreads, 30L,
TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(50), OUR_THREAD_FACTORY, new
ThreadPoolExecutor.CallerRunsPolicy());
+ return new CloseableExecutor() {
+ public void close() throws IOException {
+ executor.shutdown();
+ }
+
+ public void execute(final Runnable command) {
+ executor.execute(command);
+ }
+ };
}
/**
Show replies by date