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 2009/01/12 20:36:41 UTC
svn commit: r733874 -
/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java
Author: cwiklik
Date: Mon Jan 12 11:36:33 2009
New Revision: 733874
URL: http://svn.apache.org/viewvc?rev=733874&view=rev
Log:
UIMA-1110 Changed prefetch value to 10 for tmp queues handling CAS Release requests.
Modified:
incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java
Modified: incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java?rev=733874&r1=733873&r2=733874&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java (original)
+++ incubator/uima/sandbox/trunk/uima-as/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/SpringContainerDeployer.java Mon Jan 12 11:36:33 2009
@@ -25,6 +25,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQPrefetchPolicy;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.uima.UIMAFramework;
import org.apache.uima.aae.UIDGenerator;
@@ -44,7 +45,8 @@
public class SpringContainerDeployer implements ControllerCallbackListener {
private static final Class CLASS_NAME = SpringContainerDeployer.class;
-
+ private static final int MAX_PREFETCH_FOR_CAS_NOTIFICATION_Q = 10;
+
private boolean serviceInitializationCompleted;
private boolean serviceInitializationException;
private Object serviceMonitor = new Object();
@@ -103,7 +105,19 @@
}
return factory;
}
-
+ private ActiveMQPrefetchPolicy getPrefetchPolicy(int aPrefetchSize ) {
+ ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
+ prefetchPolicy.setQueuePrefetch(aPrefetchSize);
+ return prefetchPolicy;
+ }
+ private ActiveMQConnectionFactory getNewConnectionFactory( ApplicationContext ctx ) throws Exception {
+ ActiveMQConnectionFactory factory = getTopLevelQueueConnectionFactory(ctx);
+ if ( factory != null ) {
+ String brokerURL = factory.getBrokerURL();
+ factory = new ActiveMQConnectionFactory(brokerURL);
+ }
+ return factory;
+ }
private int getConcurrentConsumerCount( ApplicationContext ctx )
{
String[] listenerBeanIds = ctx.getBeanNamesForType(org.apache.uima.adapter.jms.activemq.UimaDefaultMessageListenerContainer.class);
@@ -154,9 +168,10 @@
if ( cntlr.isCasMultiplier() )
{
- ActiveMQConnectionFactory cf = getTopLevelQueueConnectionFactory( ctx );
+ ActiveMQConnectionFactory cf = getNewConnectionFactory(ctx); //getTopLevelQueueConnectionFactory( ctx );
+ ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy(MAX_PREFETCH_FOR_CAS_NOTIFICATION_Q);
+ cf.setPrefetchPolicy(prefetchPolicy);
// Create a listener and a temp queue for Free CAS notifications.
-
UimaDefaultMessageListenerContainer connector = produceListenerConnector(cf);
System.out.println(">>>> Cas Multiplier Controller:"+cntlr.getComponentName()+" Activated Listener to Receive Free CAS Notifications - Temp Queue Name:"+connector.getEndpointName());
// Direct all messages to the InputChannel
@@ -166,9 +181,9 @@
// add this queue to every outgoing message containing a CAS generated by the
// Cas Multiplier.
((JmsOutputChannel)cntlr.getOutputChannel()).setFreeCasQueue(connector.getListenerEndpoint());
- if ( UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG) ) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(), "initializeTopLevelController", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_activated_fcq__CONFIG", new Object[] { cntlr.getComponentName(), connector.getEndpointName() });
- }
+ if ( UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG) ) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(), "initializeTopLevelController", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_activated_fcq__CONFIG", new Object[] { cntlr.getComponentName(), connector.getEndpointName() });
+ }
}
if (cntlr instanceof AggregateAnalysisEngineController) {