From 49391b1995a1c85f1c087b92907aebceca7e15a9 Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Wed, 5 Nov 2008 00:18:21 +0000 Subject: [PATCH] When we reinitialize the Throttle with a smaller number of allowed operations within a time period, we should preserve the oldest rather than the newest ones, or we'll most likely be in immediate and unfair violation of the limit. --- src/java/com/samskivert/jdbc/depot/EHCacheAdapter.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/java/com/samskivert/jdbc/depot/EHCacheAdapter.java b/src/java/com/samskivert/jdbc/depot/EHCacheAdapter.java index 54c543c..6df66f3 100644 --- a/src/java/com/samskivert/jdbc/depot/EHCacheAdapter.java +++ b/src/java/com/samskivert/jdbc/depot/EHCacheAdapter.java @@ -43,9 +43,19 @@ public class EHCacheAdapter * cache manager when it knows that Depot and any other clients no longer need it. */ public EHCacheAdapter (CacheManager cachemgr) + { + this(cachemgr, 1000, 300, 20); + } + + public EHCacheAdapter (CacheManager cachemgr, int maxElementsInMemory, + int timeToIdleSeconds, int timeToLiveSeconds) { _cachemgr = cachemgr; + _maxElementsInMemory = maxElementsInMemory; + _timeToIdleSeconds = timeToIdleSeconds; + _timeToLiveSeconds = timeToLiveSeconds; + CacheManagerPeerListener listener = _cachemgr.getCachePeerListener(); CacheManagerPeerProvider provider = _cachemgr.getCachePeerProvider(); if ((provider != null) != (listener != null)) {