热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.atlassian.scheduler.config.JobConfig类的使用及代码示例

本文整理了Java中com.atlassian.scheduler.config.JobConfig类的一些代码示例,展示了JobConfig

本文整理了Java中com.atlassian.scheduler.config.JobConfig类的一些代码示例,展示了JobConfig类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JobConfig类的具体详情如下:
包路径:com.atlassian.scheduler.config.JobConfig
类名称:JobConfig

JobConfig介绍

[英]Configuration options available when scheduling a job to be run. This is similar to JobDetails, but provides only the information that is relevant to configuring the job or for the job to reference when it is actually running.
[中]安排要运行的作业时可用的配置选项。这与JobDetails类似,但仅提供与配置作业相关的信息,或作业实际运行时要引用的信息。

代码示例

代码示例来源:origin: com.atlassian.support/stp

private void scheduleLogScanJob(Schedule schedule)
{
try
{
schedulerService.scheduleJob(JOB_ID, JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
.withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)
.withSchedule(schedule));
}
catch (SchedulerServiceException e)
{
log.error("Failed to schedule log scan job", e);
}
}
}

代码示例来源:origin: com.atlassian.support/stp

@Nonnull
@Override
public Map getParameters()
{
return config.getParameters();
}

代码示例来源:origin: com.atlassian.support/stp

@Nonnull
@Override
public RunMode getRunMode()
{
return config.getRunMode();
}

代码示例来源:origin: com.atlassian.jira/jira-core

