diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java index cded38b..f4708bd 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/server/GWTdbManagerServiceImpl.java @@ -94,6 +94,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements private static boolean threadExecutionFinished = false; private static ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); private static ThreadDataLoader dataLoader; + + private static int smComputationNumber; + private static int cacheHitsNumber; + + private static int smComputationQuerySamplingNumber; + private static int cacheQuerySamplingHitsNumber; public GWTdbManagerServiceImpl() throws Exception { } @@ -103,7 +109,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements super.init(); try { - + // cache folder String cachePath = System.getenv("CATALINA_TMPDIR") + "/DBManager"; logger.info("dbmanager-> Creating cache in folder: " + cachePath); @@ -159,6 +165,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements // create the thread DataLoader dataLoader = new ThreadDataLoader(); logger.info("dbmanager-> Thread Dataloader created"); + + smComputationNumber = 0; + cacheHitsNumber = 0; + + smComputationQuerySamplingNumber = 0; + cacheQuerySamplingHitsNumber = 0; + } catch (Exception e) { logger.error("dbmanager-> ", e); @@ -286,7 +299,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements HashMap listKeySubmitQueryResult = new HashMap(); session.setAttribute("listKeySubmitQueryResult", listKeySubmitQueryResult); - + + //print data + logger.info("dbmanager-> CheckInformation: cache hits number " + cacheHitsNumber); + logger.info("dbmanager-> CheckInformation: SM computation number " + smComputationNumber); + logger.info("dbmanager-> CheckInformation: cache Query Sampling hits number " + cacheQuerySamplingHitsNumber); + logger.info("dbmanager-> CheckInformation: SM Query Sampling computation number " + smComputationQuerySamplingNumber); } // to get resources from IS @@ -629,12 +647,19 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements if ((data != null) && (submitQueryResult != null)) { result = (SubmitQueryResultWithFileFromServlet) data; + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); + cacheQuerySamplingHitsNumber++; // set variable to true value if cached data are used and a // computation is not started Boolean val = new Boolean(true); updateListSubmitQueryUIDCachedData(UID, val); } else { + + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); + smComputationQuerySamplingNumber++; // set variable to false value if cached data are not used and a // computation is started @@ -648,6 +673,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements String computationId = startComputation(algorithmId, inputParameters, outputData, scope, UID); + // get JobID if (checkJob(UID)) { // if the computation has not been removed // the job uid is present @@ -858,11 +884,16 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements } if (value != null) { result = (SamplingResultWithFileFromServlet) value; + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); + cacheQuerySamplingHitsNumber++; } else { + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); + smComputationQuerySamplingNumber++; // start computation - // create data structure ComputationOutput outputData = new ComputationOutput(); // computation id @@ -1012,9 +1043,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements } if (value != null) { result = (SamplingResultWithFileFromServlet) value; - + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); + cacheQuerySamplingHitsNumber++; } else { - + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); + smComputationQuerySamplingNumber++; // create data structure ComputationOutput outputData = new ComputationOutput(); // computation id @@ -2490,8 +2525,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements if (value != null) { // System.out.println("***GETTING DATA FROM CACHE"); outputParameters = (List) value; + + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); } else { - + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); + // start the computation // System.out.println("***STARTING THE COMPUTATION"); // create data structure for data output @@ -2571,9 +2611,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements } if (value != null) { outputParameters = (LinkedHashMap) value; + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); // System.out.println("***GETTING DATA FROM CACHE"); } else { - + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); // start the computation // System.out.println("***STARTING THE COMPUTATION"); // create data structure @@ -2683,7 +2726,11 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements } if (value != null) { outputParameters = (List) value; + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); } else { + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); // start the computation // create data structure @@ -2808,9 +2855,13 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements } if (value != null) { outputParameters = (List) value; + cacheHitsNumber++; + logger.info("dbmanager-> CheckDataInCache: data found in cache. cacheHitsNumber: " + cacheHitsNumber); } else { + smComputationNumber++; + logger.info("dbmanager-> CheckDataInCache: data not found in cache. Starting the Statistical Computation. smComputationNumber: " + smComputationNumber); // start computation // create data structure ComputationOutput outputData = new ComputationOutput();