Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 15A4D17BDE for ; Wed, 25 Mar 2015 03:44:40 +0000 (UTC) Received: (qmail 73415 invoked by uid 500); 25 Mar 2015 03:44:33 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 73302 invoked by uid 500); 25 Mar 2015 03:44:33 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 73260 invoked by uid 99); 25 Mar 2015 03:44:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Mar 2015 03:44:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 746CEE17A7; Wed, 25 Mar 2015 03:44:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ningjiang@apache.org To: commits@camel.apache.org Date: Wed, 25 Mar 2015 03:44:34 -0000 Message-Id: <9fdcdb30096d4b2a9d1e848053de9af0@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] camel git commit: CAMEL-8544 Dynamic router - unsupported cacheSize attribute CAMEL-8544 Dynamic router - unsupported cacheSize attribute Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/38beadc1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/38beadc1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/38beadc1 Branch: refs/heads/camel-2.15.x Commit: 38beadc19518f058fab2aa68a6cbc3fbd1473234 Parents: 368d78f Author: Willem Jiang Authored: Wed Mar 25 11:38:06 2015 +0800 Committer: Willem Jiang Committed: Wed Mar 25 11:43:38 2015 +0800 ---------------------------------------------------------------------- .../camel/model/DynamicRouterDefinition.java | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/38beadc1/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java index cf5899d..9d39830 100644 --- a/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java +++ b/camel-core/src/main/java/org/apache/camel/model/DynamicRouterDefinition.java @@ -44,6 +44,8 @@ public class DynamicRouterDefinition> ext private String uriDelimiter; @XmlAttribute private Boolean ignoreInvalidEndpoints; + @XmlAttribute + private Integer cacheSize; public DynamicRouterDefinition() { } @@ -76,6 +78,9 @@ public class DynamicRouterDefinition> ext if (getIgnoreInvalidEndpoints() != null) { dynamicRouter.setIgnoreInvalidEndpoints(getIgnoreInvalidEndpoints()); } + if (getCacheSize() != null) { + dynamicRouter.setCacheSize(getCacheSize()); + } return dynamicRouter; } @@ -110,6 +115,14 @@ public class DynamicRouterDefinition> ext // Fluent API // ------------------------------------------------------------------------- + public Integer getCacheSize() { + return cacheSize; + } + + public void setCacheSize(Integer cacheSize) { + this.cacheSize = cacheSize; + } + @Override @SuppressWarnings("unchecked") public Type end() { @@ -137,5 +150,17 @@ public class DynamicRouterDefinition> ext setUriDelimiter(uriDelimiter); return this; } + + /** + * Sets the maximum size used by the {@link org.apache.camel.impl.ProducerCache} which is used + * to cache and reuse producers when using this recipient list, when uris are reused. + * + * @param cacheSize the cache size, use 0 for default cache size, or -1 to turn cache off. + * @return the builder + */ + public DynamicRouterDefinition cacheSize(int cacheSize) { + setCacheSize(cacheSize); + return this; + } }