You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/06/29 13:02:10 UTC

svn commit: r789287 - /camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java

Author: davsclaus
Date: Mon Jun 29 11:02:10 2009
New Revision: 789287

URL: http://svn.apache.org/viewvc?rev=789287&view=rev
Log:
CAMEL-1771: Using a LRUCache to avoid growing in size forever for non singleton or unique producers

Modified:
    camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java

Modified: camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=789287&r1=789286&r2=789287&view=diff
==============================================================================
--- camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Mon Jun 29 11:02:10 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.impl;
 
-import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.AsyncCallback;
@@ -27,6 +26,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
+import org.apache.camel.util.LRUCache;
 import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -42,7 +42,7 @@
 public class ProducerCache<E extends Exchange> extends ServiceSupport {
     private static final transient Log LOG = LogFactory.getLog(ProducerCache.class);
 
-    private Map<String, Producer<E>> producers = new HashMap<String, Producer<E>>();
+    private Map<String, Producer<E>> producers = new LRUCache<String, Producer<E>>(1000);
 
     public synchronized Producer<E> getProducer(Endpoint<E> endpoint) {
         String key = endpoint.getEndpointUri();