ARP caching timeout is now defined in seconds.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 18 Apr 2003 16:45:19 +0000 (16:45 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 18 Apr 2003 16:45:19 +0000 (16:45 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@579 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/conf/origin.properties
src/edu/internet2/middleware/shibboleth/aa/arp/provider/BaseArpRepository.java

index 17593a5..be0d893 100755 (executable)
@@ -70,9 +70,9 @@
    # [Required if active] Path from which Policies can be loaded
    edu.internet2.middleware.shibboleth.aa.arp.provider.FileSystemArpRepository.Path = /conf/arps/
        
-   # [Optional] Time in milliseconds for which Release Policies should be cached
+   # [Optional] Time in seconds for which Release Policies should be cached
    # (Defaults to 0 or "no caching")
-   edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL = 300000
+   edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL = 300
 
 
 ###################################################################################
index 73d05c4..20d6a37 100755 (executable)
@@ -228,6 +228,7 @@ public abstract class BaseArpRepository implements ArpRepository {
 class ArpCache {
 
        private static ArpCache instance = null;
+       /** Time in seconds for which ARPs should be cached. */
        private long cacheLength;
        private Map cache = new HashMap();
        private static Logger log = Logger.getLogger(ArpCache.class.getName());
@@ -244,6 +245,7 @@ class ArpCache {
                return instance;
        }
 
+       /** Set time in seconds for which ARPs should be cached. */
        void setCacheLength(long cacheLength) {
                this.cacheLength = cacheLength;
        }
@@ -279,7 +281,7 @@ class ArpCache {
                        return null;
                }
 
-               if ((System.currentTimeMillis() - cachedArp.creationTimeMillis) < cacheLength) {
+               if ((System.currentTimeMillis() - cachedArp.creationTimeMillis) < (cacheLength * 1000)) {
                        return cachedArp.arp;
                }
 
@@ -357,13 +359,13 @@ class ArpCache {
                                                log.debug("Stopping ArpCache Cleanup Thread.");
                                                return;
                                        }
+                                       log.debug("ArpCache cleanup thread searching for stale entries.");
                                        Set needsDeleting = new HashSet();
                                        synchronized (cache) {
                                                Iterator iterator = cache.values().iterator();
                                                while (iterator.hasNext()) {
                                                        CachedArp cachedArp = (CachedArp) iterator.next();
-                                                       if ((cachedArp.creationTimeMillis - System.currentTimeMillis())
-                                                               > cacheLength) {
+                                                       if ((System.currentTimeMillis() - cachedArp.creationTimeMillis) > (cacheLength * 1000)) {
                                                                needsDeleting.add(cachedArp);
                                                        }
                                                }