Support Scheduled Task take in charge from Orphaned RIs


git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@142465 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-02-10 17:00:16 +00:00
parent abeba6a08d
commit 7c91d6f819
1 changed files with 6 additions and 6 deletions

View File

@ -223,13 +223,13 @@ public class OrientDBPersistenceConnector extends
db = oPartitionedDatabasePool.acquire();
String type = ScheduledTask.class.getSimpleName();
String queryString = String.format("SELECT * FROM %s", type);
String queryString = String.format("SELECT * FROM %s WHERE %s = '%s'", type, "scope", SmartExecutorInitializator.getCurrentScope());
if(pluginDeclarations!=null && pluginDeclarations.size()!=0){
boolean first = true;
for(PluginDeclaration pluginDeclaration : pluginDeclarations){
if(first){
first = false;
queryString = String.format("%s WHERE ( (%s = '%s') ",
queryString = String.format("%s AND ( (%s = '%s') ",
queryString,
ScheduledTask.LAUNCH_PARAMETER + "." + LaunchParameter.PLUGIN_NAME,
pluginDeclaration.getName());
@ -342,7 +342,7 @@ public class OrientDBPersistenceConnector extends
Long timestamp = doc.field(TIMESTAMP);
if (timestamp!=null && timestamp != scheduledTask.getTimestamp()) {
if (timestamp!=null && timestamp.compareTo(scheduledTask.getTimestamp())!=0) {
throw new SchedulePersistenceException(
"The ScheduledTask has been already reserved.");
}
@ -404,7 +404,7 @@ public class OrientDBPersistenceConnector extends
ODocument doc = getScheduledTaskDocument(db, uuid);
Long timestamp = doc.field(TIMESTAMP);
if (timestamp!=null && timestamp != scheduledTask.getTimestamp()) {
if (timestamp!=null && timestamp.compareTo(scheduledTask.getTimestamp())!=0) {
throw new SchedulePersistenceException(
"The ScheduledTask has been changed.");
}
@ -453,8 +453,8 @@ public class OrientDBPersistenceConnector extends
UUID uuid = scheduledTask.getUUID();
ODocument doc = getScheduledTaskDocument(db, uuid);
long timestamp = doc.field(TIMESTAMP);
if (timestamp != scheduledTask.getTimestamp()) {
Long timestamp = doc.field(TIMESTAMP);
if (timestamp!=null && timestamp.compareTo(scheduledTask.getTimestamp())!=0) {
throw new SchedulePersistenceException(
"The ScheduledTask has been changed.");
}