From d78cb4a0c30a85ee14fab7707702c0bbbc44e19e Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Thu, 2 Mar 2006 01:43:13 +0000 Subject: [PATCH] remove per-type expire time, clunky and doesnt work on types w/ args --- .../net/hyperic/sigar/SigarCacheObject.java | 1 - .../net/hyperic/sigar/SigarProxyCache.java | 33 +------------------ 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/bindings/java/src/net/hyperic/sigar/SigarCacheObject.java b/bindings/java/src/net/hyperic/sigar/SigarCacheObject.java index 81e80738..8f386446 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarCacheObject.java +++ b/bindings/java/src/net/hyperic/sigar/SigarCacheObject.java @@ -2,7 +2,6 @@ package net.hyperic.sigar; class SigarCacheObject { - int expire = SigarProxyCache.EXPIRE_DEFAULT; long timestamp = 0; Object value = null; } diff --git a/bindings/java/src/net/hyperic/sigar/SigarProxyCache.java b/bindings/java/src/net/hyperic/sigar/SigarProxyCache.java index 4fbca648..d9f5beb7 100644 --- a/bindings/java/src/net/hyperic/sigar/SigarProxyCache.java +++ b/bindings/java/src/net/hyperic/sigar/SigarProxyCache.java @@ -55,36 +55,6 @@ public class SigarProxyCache SigarLog.getLogger("SigarProxyCache").debug(msg); } - private static final Class[] VOID_SIGNATURE = new Class[0]; - - public static void setExpire(SigarProxy proxy, - String type, - int expire) - throws SigarException { - - SigarProxyCache handler = - (SigarProxyCache)Proxy.getInvocationHandler(proxy); - - Method method; - - try { - method = Sigar.class.getMethod("get" + type, VOID_SIGNATURE); - } catch (Exception e) { - throw new SigarException("invalid type " + type); - } - - SigarCacheObject cacheVal = - (SigarCacheObject)handler.cache.get(method); - - if (cacheVal == null) { - cacheVal = new SigarCacheObject(); - } - - cacheVal.expire = expire; - - handler.cache.put(method, cacheVal); - } - public static void clear(Object proxy) { SigarProxyCache handler = (SigarProxyCache)Proxy.getInvocationHandler(proxy); @@ -150,7 +120,6 @@ public class SigarProxyCache if (cacheVal == null) { cacheVal = new SigarCacheObject(); - cacheVal.expire = this.expire; } String argDebug = ""; @@ -167,7 +136,7 @@ public class SigarProxyCache " in cache" + argDebug); } - if ((timeNow - cacheVal.timestamp) > cacheVal.expire) { + if ((timeNow - cacheVal.timestamp) > this.expire) { if (debugEnabled) { debug("expiring " + method.getName() + " from cache" + argDebug);