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