public class DefaultServiceManager extends Object implements ServiceManager, Startable
ServiceManager.ServiceScheduleSkipperSERVICE_ID_KEY| Constructor and Description |
|---|
DefaultServiceManager(ServiceConfigStore serviceConfigStore,
ComponentClassManager componentClassManager,
PermissionManager permissionManager,
InBuiltServiceTypes inBuiltServiceTypes,
com.atlassian.scheduler.SchedulerService schedulerService,
com.atlassian.cache.CacheManager cacheManager,
com.atlassian.beehive.ClusterLockService clusterLockService,
ClusterMessagingService messagingService) |
| Modifier and Type | Method and Description |
|---|---|
JiraServiceContainer |
addService(String name,
Class<? extends JiraService> serviceClass,
long delay)
This will add a service configuration to the JIRA DB and the service to the list of services which are running.
|
JiraServiceContainer |
addService(String name,
Class<? extends JiraService> serviceClass,
long delay,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
JiraServiceContainer |
addService(String name,
Class<? extends JiraService> serviceClass,
String cronExpression)
This will add a service configuration to the JIRA DB and the service to the list of services which are running.
|
JiraServiceContainer |
addService(String name,
Class<? extends JiraService> serviceClass,
String cronExpression,
long delay,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
JiraServiceContainer |
addService(String name,
Class<? extends JiraService> serviceClass,
String cronExpression,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
JiraServiceContainer |
addService(String name,
String serviceClassName,
long delay)
This will add a service configuration to the JIRA DB and the service to the list of services which are running.
|
JiraServiceContainer |
addService(String name,
String serviceClassName,
long delay,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
JiraServiceContainer |
addService(String name,
String serviceClassName,
String cronExpression)
This will add a service configuration to the JIRA DB and the service to the list of services which are running.
|
JiraServiceContainer |
addService(String name,
String serviceClassName,
String cronExpression,
long delay,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
JiraServiceContainer |
addService(String name,
String serviceClassName,
String cronExpression,
Map<String,String[]> params)
This will add a service configuration to the JIRA DB and the service to the list of services which are running with
an optional list of params.
|
boolean |
containsServiceWithId(Long id)
Quick way of telling whether a service with a specific id is registered or not.
|
void |
editService(Long id,
long delay,
Map<String,String[]> params)
This will update the service if a service with this id can be found.
|
void |
editService(Long id,
String cronExpression,
Map<String,String[]> params)
This will update the service if a service with this id can be found.
|
void |
editServiceByName(String name,
long delay,
Map<String,String[]> params)
This will update the service if a service by this name can be found.
|
void |
editServiceByName(String name,
String cronExpression,
Map<String,String[]> params)
This will update the service if a service by this name can be found.
|
ServiceManager.ServiceScheduleSkipper |
getScheduleSkipper()
Returns service schedule skipper
|
Collection<JiraServiceContainer> |
getServices()
This gets all currently registered services with JIRA.
|
Iterable<JiraServiceContainer> |
getServicesForExecution(long time)
Gets the services that are ready for execution at a particular time.
|
Iterable<JiraServiceContainer> |
getServicesManageableBy(ApplicationUser user)
Gets the services that can be managed by an specific user.
|
JiraServiceContainer |
getServiceWithId(Long id)
This will return a JiraServiceContainer for the provided id if one is registered otherwise it will return null.
|
JiraServiceContainer |
getServiceWithName(String name)
This will return a JiraServiceContainer for the provided name if one is registered, otherwise this will return
null.
|
void |
onClearCache(ClearCacheEvent event) |
void |
refreshAll()
This will force a complete re-sync of the service cache with the values stored in the db.
|
void |
refreshService(Long id)
This will update the in-memory cache with the values from the db for the service with the id if it can be resolved.
|
void |
refreshServiceByName(String name)
This will update the in-memory cache with the values from the db for the named service if it can be resolved.
|
void |
removeService(Long id)
This will remove a service from the db and cache and it will try to resolve the service by id.
|
void |
removeServiceByName(String name)
This will remove a service from the db and cache and it will try to resolve the service by name.
|
void |
runNow(long serviceId)
Runs the service immediately.
|
void |
start()
This method will be called after the plugin system is fully initialised and all components added to the
dependency injection framework.
|
public DefaultServiceManager(ServiceConfigStore serviceConfigStore, ComponentClassManager componentClassManager, PermissionManager permissionManager, InBuiltServiceTypes inBuiltServiceTypes, com.atlassian.scheduler.SchedulerService schedulerService, com.atlassian.cache.CacheManager cacheManager, com.atlassian.beehive.ClusterLockService clusterLockService, ClusterMessagingService messagingService)
public void start()
Startable@EventListener public void onClearCache(ClearCacheEvent event)
public Collection<JiraServiceContainer> getServices()
ServiceManagergetServices in interface ServiceManagerpublic Iterable<JiraServiceContainer> getServicesManageableBy(ApplicationUser user)
ServiceManagergetServicesManageableBy in interface ServiceManageruser - The user in play.public void runNow(long serviceId)
throws Exception
ServiceManagerrunNow in interface ServiceManagerExceptionpublic Iterable<JiraServiceContainer> getServicesForExecution(long time)
ServiceManagergetServicesForExecution in interface ServiceManagertime - the time to check for due services.public boolean containsServiceWithId(Long id)
ServiceManagercontainsServiceWithId in interface ServiceManagerid - service idpublic void refreshAll()
ServiceManagerrefreshAll in interface ServiceManagerpublic JiraServiceContainer getServiceWithId(Long id)
ServiceManagergetServiceWithId in interface ServiceManagerid - service id@Nullable public JiraServiceContainer getServiceWithName(String name)
ServiceManagergetServiceWithName in interface ServiceManagername - the name of the JiraServiceContainerpublic JiraServiceContainer addService(String name, String serviceClassName, long delay) throws ServiceException, ClassNotFoundException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClassName - the class defining the servicedelay - how often the service should run in millisecondsServiceException - If there is an error creating the Service.ClassNotFoundException - If the className could not be resolved.ServiceManager.addService(String, Class, long),
ServiceManager.addService(String, String, long, java.util.Map)public JiraServiceContainer addService(String name, String serviceClassName, long delay, Map<String,String[]> params) throws ServiceException, ClassNotFoundException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClassName - the class defining the servicedelay - how often the service should run in millisecondsparams - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ClassNotFoundException - If the className could not be resolved.ServiceManager.addService(String, Class, long, java.util.Map),
ServiceManager.addService(String, String, long)public JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, long delay) throws ServiceException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClass - the class defining the servicedelay - how often the service should run in millisecondsServiceException - If there is an error creating the Service.ServiceManager.addService(String, String, long),
ServiceManager.addService(String, Class, long, java.util.Map)public JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, long delay, Map<String,String[]> params) throws ServiceException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClass - the class defining the servicedelay - how often the service should run in millisecondsparams - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ServiceManager.addService(String, String, long, java.util.Map),
ServiceManager.addService(String, Class, long)public JiraServiceContainer addService(String name, String serviceClassName, String cronExpression) throws ServiceException, ClassNotFoundException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClassName - the class defining the servicecronExpression - how the service should be scheduledServiceException - If there is an error creating the Service.ClassNotFoundException - If the className could not be resolved.ServiceManager.addService(String, Class, String),
ServiceManager.addService(String, String, String, java.util.Map)public JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression) throws ServiceException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClass - the class defining the servicecronExpression - how the service should be scheduledServiceException - If there is an error creating the Service.ServiceManager.addService(String, String, String),
ServiceManager.addService(String, Class, String, java.util.Map)public JiraServiceContainer addService(String name, String serviceClassName, String cronExpression, Map<String,String[]> params) throws ServiceException, ClassNotFoundException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClassName - the class defining the servicecronExpression - how the service should be scheduledparams - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ClassNotFoundException - If the className could not be resolved.ServiceManager.addService(String, Class, String, java.util.Map),
ServiceManager.addService(String, String, String)public JiraServiceContainer addService(String name, String serviceClassName, String cronExpression, long delay, Map<String,String[]> params) throws ServiceException, ClassNotFoundException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClassName - the class defining the servicecronExpression - how the service should be scheduleddelay - How often the service should run in milliseconds. This is not used, but the value will be retained and
will be used in place of the cron expression if the instance is downgraded to a JIRA version prior to 6.4.params - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ClassNotFoundException - If the className could not be resolved.ServiceManager.addService(String, Class, String, java.util.Map),
ServiceManager.addService(String, String, String)public JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression, @Nullable Map<String,String[]> params) throws ServiceException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClass - the class defining the servicecronExpression - how the service should be scheduledparams - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ServiceManager.addService(String, String, String, java.util.Map),
ServiceManager.addService(String, Class, String)public JiraServiceContainer addService(String name, Class<? extends JiraService> serviceClass, String cronExpression, long delay, @Nullable Map<String,String[]> params) throws ServiceException
ServiceManagerIt is preferred to pass the actual Class rather than the class name when adding services to JIRA from plugins, because it avoids possible ClassLoader issues. See http://jira.atlassian.com/browse/JRA-18578.
addService in interface ServiceManagername - the key this service is to be known byserviceClass - the class defining the servicecronExpression - how the service should be scheduleddelay - How often the service should run in milliseconds. This is not used, but the value will be retained and
will be used in place of the cron expression if the instance is downgraded to a JIRA version prior to 6.4.params - Additional params to specify for the serviceServiceException - If there is an error creating the Service.ServiceManager.addService(String, String, String, java.util.Map),
ServiceManager.addService(String, Class, String)public void editServiceByName(String name, long delay, Map<String,String[]> params) throws Exception
ServiceManagereditServiceByName in interface ServiceManagername - the name of the service to find.delay - the delay to set on the service in millisecondsparams - the params to set on the serviceIllegalArgumentException - if the name can not be resolvedExceptionpublic void editService(Long id, long delay, Map<String,String[]> params) throws Exception
ServiceManagereditService in interface ServiceManagerid - the id of the service to find.delay - the delay to set on the service in millisecondsparams - the params to set on the serviceException - if there is a problem updating the valuepublic void editServiceByName(String name, String cronExpression, Map<String,String[]> params) throws Exception
ServiceManagereditServiceByName in interface ServiceManagername - the name of the service to find.cronExpression - how the service should be scheduledparams - the params to set on the serviceIllegalArgumentException - if the name can not be resolvedExceptionpublic void editService(Long id, String cronExpression, Map<String,String[]> params) throws Exception
ServiceManagereditService in interface ServiceManagerid - the id of the service to find.cronExpression - how the service should be scheduledparams - the params to set on the serviceException - if there is a problem updating the valuepublic void removeServiceByName(String name) throws Exception
ServiceManagerremoveServiceByName in interface ServiceManagername - the name of the service to find.IllegalArgumentException - if the name can not be resolvedExceptionpublic void removeService(Long id) throws Exception
ServiceManagerremoveService in interface ServiceManagerid - the id of the service to find.Exception - if there is a problem removing the servicepublic void refreshService(Long id) throws Exception
ServiceManagerrefreshService in interface ServiceManagerid - the id of the service to find.Exception - if the value can not be refreshedpublic void refreshServiceByName(String name) throws Exception
ServiceManagerrefreshServiceByName in interface ServiceManagername - the name of the service to find.IllegalArgumentException - if the name can not be resolvedExceptionpublic ServiceManager.ServiceScheduleSkipper getScheduleSkipper()
getScheduleSkipper in interface ServiceManagerCopyright © 2002-2019 Atlassian. All Rights Reserved.