- some logger.info and logger.trace moved and added in order to improve the debug.
commented code not useful removed. Also the commented methods not useful has been removed: getDatabaseManagerAlgorithms, getParameters, getSubmitQueryResult, getSubmitQueryResultParsed, updateSubmitQueryResultParsed, removeResultParsed, updateSubmitQueryResultMap, removeResult git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100945 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c65cba2a56
commit
2508eed0b6
|
@ -100,7 +100,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
@Override
|
||||
public void init() throws ServletException {
|
||||
|
||||
super.init();
|
||||
|
||||
try {
|
||||
|
@ -108,9 +107,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// cache folder
|
||||
String cachePath = System.getenv("CATALINA_TMPDIR") + "/DBManager";
|
||||
logger.info("dbmanager-> Creating cache in folder: " + cachePath);
|
||||
|
||||
// CacheManager cacheManager = CacheManager.create();
|
||||
|
||||
cacheManager = CacheManager.create();
|
||||
|
||||
if (cacheManager == null) {
|
||||
|
@ -1455,144 +1452,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
return elements;
|
||||
}
|
||||
|
||||
// not called
|
||||
// private List<String> getDatabaseManagerAlgorithms() {
|
||||
// ArrayList<String> dbAlg = new ArrayList<String>();
|
||||
// StatisticalManagerFactory factory = getFactory();
|
||||
// // get and print algorithms
|
||||
// SMListGroupedAlgorithms groups = factory.getAlgorithms();
|
||||
//
|
||||
// if (groups == null)
|
||||
// logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NULL!");
|
||||
// else
|
||||
// logger.info("dbmanager-> GROUPS OF ALGORITHMS IS NOT NULL!");
|
||||
//
|
||||
// // get list categories
|
||||
// for (SMGroupedAlgorithms group : groups.thelist()) {
|
||||
// for (SMAlgorithm algorithm : group.thelist()) {
|
||||
// dbAlg.add(algorithm.name());
|
||||
// }
|
||||
// }
|
||||
// return dbAlg;
|
||||
// }
|
||||
|
||||
// not used
|
||||
// private List<Parameter> getParameters(String algorithmId) {
|
||||
// StatisticalManagerFactory factory = getFactory();
|
||||
// SMParameters smParams = factory.getAlgorithmParameters(algorithmId);
|
||||
// List<Parameter> params = new ArrayList<Parameter>();
|
||||
//
|
||||
// for (SMParameter smParam : smParams.list()) {
|
||||
// SMTypeParameter smType = smParam.type();
|
||||
// StatisticalServiceType smTypeName = smType.name();
|
||||
//
|
||||
// String paramName = smParam.name();
|
||||
// String paramDescription = smParam.description();
|
||||
// String defaultValue = smParam.defaultValue();
|
||||
// String objectType = smType.values().get(0);
|
||||
//
|
||||
// // print CHECK
|
||||
// // logger.info("parameters: ");
|
||||
// // logger.info(paramName);
|
||||
// // logger.info(paramDescription);
|
||||
// // logger.info(objectType);
|
||||
// // logger.info(defaultValue);
|
||||
//
|
||||
// Parameter objectParam = new Parameter(paramName, paramDescription,
|
||||
// objectType, defaultValue);
|
||||
// params.add(objectParam);
|
||||
// }
|
||||
// return params;
|
||||
// }
|
||||
|
||||
// private synchronized List<Result> getSubmitQueryResult(String
|
||||
// submitQueryUID) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||
// List<Result>>) session
|
||||
// .getAttribute("submitQueryResult");
|
||||
// if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||
// return submitQueryResult.get(submitQueryUID);
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private synchronized List<Row> getSubmitQueryResultParsed(
|
||||
// String submitQueryUID) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||
// List<Row>>) session
|
||||
// .getAttribute("submitQueryResultParsed");
|
||||
//
|
||||
// if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||
// // System.out.println("ResultParsed: UID contained");
|
||||
// return submitQueryResultParsed.get(submitQueryUID);
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private synchronized void updateSubmitQueryResultParsed(
|
||||
// String submitQueryUID, List<Row> data) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||
// List<Row>>) session
|
||||
// .getAttribute("submitQueryResultParsed");
|
||||
// // add data
|
||||
// if (data.size() != 0) {
|
||||
// submitQueryResultParsed.put(submitQueryUID, data);
|
||||
// session.setAttribute("submitQueryResultParsed",
|
||||
// submitQueryResultParsed);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private synchronized void removeResultParsed(String submitQueryUID) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Row>> submitQueryResultParsed = (HashMap<String,
|
||||
// List<Row>>) session
|
||||
// .getAttribute("submitQueryResultParsed");
|
||||
// if (submitQueryResultParsed.containsKey(submitQueryUID)) {
|
||||
// // remove data parsed
|
||||
// submitQueryResultParsed.remove(submitQueryUID);
|
||||
// // update
|
||||
// session.setAttribute("submitQueryResultParsed",
|
||||
// submitQueryResultParsed);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private synchronized void updateSubmitQueryResultMap(String
|
||||
// submitQueryUID,
|
||||
// List<Result> result) {
|
||||
// if (submitQueryUID != null) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||
// List<Result>>) session
|
||||
// .getAttribute("submitQueryResult");
|
||||
// submitQueryResult.put(submitQueryUID, result);
|
||||
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||
// }
|
||||
// }
|
||||
|
||||
// private synchronized void removeResult(String submitQueryUID) {
|
||||
// ASLSession session = SessionUtil.getAslSession(this
|
||||
// .getThreadLocalRequest().getSession());
|
||||
// HashMap<String, List<Result>> submitQueryResult = (HashMap<String,
|
||||
// List<Result>>) session
|
||||
// .getAttribute("submitQueryResult");
|
||||
// if (submitQueryResult.containsKey(submitQueryUID)) {
|
||||
// // remove data parsed
|
||||
// submitQueryResult.remove(submitQueryUID);
|
||||
// // update
|
||||
// session.setAttribute("submitQueryResult", submitQueryResult);
|
||||
// }
|
||||
// }
|
||||
|
||||
// update job with the related status
|
||||
private synchronized void updateJobStatus(String jobID, String status) {
|
||||
if (jobID != null) {
|
||||
|
@ -2070,45 +1929,29 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void insertDataIntoCache(net.sf.ehcache.Element data) {
|
||||
logger.info("dbmanager-> disk store path for the cache: " + cacheManager.getDiskStorePath());
|
||||
private synchronized void insertDataIntoCache(net.sf.ehcache.Element data) throws Exception{
|
||||
|
||||
if(cacheManager.cacheExists("DBCache")){
|
||||
logger.info("dbmanager-> disk store path for cache: " + cacheManager.getDiskStorePath() +"Cache Status: "+DBCache.getStatus().toString());
|
||||
if (DBCache.getStatus().toString().equals(Status.STATUS_ALIVE.toString())){
|
||||
logger.info("dbmanager-> Cache Status:"+ "STATUS_ALIVE");
|
||||
|
||||
DBCache.put(data);
|
||||
// logger.info("dbmanager-> element added in cache with key: " + data.getKey().toString());
|
||||
|
||||
}else{
|
||||
logger.info("dbmanager-> Cache Status:"+ DBCache.getStatus().toString());
|
||||
logger.trace("dbmanager-> element with key: " + data.getKey().toString()+" added in cache");
|
||||
}
|
||||
}
|
||||
// if (DBCache != null) {
|
||||
// DBCache.put(data);
|
||||
// }
|
||||
}
|
||||
|
||||
private synchronized net.sf.ehcache.Element getDataFromCache(String key) {
|
||||
private synchronized net.sf.ehcache.Element getDataFromCache(String key) throws Exception{
|
||||
net.sf.ehcache.Element data = null;
|
||||
logger.info("dbmanager-> disk store path for the cache: " + cacheManager.getDiskStorePath());
|
||||
|
||||
if(cacheManager.cacheExists("DBCache")){
|
||||
logger.info("dbmanager-> disk store path for cache: " + cacheManager.getDiskStorePath() +". Cache Status: "+DBCache.getStatus().toString());
|
||||
if (DBCache.getStatus().toString().equals(Status.STATUS_ALIVE.toString())){
|
||||
logger.info("dbmanager-> Cache Status:"+ "STATUS_ALIVE");
|
||||
|
||||
data = DBCache.get(key);
|
||||
// System.out.println("element get from cache with key " + key);
|
||||
|
||||
}else{
|
||||
logger.info("dbmanager-> Cache Status:"+ DBCache.getStatus().toString());
|
||||
if (data!=null){
|
||||
logger.trace("dbmanager-> element with key: " + key +" is in cache");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (DBCache != null) {
|
||||
// data = DBCache.get(key);
|
||||
// }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -2117,7 +1960,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
LinkedHashMap<String, String> inputData, FileModel element)
|
||||
throws Exception {
|
||||
|
||||
logger.info("dbmanager-> Refresh data request received. Starting to manage the request.");
|
||||
logger.info("dbmanager-> Refresh data request received from element "+ElementType+". Starting to manage the request.");
|
||||
|
||||
// session check
|
||||
if (isSessionExpired())
|
||||
|
@ -2174,12 +2017,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
+ ConstantsPortlet.ALGID_SUBMITQUERY + key;
|
||||
|
||||
refreshSubmittedQueryInCache(keyUsedForQueryRefresh);
|
||||
// loader = new ThreadLoaderData(scope, "database",
|
||||
// inputData.get("ResourceName"),
|
||||
// inputData.get("DatabaseName"), null,
|
||||
// element.getDatabaseType());
|
||||
// loader = new ThreadLoaderData(scope, "database",
|
||||
// inputData, ConstantsPortlet.POSTGRES);
|
||||
|
||||
dataQueue = new DataExchangedThroughQueue(scope,
|
||||
ConstantsPortlet.DATABASE, inputData.get("ResourceName"),
|
||||
|
@ -2211,20 +2048,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
refreshSamplingsInCache(keyUsedForSamplingsRefresh,
|
||||
keyUsedForSmartSamplingRefresh);
|
||||
|
||||
// loader = new ThreadLoaderData(scope, "database",
|
||||
// inputData, ConstantsPortlet.MYSQL);
|
||||
|
||||
// loader = new ThreadLoaderData(scope, "database",
|
||||
// inputData.get("ResourceName"),
|
||||
// inputData.get("DatabaseName"),
|
||||
// inputData.get("SchemaName"),
|
||||
// element.getDatabaseType());
|
||||
|
||||
// dataQueue = new DataExchangedThroughQueue(scope,
|
||||
// ConstantsPortlet.DATABASE, inputData.get("ResourceName"),
|
||||
// inputData.get("DatabaseName"),
|
||||
// inputData.get("SchemaName"),
|
||||
// element.getDatabaseType());
|
||||
requestToAddInQueue = false;
|
||||
}
|
||||
break;
|
||||
|
@ -2252,26 +2075,18 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
refreshSamplingsInCache(keyUsedForSamplingsRefresh,
|
||||
keyUsedForSmartSamplingRefresh);
|
||||
|
||||
// loader = new ThreadLoaderData(scope, "schema",
|
||||
// inputData, ConstantsPortlet.POSTGRES);
|
||||
|
||||
// dataQueue = new DataExchangedThroughQueue(scope,
|
||||
// ConstantsPortlet.SCHEMA, inputData.get("ResourceName"),
|
||||
// inputData.get("DatabaseName"),
|
||||
// inputData.get("SchemaName"),
|
||||
// element.getDatabaseType());
|
||||
requestToAddInQueue = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
logger.trace("dbmanager-> Check if data of the node is present in cache with key: : " + key);
|
||||
// logger.trace("dbmanager-> Check if data of the node is present in cache with key: : " + key);
|
||||
net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
|
||||
|
||||
if (dataFromCache != null) {
|
||||
logger.trace("dbmanager-> Data of the node is in cache");
|
||||
// logger.trace("dbmanager-> Data of the node is in cache");
|
||||
|
||||
logger.info("dbmanager-> Starting the data removing process in cache from the node");
|
||||
logger.info("dbmanager-> Starting the data removing process in cache from the node with key: " + key);
|
||||
|
||||
// refresh data in cache. Remove data related to the subtree
|
||||
// with the selected element as root
|
||||
|
@ -2313,13 +2128,10 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
// check if the thread execution is terminated. If yes, a
|
||||
// new
|
||||
// thread is started otherwise no because the thread in
|
||||
// running
|
||||
// state will also serve this request received in the queue.
|
||||
// new thread is started otherwise no because the thread in
|
||||
// running state will also serve this request received in the queue.
|
||||
// The thread will run in backgroung to load the data
|
||||
// related to
|
||||
// the subtree with the item selected as root.
|
||||
// related to the subtree with the item selected as root.
|
||||
if(requestToAddInQueue==true){
|
||||
if (isThreadExecutionFinished()) {
|
||||
logger.info("dbmanager-> Starting the launch of the Thread DataLoader execution");
|
||||
|
@ -2327,14 +2139,15 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
Thread t = new Thread(dataLoader);
|
||||
t.start();
|
||||
} else {
|
||||
logger.info("dbmanager-> The Thread DataLoader is already running");
|
||||
logger.info("dbmanager-> The Thread DataLoader is already running. Tree Refresh request put in Queue");
|
||||
queue.offer(dataQueue);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
logger.trace("dbmanager-> Data of the node is not in cache");
|
||||
}
|
||||
// else{
|
||||
// logger.trace("dbmanager-> Data of the node is not in cache");
|
||||
// }
|
||||
}
|
||||
return result;
|
||||
|
||||
|
@ -2360,7 +2173,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
Object value = null;
|
||||
if (dataFromCache != null) {
|
||||
logger.info("dbmanager-> Data is in cache");
|
||||
// logger.info("dbmanager-> Data is in cache");
|
||||
|
||||
value = dataFromCache.getObjectValue();
|
||||
if (value != null) {
|
||||
|
@ -2371,8 +2184,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
List<FileModel> resources = (List<FileModel>) value;
|
||||
// refresh cache
|
||||
refreshCache(key);
|
||||
logger.trace("dbmanager-> element: " + ElementType
|
||||
+ " with key: " + key + " removed in cache");
|
||||
// logger.trace("dbmanager-> element: " + ElementType
|
||||
// + " with key: " + key + " removed in cache");
|
||||
// apply the refresh on children
|
||||
for (int i = 0; i < resources.size(); i++) {
|
||||
key = scope + resources.get(i).getName();
|
||||
|
@ -2385,8 +2198,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
LinkedHashMap<String, FileModel> DBdata = (LinkedHashMap<String, FileModel>) value;
|
||||
// refresh cache
|
||||
refreshCache(key);
|
||||
logger.trace("dbmanager-> element " + ElementType
|
||||
+ " with key: " + key + " removed in cache");
|
||||
// logger.trace("dbmanager-> element " + ElementType
|
||||
// + " with key: " + key + " removed in cache");
|
||||
// apply the refresh on children
|
||||
HashMap<String, String> DBlist = new HashMap<String, String>();
|
||||
|
||||
|
@ -2456,8 +2269,8 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
List<FileModel> schemaList = (List<FileModel>) value;
|
||||
|
||||
refreshCache(key); // refresh schema
|
||||
logger.trace("dbmanager-> element " + ElementType
|
||||
+ " with key: " + key + " removed in cache");
|
||||
// logger.trace("dbmanager-> element " + ElementType
|
||||
// + " with key: " + key + " removed in cache");
|
||||
if (DBType.equals(ConstantsPortlet.POSTGRES)) {
|
||||
// SCHEMA
|
||||
for (int i = 0; i < schemaList.size(); i++) {
|
||||
|
@ -2472,69 +2285,47 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
// refresh tables
|
||||
key = key + "";
|
||||
refreshCache(key); // refresh tables
|
||||
logger.trace("dbmanager-> element " + ElementType
|
||||
+ " with key: " + key
|
||||
+ " removed in cache");
|
||||
// logger.trace("dbmanager-> element " + ElementType
|
||||
// + " with key: " + key
|
||||
// + " removed in cache");
|
||||
}
|
||||
|
||||
break;
|
||||
case ConstantsPortlet.SCHEMA:
|
||||
// refresh tables (db postgres)
|
||||
refreshCache(key);
|
||||
logger.trace("dbmanager-> element " + ElementType
|
||||
+ " with key: " + key + " removed in cache");
|
||||
// logger.trace("dbmanager-> element " + ElementType
|
||||
// + " with key: " + key + " removed in cache");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info("dbmanager-> Data not in cache");
|
||||
}
|
||||
// else {
|
||||
// logger.info("dbmanager-> Data not in cache");
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
logger.error("dbmanager-> ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private synchronized void refreshCache(String key) throws Exception {
|
||||
|
||||
logger.info("dbmanager-> disk store path for the cache: " + cacheManager.getDiskStorePath());
|
||||
|
||||
if(cacheManager.cacheExists("DBCache")){
|
||||
logger.info("dbmanager-> disk store path for cache: " + cacheManager.getDiskStorePath() +"Cache Status: "+DBCache.getStatus().toString());
|
||||
if (DBCache.getStatus().toString().equals(Status.STATUS_ALIVE.toString())){
|
||||
logger.info("dbmanager-> Cache Status:"+ Status.STATUS_ALIVE.toString());
|
||||
|
||||
DBCache.remove(key);
|
||||
// logger.info("dbmanager-> Element with key: " +key+ " removed.");
|
||||
}else{
|
||||
logger.info("dbmanager-> Cache Status:"+ DBCache.getStatus().toString());
|
||||
logger.trace("dbmanager-> element with key: " + key + " removed in cache");
|
||||
}
|
||||
}
|
||||
|
||||
// try {
|
||||
// System.out.println("SIZE CACHE PRE REMOVING: " + DBCache.getSize());
|
||||
// DBCache.remove(key);
|
||||
// System.out.println("SIZE CACHE POST REMOVING: " + DBCache.getSize());
|
||||
// } catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
// logger.error("dbmanager-> ", e);
|
||||
// throw new Exception("Failure to clear the cache. " + e);
|
||||
// throw new Exception(
|
||||
// "Error in server while loading data. Exception: " + e);
|
||||
// }
|
||||
}
|
||||
|
||||
private synchronized void refreshSubmittedQueryInCache(String key)
|
||||
throws Exception {
|
||||
|
||||
logger.info("dbmanager-> refreshing submitted queries in cache with key:"
|
||||
+ key);
|
||||
|
||||
logger.info("dbmanager-> disk store path for the cache: " + cacheManager.getDiskStorePath());
|
||||
|
||||
if(cacheManager.cacheExists("DBCache")){
|
||||
logger.info("dbmanager-> disk store path for cache: " + cacheManager.getDiskStorePath() +"Cache Status: "+DBCache.getStatus().toString());
|
||||
if (DBCache.getStatus().toString().equals(Status.STATUS_ALIVE.toString())){
|
||||
logger.info("dbmanager-> Cache Status:"+ "STATUS_ALIVE");
|
||||
// logger.info("dbmanager-> Cache Status:"+ "STATUS_ALIVE");
|
||||
|
||||
List<String> keysInCache = DBCache.getKeys();
|
||||
int listSize = keysInCache.size();
|
||||
|
@ -2550,45 +2341,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
// remove keys
|
||||
DBCache.removeAll(keysToBeRemoved);
|
||||
// System.out.println("SubmittedQuery refreshed with key: " + key);
|
||||
|
||||
}else{
|
||||
logger.info("dbmanager-> Cache Status:"+ DBCache.getStatus().toString());
|
||||
logger.trace("dbmanager-> submitted queries refreshed in cache with key:"
|
||||
+ key);
|
||||
}
|
||||
}
|
||||
|
||||
// List<String> keysInCache = DBCache.getKeys();
|
||||
// int listSize = keysInCache.size();
|
||||
// List<String> keysToBeRemoved = new ArrayList<>();
|
||||
//
|
||||
// // recover keys list that match the key
|
||||
// for (int i = 0; i < listSize; i++) {
|
||||
// if (keysInCache.get(i).startsWith(key)) {
|
||||
// // System.out.println("data removed with key: " +
|
||||
// // keysInCache.get(i));
|
||||
// keysToBeRemoved.add(keysInCache.get(i));
|
||||
// }
|
||||
// }
|
||||
// // remove keys
|
||||
// DBCache.removeAll(keysToBeRemoved);
|
||||
// // System.out.println("SubmittedQuery refreshed with key: " + key);
|
||||
}
|
||||
|
||||
private synchronized void refreshSamplingsInCache(
|
||||
String keyUsedForSamplingsRefresh,
|
||||
String keyUsedForSmartSamplingRefresh) throws Exception {
|
||||
|
||||
logger.info("dbmanager-> refreshing samplings and smart sampling in cache with keys: "
|
||||
+ keyUsedForSamplingsRefresh
|
||||
+ " "
|
||||
+ keyUsedForSmartSamplingRefresh);
|
||||
|
||||
logger.info("dbmanager-> disk store path for the cache: " + cacheManager.getDiskStorePath());
|
||||
|
||||
|
||||
if(cacheManager.cacheExists("DBCache")){
|
||||
logger.info("dbmanager-> disk store path for cache: " + cacheManager.getDiskStorePath() +"Cache Status: "+DBCache.getStatus().toString());
|
||||
if (DBCache.getStatus().toString().equals(Status.STATUS_ALIVE.toString())){
|
||||
logger.info("dbmanager-> Cache Status:"+ "STATUS_ALIVE");
|
||||
|
||||
List<String> keysInCache = DBCache.getKeys();
|
||||
int listSize = keysInCache.size();
|
||||
|
@ -2604,31 +2369,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
// remove keys
|
||||
DBCache.removeAll(keysToBeRemoved);
|
||||
// System.out.println("Samplings refreshed with keys: "
|
||||
// + keyUsedForSamplingsRefresh + " "
|
||||
// + keyUsedForSmartSamplingRefresh);
|
||||
}else{
|
||||
logger.info("dbmanager-> Cache Status:"+ DBCache.getStatus().toString());
|
||||
logger.trace("dbmanager-> samplings and smart sampling refreshed in cache with keys: "
|
||||
+ keyUsedForSamplingsRefresh
|
||||
+ " "
|
||||
+ keyUsedForSmartSamplingRefresh);
|
||||
}
|
||||
}
|
||||
|
||||
// List<String> keysInCache = DBCache.getKeys();
|
||||
// int listSize = keysInCache.size();
|
||||
// List<String> keysToBeRemoved = new ArrayList<>();
|
||||
//
|
||||
// // recover keys list that match the key
|
||||
// for (int i = 0; i < listSize; i++) {
|
||||
// if ((keysInCache.get(i).startsWith(keyUsedForSamplingsRefresh))
|
||||
// || (keysInCache.get(i)
|
||||
// .startsWith(keyUsedForSmartSamplingRefresh))) {
|
||||
// keysToBeRemoved.add(keysInCache.get(i));
|
||||
// }
|
||||
// }
|
||||
// // remove keys
|
||||
// DBCache.removeAll(keysToBeRemoved);
|
||||
// // System.out.println("Samplings refreshed with keys: "
|
||||
// // + keyUsedForSamplingsRefresh + " "
|
||||
// // + keyUsedForSmartSamplingRefresh);
|
||||
}
|
||||
|
||||
private String storeResultIntoCSVFile(List<Result> result, String n)
|
||||
|
@ -2775,7 +2521,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
key, outputParameters);
|
||||
|
||||
insertDataIntoCache(dataToCache);
|
||||
logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
// logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
}
|
||||
}
|
||||
return outputParameters;
|
||||
|
@ -2868,7 +2614,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
key, outputParameters);
|
||||
|
||||
insertDataIntoCache(dataToCache);
|
||||
logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
// logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
}
|
||||
}
|
||||
return outputParameters;
|
||||
|
@ -2974,7 +2720,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
key, outputParameters);
|
||||
|
||||
insertDataIntoCache(dataToCache);
|
||||
logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
// logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
// DBCache.put(dataToCache);
|
||||
}
|
||||
}
|
||||
|
@ -3096,7 +2842,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
|||
key, outputParameters);
|
||||
|
||||
insertDataIntoCache(dataToCache);
|
||||
logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
// logger.trace("dbmanager-> element added in cache with key: " + key);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue