Class JobConfigModuleDescriptor

  • All Implemented Interfaces:
    com.atlassian.plugin.ModuleDescriptor<Void>, com.atlassian.plugin.Resourced, com.atlassian.plugin.ScopeAware, com.atlassian.plugin.StateAware

    @ParametersAreNonnullByDefault
    public class JobConfigModuleDescriptor
    extends com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>
    Defines an atlassian-scheduler JobConfig within a plugin.

    In atlassian-plugin.xml:

     
     <job-config name="My job" key="myJobId">
         <job key="myJobRunner" perClusterJob="true" clusteredOnly="true"/>
         <schedule cron-expression="0 * * * * ?" jitterSecs="10"/>
         <managed editable="true" keepingHistory="true" canRunAdhoc="true" canDisable="true" disabledByDefault="true"/>
     </job-config>
     
     

    If using spring-scanner, ensure your job runner is defined as a spring bean with a @org.springframework.stereotype.Component or @javax.inject.Named annotation:

     {@code
    Since:
    5.10.3
    • Field Summary

      • Fields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor

        key, moduleClass, moduleClassName, moduleFactory, name, plugin, resources
    • Constructor Summary

      Constructors 
      Constructor Description
      JobConfigModuleDescriptor​(com.atlassian.plugin.module.ModuleFactory moduleFactory, ManagedScheduledJobRegistrationService jobRegistrationService, com.atlassian.sal.api.timezone.TimeZoneManager timeZoneManager, ClusterManager clusterManager, com.atlassian.scheduler.SchedulerService schedulerService, com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar, com.atlassian.sal.api.lifecycle.LifecycleManager lifecycleManager, org.osgi.framework.BundleContext bundleContext)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void disabled()  
      void enabled()
      Plugins with unmanaged jobs must wait till application is started before being scheduled.
      Void getModule()  
      void init​(com.atlassian.plugin.Plugin plugin, org.dom4j.Element element)  
      void listenApplicationStartedEvent()  
      void onApplicationStartedEvent​(com.atlassian.config.lifecycle.events.ApplicationStartedEvent event)
      Do not use TenantArrivedEvent because it's fired before the DB migration Jobs may depend on DB prepared by the DB migration, see PluginFrameworkContextListener
      • Methods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor

        assertModuleClassImplements, checkPermissions, destroy, equals, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getModuleClassName, getName, getParams, getPlugin, getPluginKey, getRequiredPermissions, getResourceDescriptor, getResourceDescriptors, getResourceLocation, getScopeKey, hashCode, isBroken, isEnabled, isEnabledByDefault, isSystemModule, loadClass, provideValidationRules, satisfiesMinJavaVersion, setBroken, setPlugin, toString
      • Methods inherited from interface com.atlassian.plugin.ModuleDescriptor

        getDisplayName
    • Constructor Detail

      • JobConfigModuleDescriptor

        @Autowired
        public JobConfigModuleDescriptor​(com.atlassian.plugin.module.ModuleFactory moduleFactory,
                                         ManagedScheduledJobRegistrationService jobRegistrationService,
                                         com.atlassian.sal.api.timezone.TimeZoneManager timeZoneManager,
                                         ClusterManager clusterManager,
                                         com.atlassian.scheduler.SchedulerService schedulerService,
                                         com.atlassian.event.api.EventListenerRegistrar eventListenerRegistrar,
                                         com.atlassian.sal.api.lifecycle.LifecycleManager lifecycleManager,
                                         org.osgi.framework.BundleContext bundleContext)
    • Method Detail

      • listenApplicationStartedEvent

        @PostConstruct
        public void listenApplicationStartedEvent()
      • getModule

        public Void getModule()
        Specified by:
        getModule in interface com.atlassian.plugin.ModuleDescriptor<Void>
        Specified by:
        getModule in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>
      • init

        public void init​(com.atlassian.plugin.Plugin plugin,
                         org.dom4j.Element element)
                  throws com.atlassian.plugin.PluginParseException
        Specified by:
        init in interface com.atlassian.plugin.ModuleDescriptor<Void>
        Overrides:
        init in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>
        Throws:
        com.atlassian.plugin.PluginParseException
      • onApplicationStartedEvent

        @EventListener
        public void onApplicationStartedEvent​(com.atlassian.config.lifecycle.events.ApplicationStartedEvent event)
        Do not use TenantArrivedEvent because it's fired before the DB migration Jobs may depend on DB prepared by the DB migration, see PluginFrameworkContextListener
      • enabled

        public void enabled()

        Plugins with unmanaged jobs must wait till application is started before being scheduled. See onApplicationStartedEvent(ApplicationStartedEvent)

        Additionally, managed jobs of plugins enabled at startup, must be registered immediately, otherwise the SchedulerService may malfunction, cause unknown.

        Specified by:
        enabled in interface com.atlassian.plugin.StateAware
        Overrides:
        enabled in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>
      • disabled

        public void disabled()
        Specified by:
        disabled in interface com.atlassian.plugin.StateAware
        Overrides:
        disabled in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<Void>