Removed singleton variable from initializator

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/vre-management/smart-executor@119601 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-10-12 09:51:21 +00:00
parent b0a2518341
commit a9db3b4c91
2 changed files with 11 additions and 25 deletions

View File

@ -41,7 +41,7 @@ public class SmartExecutorImpl implements SmartExecutor {
public String launch(LaunchParameter parameter) throws InputsNullException, public String launch(LaunchParameter parameter) throws InputsNullException,
PluginNotFoundException, LaunchException, ExecutorException { PluginNotFoundException, LaunchException, ExecutorException {
SmartExecutorScheduler smartExecutorScheduler = SmartExecutorInitalizator.getSmartExecutorScheduler(); SmartExecutorScheduler smartExecutorScheduler = SmartExecutorScheduler.getInstance();
UUID uuid = smartExecutorScheduler.schedule(parameter); UUID uuid = smartExecutorScheduler.schedule(parameter);
logger.debug(String.format("The Plugin named %s with UUID %s has been launched with the provided inputs", parameter.getPluginName(), uuid)); logger.debug(String.format("The Plugin named %s with UUID %s has been launched with the provided inputs", parameter.getPluginName(), uuid));
@ -53,7 +53,7 @@ public class SmartExecutorImpl implements SmartExecutor {
public boolean unSchedule(String executionIdentifier) { public boolean unSchedule(String executionIdentifier) {
boolean currentStopped = true; boolean currentStopped = true;
try { try {
SmartExecutorScheduler smartExecutorScheduler = SmartExecutorInitalizator.getSmartExecutorScheduler(); SmartExecutorScheduler smartExecutorScheduler = SmartExecutorScheduler.getInstance();
UUID uuid = UUID.fromString(executionIdentifier); UUID uuid = UUID.fromString(executionIdentifier);
smartExecutorScheduler.stop(uuid); smartExecutorScheduler.stop(uuid);
} catch (SchedulerNotFoundException snfe) { } catch (SchedulerNotFoundException snfe) {

View File

@ -34,7 +34,6 @@ import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.context.application.ApplicationContext; import org.gcube.smartgears.context.application.ApplicationContext;
import org.gcube.smartgears.handlers.application.ApplicationLifecycleEvent; import org.gcube.smartgears.handlers.application.ApplicationLifecycleEvent;
import org.gcube.smartgears.handlers.application.ApplicationLifecycleHandler; import org.gcube.smartgears.handlers.application.ApplicationLifecycleHandler;
import org.gcube.vremanagement.executor.configuration.ScheduledTaskConfiguration;
import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector; import org.gcube.vremanagement.executor.persistence.SmartExecutorPersistenceConnector;
import org.gcube.vremanagement.executor.plugin.PluginDeclaration; import org.gcube.vremanagement.executor.plugin.PluginDeclaration;
import org.gcube.vremanagement.executor.pluginmanager.PluginManager; import org.gcube.vremanagement.executor.pluginmanager.PluginManager;
@ -66,21 +65,6 @@ public class SmartExecutorInitalizator extends ApplicationLifecycleHandler {
*/ */
protected static ApplicationContext ctx; protected static ApplicationContext ctx;
/**
* the Smart executor Scheduler used for task execution
*/
protected static SmartExecutorScheduler smartExecutorScheduler;
protected static ScheduledTaskConfiguration launchConfiguration;
/**
* @return the configuredTasks
*/
public static ScheduledTaskConfiguration getConfiguredTasks() {
return launchConfiguration;
}
/** /**
* @return the ctx * @return the ctx
*/ */
@ -88,12 +72,16 @@ public class SmartExecutorInitalizator extends ApplicationLifecycleHandler {
return ctx; return ctx;
} }
/*
protected static ScheduledTaskConfiguration launchConfiguration;
/** /**
* @return the smartExecutorScheduler * @return the configuredTasks
*/ * /
public static SmartExecutorScheduler getSmartExecutorScheduler() { public static ScheduledTaskConfiguration getConfiguredTasks() {
return smartExecutorScheduler; return launchConfiguration;
} }
*/
/** /**
* Publish the provided resource on all Service Scopes retrieved from * Publish the provided resource on all Service Scopes retrieved from
@ -287,8 +275,6 @@ public class SmartExecutorInitalizator extends ApplicationLifecycleHandler {
serviceEndpoint = createServiceEndpoint(); serviceEndpoint = createServiceEndpoint();
smartExecutorScheduler = SmartExecutorScheduler.getInstance();
// Checking if there are old unpublished ServiceEndpoints related to // Checking if there are old unpublished ServiceEndpoints related to
// this vHN and trying to unpublish them // this vHN and trying to unpublish them
List<String> scopes = getScopes(ctx); List<String> scopes = getScopes(ctx);
@ -368,7 +354,7 @@ public class SmartExecutorInitalizator extends ApplicationLifecycleHandler {
+ "Smart Executor is Stopping\n" + "Smart Executor is Stopping\n"
+ "-------------------------------------------------------"); + "-------------------------------------------------------");
smartExecutorScheduler.stopAll(); SmartExecutorScheduler.getInstance().stopAll();
try { try {
List<String> scopes = getScopes(ctx); List<String> scopes = getScopes(ctx);