private static JobConfig getJobConfig(final Long subscriptionId, final Schedule schedule)
{
return JobConfig.forJobRunnerKey(JobRunnerKey.of(JOB_RUNNER_KEY))
.withSchedule(schedule)
.withParameters(ImmutableMap.of(SUBSCRIPTION_IDENTIFIER, subscriptionId));
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void triggerPoll(final long directoryID, final SynchronisationMode synchronisationMode)
{
JobConfig cOnfig= JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
.withRunMode(RUN_ONCE_PER_CLUSTER)
.withSchedule(Schedule.runOnce(null))
.withParameters(ImmutableMap.of("DIRECTORY_ID", directoryID));
try
{
schedulerService.scheduleJobWithGeneratedId(config);
}
catch (SchedulerServiceException e)
{
throw new RuntimeException(e);
}
}

代码示例来源:origin: com.atlassian.applinks/applinks-plugin

@Override
public void onStart() {
scheduler.registerJobRunner(JOB_RUNNER_KEY, this);
try {
scheduler.scheduleJob(JOB_ID, JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
.withSchedule(getSchedule()));
} catch (final SchedulerServiceException e) {
log.error("Unable to schedule analytics job", e);
}
}

代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1

public Trigger buildTrigger(final JobId jobId, final JobConfig jobConfig)
throws SchedulerServiceException {
final byte[] parameters = parameterMapSerializer.serializeParameters(jobConfig.getParameters());
final Trigger trigger = buildTrigger(jobConfig.getSchedule());
trigger.setGroup(QUARTZ_TRIGGER_GROUP);
trigger.setName(jobId.toString());
trigger.getJobDataMap().put(QUARTZ_PARAMETERS_KEY, parameters);
return trigger;
}

代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-quartz1

@Override
public void scheduleJob(final JobId jobId, final JobConfig jobConfig)
throws SchedulerServiceException {
try {
requireNonNull(jobConfig, "jobConfig");
LOG.debug("scheduleJob: {}: {}", jobId, jobConfig);
localJobs.unscheduleJob(jobId);
clusteredJobs.unscheduleJob(jobId);
final Quartz1SchedulerFacade facade = getFacade(jobConfig.getRunMode());
final JobRunnerKey jobRunnerKey = jobConfig.getJobRunnerKey();
final Trigger trigger = triggerFactory.buildTrigger(jobId, jobConfig);
facade.scheduleJob(jobRunnerKey, trigger);
} catch (SchedulerRuntimeException sre) {
throw checked(sre);
}
}

代码示例来源:origin: com.atlassian.scheduler/atlassian-scheduler-core

@Nullable
private JobRunnerResponse validateJobConfig() {
try {
jobCOnfig= JobConfig.forJobRunnerKey(jobDetails.getJobRunnerKey())
.withRunMode(jobDetails.getRunMode())
.withSchedule(jobDetails.getSchedule())
.withParameters(jobDetails.getParameters());
return null;
} catch (SchedulerRuntimeException sre) {
return aborted(jobDetails.toString());
}
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
@Nonnull
public Status scheduleDelayedUpgrades(final int delayMins, final boolean isAllowReindex)
{
final Schedule schedule = Schedule.runOnce(DateTime.now().plusMinutes(delayMins).toDate());
JobConfig jobCOnfig= JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
.withSchedule(schedule)
.withParameters(ImmutableMap.of(REINDEX_ALLOWED_PROPERTY, isAllowReindex));
try
{
schedulerService.scheduleJob(JOB_ID, jobConfig);
}
catch (SchedulerServiceException e)
{
log.error(
"Unable to schedule upgrade tasks for future execution :" + e, e);
final Collection errors = ImmutableList.of(
"Unable to schedule upgrade tasks for future execution: " + e.getMessage() + '\n' + ExceptionUtils.getStackTrace(e));
return new Status(errors);
}
return Status.OK;
}

代码示例来源:origin: com.atlassian.jira/jira-core

/**
* Request a full replication of files in the home directories that are configured for replication.
*/
public void replicateJiraHome() throws SchedulerServiceException
{
JobConfig jobCOnfig= JobConfig.forJobRunnerKey(FULL_REPLICATION_KEY)
.withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)
.withSchedule(Schedule.runOnce(null));
schedulerService.scheduleJob(FULL_REPLICATION_ID, jobConfig);
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void runNow(final long serviceId) throws Exception
{
JiraServiceContainer jiraServiceCOntainer= getServiceWithId(serviceId);
if (jiraServiceCOntainer== null)
{
throw new ServiceException("Service with id '" + serviceId + "' was not found");
}
JobConfig cOnfig= JobConfig.forJobRunnerKey(SERVICE_JOB_KEY)
.withSchedule(Schedule.runOnce(null))
.withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)
.withParameters(ImmutableMap.of(SERVICE_ID_KEY, serviceId));
JobId jobId = schedulerService.scheduleJobWithGeneratedId(config);
LOG.debug("JIRA Service '" + jiraServiceContainer.getName() + "' scheduled for immediate execution with job id '" + jobId + '\'');
}

代码示例来源:origin: com.atlassian.jira/jira-core

private boolean isReindexAllowed(final JobRunnerRequest jobRunnerRequest)
{
Boolean isReindexAllowed = (Boolean) jobRunnerRequest.getJobConfig().getParameters().get(REINDEX_ALLOWED_PROPERTY);
// If no parameter is found we assume reindex is allowed.
return isReindexAllowed == null ? true : isReindexAllowed;
}

代码示例来源:origin: com.atlassian.refapp/atlassian-refapp-scheduler-demo-plugin

private StreamsEntryRequest createStreamsEntryRequest(JobRunnerRequest request) {
final DateTime startTime = new DateTime(request.getStartTime());
final SimpleDateFormat dateFormatter = new SimpleDateFormat(DATE_PATTERN);
return new StreamsEntryRequest()
.id(startTime.hashCode())
.title("triggered as per " + request.getJobConfig().getRunMode() + " job, at " + dateFormatter.format(request.getStartTime()))
.postedDate(startTime.plusMinutes(2))
.type(ActivityObjectTypes.article())
.verb(ActivityVerbs.post())
.user("Scheduler");
}
}

代码示例来源:origin: com.atlassian.bitbucket.server.plugin/source-annotation-support

