X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aaf%2Fauthz.git;a=blobdiff_plain;f=auth%2Fauth-cass%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fdao%2FCached.java;h=1bda405c978ad2ac394a92ae869e35c78a2c410a;hp=3f4bbb2083ef07e51bee43b4bc0fd84e1438fe14;hb=7e966914050e66219689001ff4ab601a49eef0ac;hpb=ead32f193586e39b59bb366bddf70e665173a52d diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java index 3f4bbb20..1bda405c 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/Cached.java @@ -56,7 +56,7 @@ public class Cached extends Cache extends Cache extends Cache map = ((Map)cache[cacheIdx]); -// if(map.remove(key)!=null) // Not seeming to remove all the time - if(map!=null)map.clear(); +// if (map.remove(key)!=null) // Not seeming to remove all the time + if (map!=null)map.clear(); // System.err.println("Remove " + name + " " + key); return cacheIdx; } public Result invalidate(int segment) { - if(segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment)); + if (segment<0 || segment>=cache.length) return Result.err(Status.ERR_BadData,"Cache Segment %s is out of range",Integer.toString(segment)); @SuppressWarnings("unchecked") Map map = ((Map)cache[segment]); - if(map!=null) { + if (map!=null) { map.clear(); } return Result.ok(); @@ -118,14 +118,14 @@ public class Cached extends Cache)cached.data; rld = Result.ok(ld); } else { rld = getter.get(); - if(rld.isOK()) { // only store valid lists + if (rld.isOK()) { // only store valid lists map.put(key, new Dated(rld.value,expireIn)); // successful item found gets put in cache -// } else if(rld.status == Result.ERR_Backend){ +// } else if (rld.status == Result.ERR_Backend){ // map.remove(key); } } @@ -138,8 +138,8 @@ public class Cached extends Cache ... dao) { - for(CachedDAO d : dao) { - for(int i=0;i d : dao) { + for (int i=0;i extends Cache void startRefresh(AuthzEnv env, CIDAO cidao) { - if(infoTimer==null) { + if (infoTimer==null) { infoTimer = new Timer("CachedDAO Info Refresh Timer"); int minRefresh = 10*1000*60; // 10 mins Integer.parseInt(env.getProperty(CACHE_MIN_REFRESH_INTERVAL,"2000")); // 2 second minimum refresh infoTimer.schedule(new Refresh(env,cidao, minRefresh), 1000, minRefresh); // note: Refresh from DB immediately @@ -156,7 +156,7 @@ public class Cached extends Cache extends Cache rv = cidao.check(trans); - if(rv.status!=Result.OK) { + if (rv.status!=Result.OK) { env.error().log("Error in CacheInfo Refresh",rv.details); } - if(env.debug().isLoggable()) { + if (env.debug().isLoggable()) { StringBuilder sb = new StringBuilder("Cache Info Refresh: "); trans.auditTrail(0, sb, Env.REMOTE); env.debug().log(sb);