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 2017/12/26 11:43:23 UTC
[camel] branch master updated: CAMEL-12058: Added check so changing
cache size is only possible if using the default lru cache
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 2e3f799 CAMEL-12058: Added check so changing cache size is only possible if using the default lru cache
2e3f799 is described below
commit 2e3f799668d4396f8ed3de3161ab24331fdb7461
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Dec 26 12:31:45 2017 +0100
CAMEL-12058: Added check so changing cache size is only possible if using the default lru cache
---
.../camel/processor/idempotent/FileIdempotentRepository.java | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/camel-core/src/main/java/org/apache/camel/processor/idempotent/FileIdempotentRepository.java b/camel-core/src/main/java/org/apache/camel/processor/idempotent/FileIdempotentRepository.java
index 61063ff..4343331 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/idempotent/FileIdempotentRepository.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/idempotent/FileIdempotentRepository.java
@@ -41,6 +41,11 @@ import org.slf4j.LoggerFactory;
* <p/>
* Care should be taken to use a suitable underlying {@link java.util.Map} to avoid this class being a
* memory leak.
+ * <p/>
+ * The default cache used is {@link LRUCache} which keeps the most used entries in the cache.
+ * When this cache is being used and the state of the cache is stored to file via {@link #trunkStore()}
+ * then the entries stored are not guaranteed to be in the exact order the entries were added to the cache.
+ * If you need exact ordering, then you need to provide a custom {@link Map} implementation that does that
*
* @version
*/
@@ -202,10 +207,15 @@ public class FileIdempotentRepository extends ServiceSupport implements Idempote
}
/**
- * Sets the cache size
+ * Sets the cache size.
+ *
+ * Setting cache size is only possible when using the default {@link LRUCache} cache implementation.
*/
@SuppressWarnings("unchecked")
public void setCacheSize(int size) {
+ if (cache != null && !(cache instanceof LRUCache)) {
+ throw new IllegalArgumentException("Setting cache size is only possible when using the default LRUCache cache implementation");
+ }
if (cache != null) {
cache.clear();
}
--
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].