You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2011/02/09 19:33:41 UTC
svn commit: r1069023 -
/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java
Author: cwiklik
Date: Wed Feb 9 18:33:41 2011
New Revision: 1069023
URL: http://svn.apache.org/viewvc?rev=1069023&view=rev
Log:
UIMA-2038 Changed to use modified UimaAsThreadFactory.
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java?rev=1069023&r1=1069022&r2=1069023&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/ConcurrentMessageListener.java Wed Feb 9 18:33:41 2011
@@ -31,6 +31,7 @@ import javax.jms.Session;
import org.apache.uima.UIMAFramework;
import org.apache.uima.aae.UIMAEE_Constants;
+import org.apache.uima.aae.UimaAsThreadFactory;
import org.apache.uima.aae.UimaBlockingExecutor;
import org.apache.uima.aae.controller.AggregateAnalysisEngineController;
import org.apache.uima.aae.controller.AggregateAnalysisEngineController_impl;
@@ -82,10 +83,6 @@ public class ConcurrentMessageListener i
private LinkedBlockingQueue<Runnable> workQueue;
private CountDownLatch controllerLatch = new CountDownLatch(1);
- public ConcurrentMessageListener(int concurrentThreads, Object delegateListener )
- throws InvalidClassException {
- this(concurrentThreads, delegateListener, null);
- }
/**
* Creates a listener with a given number of process threads. This listener is injected between
@@ -102,7 +99,7 @@ public class ConcurrentMessageListener i
* - JmsInputChannel instance to delegate CAS to
* @throws InvalidClassException
*/
- public ConcurrentMessageListener(int concurrentThreads, Object delegateListener, String destination)
+ public ConcurrentMessageListener(int concurrentThreads, Object delegateListener, String destination, ThreadGroup threadGroup, String threadPrefix)
throws InvalidClassException {
if (!(delegateListener instanceof SessionAwareMessageListener)) {
throw new InvalidClassException("Invalid Delegate Listener. Expected Object of Type:"
@@ -116,6 +113,11 @@ public class ConcurrentMessageListener i
workQueue = new LinkedBlockingQueue<Runnable>();
executor = new ThreadPoolExecutor(concurrentThreads, concurrentThreads, Long.MAX_VALUE,
TimeUnit.NANOSECONDS, workQueue);
+ UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
+ tf.setDaemon(true);
+ tf.setThreadNamePrefix(threadPrefix);
+ executor.setThreadFactory(tf);
+
executor.prestartAllCoreThreads();
if ( destination != null ) {
blockingExecutor = new UimaBlockingExecutor(executor, concurrentThreads, destination);