From 1934dd9d4aa1143e390ce182b2214270048000ba Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Sun, 28 Jul 2019 01:39:47 +0530 Subject: Sonar Fix: CacheInfoDAO.java Fixed sonar issues across this file Issue-ID: AAF-911 Change-Id: I3810ba6a6de894002a12faaa49bc59501e848917 Signed-off-by: Arundathi Patil --- .../org/onap/aaf/auth/dao/cass/CacheInfoDAO.java | 29 ++++++++++++---------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'auth/auth-cass/src') 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 0ad15277..9672199b 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 @@ -3,6 +3,8 @@ * org.onap.aaf * =========================================================================== * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * Modification Copyright (c) 2019 IBM * =========================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,6 +74,11 @@ public class CacheInfoDAO extends CassDAOImpl impl private final Date startTime; private final boolean cacheNotify; private PreparedStatement psCheck; + + ////////////////////////////////////////// + // 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)); @@ -96,15 +103,14 @@ public class CacheInfoDAO extends CassDAOImpl impl String container = trans.getProperty(Config.AAF_LOCATOR_CONTAINER); return ! ("helm".equals(container) || "oom".equals(container)); } - - ////////////////////////////////////////// - // Data Definition, matches Cassandra DM - ////////////////////////////////////////// - private static final int KEYLIMIT = 2; /** * @author Jonathan */ public static class Data { + public String name; + public int seg; + public Date touched; + public Data() { name = null; touched = null; @@ -114,10 +120,6 @@ public class CacheInfoDAO extends CassDAOImpl impl this.seg = seg; touched = null; } - - public String name; - public int seg; - public Date touched; } private static class InfoLoader extends Loader { @@ -137,8 +139,8 @@ public class CacheInfoDAO extends CassDAOImpl impl } @Override - protected void key(Data data, int _idx, Object[] obj) { - int idx = _idx; + protected void key(Data data, int idxParam, Object[] obj) { + int idx = idxParam; obj[idx]=data.name; obj[++idx]=data.seg; @@ -152,7 +154,8 @@ public class CacheInfoDAO extends CassDAOImpl impl public static synchronized void startUpdate(AuthzEnv env, HMangr hman, SecuritySetter ss, String ip, int port) { if (cacheUpdate==null) { - Thread t= new Thread(cacheUpdate = new CacheUpdate(env,hman,ss, ip,port),"CacheInfo Update Thread"); + cacheUpdate = new CacheUpdate(env,hman,ss, ip,port); + Thread t= new Thread(cacheUpdate,"CacheInfo Update Thread"); t.setDaemon(true); t.start(); } @@ -164,7 +167,7 @@ public class CacheInfoDAO extends CassDAOImpl impl } } - private final static class CacheUpdate extends Thread { + private static final class CacheUpdate extends Thread { public static BlockingQueue notifyDQ = new LinkedBlockingQueue(2000); private static final String VOID_CT="application/Void+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0"; -- cgit 1.2.3-korg