add data caching on sampling and smartSampling
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100290 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
53ac9390b7
commit
67dc075dcc
|
@ -907,7 +907,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
// data output
|
// data output
|
||||||
// List<Result> output = new ArrayList<Result>();
|
// List<Result> output = new ArrayList<Result>();
|
||||||
List<Result> output = null;
|
List<Result> output = null;
|
||||||
SubmitQueryResultWithFileFromServlet result;
|
|
||||||
|
|
||||||
// list that contains table attributes
|
// list that contains table attributes
|
||||||
List<String> listAttributes = null;
|
List<String> listAttributes = null;
|
||||||
|
@ -964,30 +964,6 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
inputParameters.get(4).setValue(language);
|
inputParameters.get(4).setValue(language);
|
||||||
inputParameters.get(5).setValue(query);
|
inputParameters.get(5).setValue(query);
|
||||||
|
|
||||||
// get data from cache
|
|
||||||
// check if data exist considering as key the input parameters
|
|
||||||
|
|
||||||
// parse the query in order to remove spaces
|
|
||||||
String queryParsed = parseQuery(inputParameters.get(5).getValue());
|
|
||||||
|
|
||||||
String key = inputParameters.get(0).getValue()
|
|
||||||
+ inputParameters.get(1).getValue()
|
|
||||||
+ inputParameters.get(2).getValue()
|
|
||||||
+ inputParameters.get(3).getValue()
|
|
||||||
+ inputParameters.get(4).getValue()
|
|
||||||
+ queryParsed;
|
|
||||||
|
|
||||||
net.sf.ehcache.Element dataFromCache = getDataFromCache(key);
|
|
||||||
|
|
||||||
Object value = null;
|
|
||||||
if (dataFromCache != null) {
|
|
||||||
value = dataFromCache.getObjectValue();
|
|
||||||
// System.out.println("***GETTING DATA FROM CACHE");
|
|
||||||
}
|
|
||||||
if (value != null) {
|
|
||||||
result = (SubmitQueryResultWithFileFromServlet) value;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// create data structure
|
// create data structure
|
||||||
ComputationOutput outputData = new ComputationOutput();
|
ComputationOutput outputData = new ComputationOutput();
|
||||||
|
@ -1056,15 +1032,9 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
String partialPathFile = applicationPath + "/computationResult/"
|
String partialPathFile = applicationPath + "/computationResult/"
|
||||||
+ fileName;
|
+ fileName;
|
||||||
|
|
||||||
result = new SubmitQueryResultWithFileFromServlet(
|
SubmitQueryResultWithFileFromServlet result = new SubmitQueryResultWithFileFromServlet(
|
||||||
listAttributes, convertedQuery, partialPathFile);
|
listAttributes, convertedQuery, partialPathFile);
|
||||||
|
|
||||||
// put data in cache
|
|
||||||
net.sf.ehcache.Element dataToCache = new net.sf.ehcache.Element(
|
|
||||||
key, result);
|
|
||||||
insertDataIntoCache(dataToCache);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -2443,11 +2413,5 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
|
||||||
.getSession());
|
.getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String parseQuery(String query) {
|
|
||||||
String queryParsed;
|
|
||||||
|
|
||||||
queryParsed = query.trim();
|
|
||||||
queryParsed = queryParsed.replaceAll(" +", " ");
|
|
||||||
return queryParsed;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue