You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ra...@apache.org on 2012/11/05 00:29:23 UTC

svn commit: r1405673 - /camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java

Author: raulk
Date: Sun Nov  4 23:29:22 2012
New Revision: 1405673

URL: http://svn.apache.org/viewvc?rev=1405673&view=rev
Log:
Backported to 2.10.x. CAMEL-5769: Camel JMS producer can block a thread under specific circumstances. Corrected a log message.

Modified:
    camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java

Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java?rev=1405673&r1=1405672&r2=1405673&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/support/DefaultTimeoutMap.java Sun Nov  4 23:29:22 2012
@@ -165,6 +165,10 @@ public class DefaultTimeoutMap<K, V> ext
 
     public void purge() {
         log.trace("There are {} in the timeout map", map.size());
+        if (map.isEmpty()) {
+            return;
+        }
+        
         long now = currentTime();
 
         List<TimeoutMapEntry<K, V>> expired = new ArrayList<TimeoutMapEntry<K, V>>();
@@ -200,7 +204,13 @@ public class DefaultTimeoutMap<K, V> ext
                 try {
                     // now fire eviction notification
                     for (TimeoutMapEntry<K, V> entry : expired) {
-                        boolean evict = onEviction(entry.getKey(), entry.getValue());
+                        boolean evict = false;
+                        try {
+                            evict = onEviction(entry.getKey(), entry.getValue());
+                        } catch (Throwable t) {
+                            log.warn("Exception happened during eviction of entry ID {}, won't evict and will continue trying: {}", 
+                                    entry.getValue(), t);
+                        }
                         if (evict) {
                             // okay this entry should be evicted
                             evicts.add(entry.getKey());