refreshDataTree method modified in class GWTdbManagerServiceImpl because if an element is a schema or a db mysql the tables list are loaded and no request is sent to a thread.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@100667 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-10-14 10:57:24 +00:00
parent 3c28bda521
commit 34c2991a37
1 changed files with 27 additions and 18 deletions

View File

@ -2109,6 +2109,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
String keyUsedForSamplingsRefresh = "";
String keyUsedForSmartSamplingRefresh = "";
String keyUsedForRandomSamplingRefresh = "";
boolean requestToAddInQueue=false;
if (!ElementType.equals("")) {
// build key
@ -2116,12 +2117,14 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
case ConstantsPortlet.RESOURCESLIST:
key = scope + inputData.get(ConstantsPortlet.RESOURCESLIST);
dataQueue = new DataExchangedThroughQueue(scope);
requestToAddInQueue = true;
break;
case ConstantsPortlet.RESOURCE:
key = scope + inputData.get("ResourceName");
dataQueue = new DataExchangedThroughQueue(scope,
ConstantsPortlet.RESOURCE, inputData.get("ResourceName"),
null, null, null);
requestToAddInQueue = true;
break;
case ConstantsPortlet.DATABASE:
if (element.getDatabaseType().equals(
@ -2146,6 +2149,7 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
ConstantsPortlet.DATABASE, inputData.get("ResourceName"),
inputData.get("DatabaseName"), null,
element.getDatabaseType());
requestToAddInQueue = true;
key = scope + key;
}
if (element.getDatabaseType().equals(
@ -2180,11 +2184,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// inputData.get("SchemaName"),
// element.getDatabaseType());
dataQueue = new DataExchangedThroughQueue(scope,
ConstantsPortlet.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;
@ -2214,11 +2219,12 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// 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());
// dataQueue = new DataExchangedThroughQueue(scope,
// ConstantsPortlet.SCHEMA, inputData.get("ResourceName"),
// inputData.get("DatabaseName"),
// inputData.get("SchemaName"),
// element.getDatabaseType());
requestToAddInQueue = false;
break;
}
}
@ -2278,15 +2284,18 @@ public class GWTdbManagerServiceImpl extends RemoteServiceServlet implements
// The thread will run in backgroung to load the data
// related to
// the subtree with the item selected as root.
if (isThreadExecutionFinished()) {
logger.info("dbmanager-> Starting the launch of the Thread DataLoader execution");
queue.offer(dataQueue);
Thread t = new Thread(dataLoader);
t.start();
} else {
logger.info("dbmanager-> The Thread DataLoader is already running");
queue.offer(dataQueue);
if(requestToAddInQueue==true){
if (isThreadExecutionFinished()) {
logger.info("dbmanager-> Starting the launch of the Thread DataLoader execution");
queue.offer(dataQueue);
Thread t = new Thread(dataLoader);
t.start();
} else {
logger.info("dbmanager-> The Thread DataLoader is already running");
queue.offer(dataQueue);
}
}
}else{
logger.trace("dbmanager-> Data of the node is not in cache");
}