@Override
public void afterPropertiesSet() throws Exception {
schedulerService.registerJobRunner(CLEANUP_JOB_RUNNER_KEY, newCleanupTask());
// schedule the cleanup job once a day starting in a day
schedulerService.scheduleJob(CLEANUP_JOB_ID, JobConfig.forJobRunnerKey(CLEANUP_JOB_RUNNER_KEY)
.withSchedule(Schedule.forInterval(TimeUnit.DAYS.toMillis(1), DateTime.now().plusDays(1).toDate()))
.withRunMode(RunMode.RUN_LOCALLY)); // cache dir is local to every application node
}

代码示例来源:origin: com.atlassian.jira/jira-core

private void scheduleCronJob(final JiraServiceContainer jiraServiceContainer) throws SchedulerServiceException
{
final boolean localService = jiraServiceContainer.isLocalService();
JobConfig cOnfig= JobConfig.forJobRunnerKey(SERVICE_JOB_KEY)
.withSchedule(Schedule.forCronExpression(jiraServiceContainer.getCronExpression()))
.withRunMode(localService ? RunMode.RUN_LOCALLY : RunMode.RUN_ONCE_PER_CLUSTER)
.withParameters(ImmutableMap.of(SERVICE_ID_KEY, jiraServiceContainer.getId()));
schedulerService.scheduleJob(toJobId(jiraServiceContainer.getId()), config);
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Nullable
@Override
public JobRunnerResponse runJob(final JobRunnerRequest jobRunnerRequest)
{
// Get the job class to actually run
final Map parameters = jobRunnerRequest.getJobConfig().getParameters();
final Long serviceId = (Long) parameters.get(ServiceManager.SERVICE_ID_KEY);
if (serviceId == null)
{
return JobRunnerResponse.failed("Service entry with job ID '" + jobRunnerRequest.getJobId() + "' has no job config parameters");
}
return runServiceId(serviceId);
}

代码示例来源:origin: com.atlassian.jira/jira-core

private void queueDelayedEvent(final JiraHomeChangeEvent event)
{
delayedFileReplicationQueue.add(event);
JobConfig jobCOnfig= JobConfig.forJobRunnerKey(DELAYED_REPLICATION_KEY)
.withRunMode(RunMode.RUN_LOCALLY)
.withSchedule(Schedule.runOnce(DateTime.now().plusSeconds(IDLE_SECONDS).toDate()));
try
{
schedulerService.scheduleJob(DELAYED_REPLICATION_ID, jobConfig);
}
catch (SchedulerServiceException e)
{
log.error("Failed to schedule delayed replication", e);
}
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public void addPoller(final DirectoryPoller poller) throws DirectoryMonitorRegistrationException
{
final Date OneMinuteFromNow= new DateTime().plusMinutes(1).toDate();
final JobConfig cOnfig= JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
.withRunMode(RUN_ONCE_PER_CLUSTER)
.withSchedule(Schedule.forInterval(poller.getPollingInterval() * 1000, oneMinuteFromNow))
.withParameters(ImmutableMap.of(DIRECTORY_ID, poller.getDirectoryID()));
try
{
schedulerService.scheduleJob(getJobId(poller), config);
}
catch (SchedulerServiceException e)
{
throw new DirectoryMonitorRegistrationException(e);
}
}

代码示例来源:origin: com.atlassian.plugin.automation/jira-automation-spi

@SuppressWarnings("unchecked")
@Nullable
@Override
public JobRunnerResponse runJob(final JobRunnerRequest request)
{
final Map params = request.getJobConfig().getParameters();
try
{
final Class jobClass = (Class) classLoader.loadClass((String) params.get(JOB_CLASS_CANONICAL_NAME));
jobClass.newInstance().execute(jobDataMap);
return JobRunnerResponse.success();
}
catch (Exception e)
{
log.error(String.format("Unable to execute the job [id:%s]", request.getJobId().toString()), e);
return JobRunnerResponse.failed(e);
}
}
}

推荐阅读
  • 深入解析 Android IPC 中的 Messenger 机制
    本文详细介绍了 Android 中基于消息传递的进程间通信(IPC)机制——Messenger。通过实例和源码分析,帮助开发者更好地理解和使用这一高效的通信工具。 ... [详细]
  • 深入解析Spring启动过程
    本文详细介绍了Spring框架的启动流程,帮助开发者理解其内部机制。通过具体示例和代码片段,解释了Bean定义、工厂类、读取器以及条件评估等关键概念,使读者能够更全面地掌握Spring的初始化过程。 ... [详细]
  • 并发编程 12—— 任务取消与关闭 之 shutdownNow 的局限性
    Java并发编程实践目录并发编程01——ThreadLocal并发编程02——ConcurrentHashMap并发编程03——阻塞队列和生产者-消费者模式并发编程04——闭锁Co ... [详细]
  • 在编译BSP包过程中,遇到了一个与 'gets' 函数相关的编译错误。该问题通常发生在较新的编译环境中,由于 'gets' 函数已被弃用并视为安全漏洞。本文将详细介绍如何通过修改源代码和配置文件来解决这一问题。 ... [详细]
  • ListView简单使用
    先上效果:主要实现了Listview的绑定和点击事件。项目资源结构如下:先创建一个动物类,用来装载数据:Animal类如下:packagecom.example.simplelis ... [详细]
  • 本文探讨了如何通过一系列技术手段提升Spring Boot项目的并发处理能力,解决生产环境中因慢请求导致的系统性能下降问题。 ... [详细]
  • 深入解析SpringMVC核心组件:DispatcherServlet的工作原理
    本文详细探讨了SpringMVC的核心组件——DispatcherServlet的运作机制,旨在帮助有一定Java和Spring基础的开发人员理解HTTP请求是如何被映射到Controller并执行的。文章将解答以下问题:1. HTTP请求如何映射到Controller;2. Controller是如何被执行的。 ... [详细]
  • ssm框架整合及工程分层1.先创建一个新的project1.1配置pom.xml ... [详细]
  • 探讨ChatGPT在法律和版权方面的潜在风险及影响,分析其作为内容创造工具的合法性和合规性。 ... [详细]
  • 本文详细探讨了Java中的ClassLoader类加载器的工作原理,包括其如何将class文件加载至JVM中,以及JVM启动时的动态加载策略。文章还介绍了JVM内置的三种类加载器及其工作方式,并解释了类加载器的继承关系和双亲委托机制。 ... [详细]
  • 本文详细介绍了虚拟专用网(Virtual Private Network, VPN)的概念及其通过公共网络(如互联网)构建临时且安全连接的技术特点。文章探讨了不同类型的隧道协议,包括第二层和第三层隧道协议,并提供了针对IPSec、GRE以及MPLS VPN的具体配置指导。 ... [详细]
  • CentOS 7.6环境下Prometheus与Grafana的集成部署指南
    本文旨在提供一套详细的步骤,指导读者如何在CentOS 7.6操作系统上成功安装和配置Prometheus 2.17.1及Grafana 6.7.2-1,实现高效的数据监控与可视化。 ... [详细]
  • springMVC JRS303验证 ... [详细]
  • 深入解析Java多线程与并发库的应用:空中网实习生面试题详解
    本文详细探讨了Java多线程与并发库的高级应用,结合空中网在挑选实习生时的面试题目,深入分析了相关技术要点和实现细节。文章通过具体的代码示例展示了如何使用Semaphore和SynchronousQueue来管理线程同步和任务调度。 ... [详细]
  • 本文探讨了在iOS平台上开发BLE(蓝牙低功耗)应用程序时遇到的挑战,特别是如何实现应用在后台模式下仍能持续扫描并连接蓝牙设备。文章提供了具体的配置方法和常见的问题解决方案。 ... [详细]
author-avatar
好好_haohao_100
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有