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/09/14 19:34:43 UTC

svn commit: r814750 - /incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java

Author: cwiklik
Date: Mon Sep 14 17:34:43 2009
New Revision: 814750

URL: http://svn.apache.org/viewvc?rev=814750&view=rev
Log:
UIMA-1120 Modified to disable setting Time To Live (TTL) on outgoing msgs if -DNoTTL system property is set 

Modified:
    incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java

Modified: incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java?rev=814750&r1=814749&r2=814750&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-jms/src/main/java/org/apache/uima/adapter/jms/client/BaseMessageSender.java Mon Sep 14 17:34:43 2009
@@ -139,6 +139,13 @@
    */
   public void run() {
     String destination = null;
+    //  by default, add time to live to each message
+    boolean addTimeToLive = true;
+    // Check the environment for existence of NoTTL tag. If present,
+    // the deployer of the service wants to disable message expiration.
+    if (System.getProperty("NoTTL") != null) {
+      addTimeToLive = false;
+    }
 
     // Create and initialize the producer.
     try {
@@ -214,9 +221,10 @@
             // are not auto evicted yet and accumulate taking up memory.
             long timeoutValue = cacheEntry.getProcessTimeout();
 
-            if (timeoutValue > 0) {
+            if (timeoutValue > 0 && addTimeToLive ) {
               // Set high time to live value
-              producer.setTimeToLive(10 * timeoutValue);
+              //producer.setTimeToLive(10 * timeoutValue);
+              message.setJMSExpiration(10 * timeoutValue);
             }
             if (pm.getMessageType() == AsynchAEMessage.Process) {
               cacheEntry.setCASDepartureTime(System.nanoTime());