X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-cass%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fdao%2Fcass%2FCacheInfoDAO.java;fp=auth%2Fauth-cass%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fdao%2Fcass%2FCacheInfoDAO.java;h=6a32a365ed22057a3550e7bcc8a1699995289d2d;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=eea3c4c27c2f896b3f68a07afed523e9d44616a7;hpb=bdce7667a6e272e2fa32e298d957a0d9090c5bc9;p=aaf%2Fauthz.git diff --git a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java index eea3c4c2..6a32a365 100644 --- a/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java +++ b/auth/auth-cass/src/main/java/org/onap/aaf/auth/dao/cass/CacheInfoDAO.java @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -69,7 +69,7 @@ public class CacheInfoDAO extends CassDAOImpl impl public static final Map info = new ConcurrentHashMap<>(); private static CacheUpdate cacheUpdate; - + // Hold current time stamps from Tables private final Date startTime; private final boolean cacheNotify; @@ -79,7 +79,7 @@ public class CacheInfoDAO extends CassDAOImpl impl // Data Definition, matches Cassandra DM ////////////////////////////////////////// private static final int KEYLIMIT = 2; - + public CacheInfoDAO(AuthzTrans trans, Cluster cluster, String keyspace) throws APIException, IOException { super(trans, CacheInfoDAO.class.getSimpleName(),cluster,keyspace,Data.class,TABLE,readConsistency(trans,TABLE), writeConsistency(trans,TABLE)); startTime = new Date(); @@ -94,8 +94,8 @@ public class CacheInfoDAO extends CassDAOImpl impl cacheNotify = noK8s(trans); } - /** - * Need a different point to point cache clear strategy for K8s... + /** + * Need a different point to point cache clear strategy for K8s... * @param trans * @return */ @@ -124,11 +124,11 @@ public class CacheInfoDAO extends CassDAOImpl impl private static class InfoLoader extends Loader { public static final InfoLoader dflt = new InfoLoader(KEYLIMIT); - + public InfoLoader(int keylimit) { super(keylimit); } - + @Override public Data load(Data data, Row row) { // Int more efficient @@ -151,7 +151,7 @@ public class CacheInfoDAO extends CassDAOImpl impl obj[idx]=data.touched; } } - + public static synchronized void startUpdate(AuthzEnv env, HMangr hman, SecuritySetter ss, String ip, int port) { if (cacheUpdate==null) { cacheUpdate = new CacheUpdate(env,hman,ss, ip,port); @@ -176,15 +176,15 @@ public class CacheInfoDAO extends CassDAOImpl impl private SecuritySetter ss; private final String authority; public boolean go = true; - + public CacheUpdate(AuthzEnv env, HMangr hman, SecuritySetter ss, String ip, int port) { this.env = env; this.hman = hman; this.ss = ss; - + this.authority = ip+':'+port; } - + private static class Transfer { public String table; public int segs[]; @@ -198,7 +198,7 @@ public class CacheInfoDAO extends CassDAOImpl impl private AuthzTrans trans; private String type; private String segs; - + public CacheClear(AuthzTrans trans) { this.trans = trans; } @@ -207,7 +207,7 @@ public class CacheInfoDAO extends CassDAOImpl impl type = es.getKey(); segs = es.getValue().toString(); } - + @Override public Integer code(Rcli client) throws APIException, CadiException { URI to = client.getURI(); @@ -222,11 +222,11 @@ public class CacheInfoDAO extends CassDAOImpl impl return total; } } - + private class IntHolder { private int[] raw; HashSet set; - + public IntHolder(int ints[]) { raw = ints; set = null; @@ -234,7 +234,7 @@ public class CacheInfoDAO extends CassDAOImpl impl public void add(int[] ints) { if (set==null) { set = new HashSet<>(); - + for (int i=0;i impl return sb.toString(); } } - + @Override public void run() { do { @@ -279,7 +279,7 @@ public class CacheInfoDAO extends CassDAOImpl impl if (data==null) { continue; } - + int count = 0; CacheClear cc = null; Map gather = null; @@ -319,7 +319,7 @@ public class CacheInfoDAO extends CassDAOImpl impl sb.append(count); if (count==1) { sb.append(" entry for "); - } else { + } else { sb.append(" entries for "); } int peers = count<=0?0:cc.total/count; @@ -354,13 +354,13 @@ public class CacheInfoDAO extends CassDAOImpl impl /* (non-Javadoc) * @see org.onap.aaf.auth.dao.cass.CIDAO#touch(org.onap.aaf.auth.env.test.AuthzTrans, java.lang.String, int) */ - + @Override public Result touch(AuthzTrans trans, String name, int ... seg) { ///////////// // Direct Service Cache Invalidation ///////////// - // ConcurrentQueues are open-ended. We don't want any Memory leaks + // ConcurrentQueues are open-ended. We don't want any Memory leaks // Note: we keep a separate counter, because "size()" on a Linked Queue is expensive if (cacheNotify && cacheUpdate!=null) { try { @@ -389,7 +389,7 @@ public class CacheInfoDAO extends CassDAOImpl impl sb.append(name); sb.append("' AND seg = "); sb.append(s); - sb.append(";\n"); + sb.append(";\n"); if (first) { first =false; } else { @@ -425,7 +425,7 @@ public class CacheInfoDAO extends CassDAOImpl impl } finally { tt.done(); } - + String lastName = null; Date[] dates = null; for (Row row : rs.all()) { @@ -451,7 +451,7 @@ public class CacheInfoDAO extends CassDAOImpl impl } return Result.ok(); } - + /* (non-Javadoc) * @see org.onap.aaf.auth.dao.cass.CIDAO#get(java.lang.String, int) */