Class SmartExecutorTask

java.lang.Object
org.gcube.vremanagement.executor.scheduler.SmartExecutorTask
All Implemented Interfaces:
org.quartz.InterruptableJob, org.quartz.Job

public class SmartExecutorTask extends Object implements org.quartz.InterruptableJob
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • UUID

      public static final String UUID
      See Also:
    • LAUNCH_PARAMETER

      public static final String LAUNCH_PARAMETER
      See Also:
    • OWNER_ID

      public static final String OWNER_ID
      See Also:
    • CONTEXT

      public static final String CONTEXT
      See Also:
    • executionsCount

      protected static Map<UUID,Integer> executionsCount
    • executionsState

      protected static Map<UUID,Map<Integer,org.gcube.vremanagement.executor.plugin.PluginState>> executionsState
    • pluginStateNotifications

      protected List<org.gcube.vremanagement.executor.plugin.PluginStateNotification> pluginStateNotifications
    • initialized

      protected boolean initialized
    • uuid

      protected UUID uuid
    • launchParameter

      protected org.gcube.vremanagement.executor.api.types.LaunchParameter launchParameter
    • ownerId

      protected String ownerId
    • context

      protected String context
      The Context the task runs in.
    • executionCount

      protected int executionCount
    • pluginName

      protected String pluginName
    • plugin

      protected org.gcube.vremanagement.executor.plugin.Plugin plugin
    • inputs

      protected Map<String,Object> inputs
    • runnablePlugin

      protected RunnablePlugin<org.gcube.vremanagement.executor.plugin.Plugin> runnablePlugin
    • mustPreviousExecutionsCompleted

      protected boolean mustPreviousExecutionsCompleted
    • maxExecutionNumber

      protected int maxExecutionNumber
    • interrupted

      protected Boolean interrupted
  • Constructor Details

  • Method Details

    • getExecutionsCount

      public static Map<UUID,Integer> getExecutionsCount()
      Returns:
      the executionsCount
    • forget

      public static void forget(UUID uuid)
      Forgets the executions of a task that is no longer scheduled.
      Parameters:
      uuid - the UUID of the task
    • init

      protected void init(org.quartz.JobDataMap jobDataMap) throws org.quartz.JobExecutionException
      Throws:
      org.quartz.JobExecutionException
    • newPluginStateNotification

      protected static org.gcube.vremanagement.executor.plugin.PluginStateNotification newPluginStateNotification(String className, Map<String,String> inputs) throws Exception
      Builds a notification requested by a task. The name comes from the request: the class is loaded without being initialised, and it must be a PluginStateNotification before any of its code runs.
      Parameters:
      className - the name of the class
      inputs - the inputs given to its constructor
      Returns:
      the notification
      Throws:
      Exception - if the class does not exist, is not a PluginStateNotification or has no constructor taking the inputs
    • getUUID

      public UUID getUUID()
      Returns:
      the uuid
    • getLaunchParameter

      public org.gcube.vremanagement.executor.api.types.LaunchParameter getLaunchParameter()
      Returns:
      the parameter
    • execute

      public void execute(org.quartz.JobExecutionContext context) throws org.quartz.JobExecutionException
      Specified by:
      execute in interface org.quartz.Job
      Throws:
      org.quartz.JobExecutionException
    • finished

      protected void finished(org.quartz.JobExecutionContext context)
    • interrupt

      public void interrupt() throws org.quartz.UnableToInterruptJobException
      Specified by:
      interrupt in interface org.quartz.InterruptableJob
      Throws:
      org.quartz.UnableToInterruptJobException
    • isMaxExecutionNumberReached

      protected boolean isMaxExecutionNumberReached()
    • unschedule

      protected void unschedule(boolean globally) throws Exception
      Throws:
      Exception
    • toString

      public String toString()
      Overrides:
      toString in class Object