当前位置: 首页>>代码示例>>Java>>正文


Java JobDataMap.get方法代码示例

本文整理汇总了Java中org.quartz.JobDataMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java JobDataMap.get方法的具体用法?Java JobDataMap.get怎么用?Java JobDataMap.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.JobDataMap的用法示例。


在下文中一共展示了JobDataMap.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeJob

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void executeJob(JobExecutionContext context) throws JobExecutionException {
    JobDataMap jobData = context.getJobDetail().getJobDataMap();

    // Extract the Job executer to use
    Object executerObj = jobData.get("jobExecuter");
    if (executerObj == null || !(executerObj instanceof DeleteExpiredContentScheduledJobExecuter)) {
        throw new AlfrescoRuntimeException(
                "ScheduledJob data must contain valid 'Executer' reference");
    }

    final DeleteExpiredContentScheduledJobExecuter jobExecuter = (DeleteExpiredContentScheduledJobExecuter) executerObj;

    AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {
        public Object doWork() throws Exception {
            jobExecuter.execute();
            return null;
        }
    }, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Conexiam,项目名称:alfresco-expirable-content,代码行数:21,代码来源:DeleteExpiredContentScheduledJob.java

示例2: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    // extract the content Cleanup to use
    Object nodeCleanupWorkerObj = jobData.get("nodeCleanupWorker");
    if (nodeCleanupWorkerObj == null || !(nodeCleanupWorkerObj instanceof NodeCleanupWorker))
    {
        throw new AlfrescoRuntimeException(
                "NodeCleanupJob data must contain valid 'nodeCleanupWorker' reference");
    }
    NodeCleanupWorker nodeCleanupWorker = (NodeCleanupWorker) nodeCleanupWorkerObj;
    List<String> cleanupLog = nodeCleanupWorker.doClean();
    // Done
    if (logger.isDebugEnabled())
    {
        logger.debug("Node cleanup log:");
        for (String log : cleanupLog)
        {
            logger.debug(log);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:NodeCleanupJob.java

示例3: jobWasExecuted

import org.quartz.JobDataMap; //导入方法依赖的package包/类
public void jobWasExecuted(final JobExecutionContext context, JobExecutionException exp) {
	Timestamp end = new Timestamp(System.currentTimeMillis());
	final JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
	String targetObject = jobDataMap.getString("targetObject");
	String targetMethod = jobDataMap.getString("targetMethod");
	if (logger.isInfoEnabled()) {
		logger.info("定时任务执行结束:{}.{}", targetObject, targetMethod);
	}
	// 更新任务执行状态
	final TaskFireLog log = (TaskFireLog) jobDataMap.get(JOB_LOG);
	if (log != null) {
		log.setEndTime(end);
		if (exp != null) {
			logger.error("定时任务失败: [" + targetObject + "." + targetMethod + "]", exp);
			String contactEmail = jobDataMap.getString("contactEmail");
			if (StringUtils.isNotBlank(contactEmail)) {
				String topic = String.format("调度[%s.%s]发生异常", targetMethod, targetMethod);
				sendEmail(new Email(contactEmail, topic, exp.getMessage()));
			}
			log.setStatus(JOBSTATE.ERROR_STATS);
			log.setFireInfo(exp.getMessage());
		} else {
			if (log.getStatus().equals(JOBSTATE.INIT_STATS)) {
				log.setStatus(JOBSTATE.SUCCESS_STATS);
			}
		}
	}
	executorService.submit(new Runnable() {
		public void run() {
			if (log != null) {
				try {
					schedulerService.updateLog(log);
				} catch (Exception e) {
					logger.error("Update TaskRunLog cause error. The log object is : " + JSON.toJSONString(log), e);
				}
			}
		}
	});
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:40,代码来源:JobListener.java

示例4: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    UserUsageTrackingComponent usageComponent = (UserUsageTrackingComponent) jobData.get(KEY_COMPONENT);
    if (usageComponent == null)
    {
        throw new JobExecutionException("Missing job data: " + KEY_COMPONENT);
    }
    // perform the content usage calculations
    usageComponent.execute();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:UserUsageCollapseJob.java

示例5: jobWasExecuted

import org.quartz.JobDataMap; //导入方法依赖的package包/类
public void jobWasExecuted(final JobExecutionContext context, JobExecutionException exp) {
	Timestamp end = new Timestamp(System.currentTimeMillis());
	final JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
	String targetObject = jobDataMap.getString("targetObject");
	String targetMethod = jobDataMap.getString("targetMethod");
	if (logger.isInfoEnabled()) {
		logger.info("定时任务执行结束:{}.{}", targetObject, targetMethod);
	}
	// 更新任务执行状态
	final TaskFireLog log = (TaskFireLog) jobDataMap.get(JOB_LOG);
	if (log != null) {
		log.setEndTime(end);
		if (exp != null) {
			String contactEmail = jobDataMap.getString("contactEmail");
			if (StringUtils.isNotBlank(contactEmail)) {
				String topic = String.format("调度[%s.%s]发生异常", targetMethod, targetMethod);
				sendEmail(new Email(contactEmail, topic, exp.getMessage()));
			}
			log.setStatus(JOBSTATE.ERROR_STATS);
			log.setFireInfo(exp.getMessage());
		} else {
			if (log.getStatus().equals(JOBSTATE.INIT_STATS)) {
				log.setStatus(JOBSTATE.SUCCESS_STATS);
			}
		}
	}
	executorService.submit(new Runnable() {
		public void run() {
			if (log != null) {
				try {
					schedulerService.updateLog(log);
				} catch (Exception e) {
					logger.error("Update TaskRunLog cause error. The log object is : " + JSON.toJSONString(log), e);
				}
			}
		}
	});
}
 
开发者ID:tb544731152,项目名称:iBase4J,代码行数:39,代码来源:JobListener.java

示例6: cachedContentCleaner

import org.quartz.JobDataMap; //导入方法依赖的package包/类
private CachedContentCleaner cachedContentCleaner(JobDataMap jobData)
{
    Object cleanerObj = jobData.get("cachedContentCleaner");
    if (cleanerObj == null || !(cleanerObj instanceof CachedContentCleaner))
    {
        throw new AlfrescoRuntimeException(
                    "CachedContentCleanupJob requires a valid 'cachedContentCleaner' reference");
    }
    CachedContentCleaner cleaner = (CachedContentCleaner) cleanerObj;
    return cleaner;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:CachedContentCleanupJob.java

示例7: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
    long timestamp = System.currentTimeMillis() / 1000;
    JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
    String pluginName = jobDataMap.getString("pluginName");
    try {
        DetectPlugin detectPlugin = (DetectPlugin) jobDataMap.get("pluginObject");
        MetricsCommon metricsValue = new DetectMetricsValue(detectPlugin,timestamp);
        //可能会涉及到外网的连接,采用异步方式
        ExecuteThreadUtil.execute(new JobThread(metricsValue,"detect job thread"));
    } catch (Exception e) {
        log.error("插件 {} 运行异常",pluginName,e);
    }
}
 
开发者ID:DevopsJK,项目名称:SuitAgent,代码行数:15,代码来源:DetectPluginJob.java

示例8: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    try {
        JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
        message = (Message)jobDataMap.get(JobConstants.JOB_PARAM_MESSAGE);
        MessageProcessor.processMessage(message);
    } catch( Exception e) {
        throw new JobExecutionException(e);
    }
}
 
开发者ID:sjsucohort6,项目名称:amigo-chatbot,代码行数:11,代码来源:ChatbotMessageProcessorJob.java

示例9: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    // extract the content Cleanup to use
    Object nodeStringLengthWorkerObj = jobData.get(JOB_DATA_NODE_WORKER);
    if (nodeStringLengthWorkerObj == null || !(nodeStringLengthWorkerObj instanceof NodeStringLengthWorker))
    {
        throw new AlfrescoRuntimeException(
                "MaxStringLengthJob data '" + JOB_DATA_NODE_WORKER + "' must reference a " + NodeStringLengthWorker.class.getSimpleName());
    }
    NodeStringLengthWorker worker = (NodeStringLengthWorker) nodeStringLengthWorkerObj;
    worker.execute();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:NodeStringLengthWorker.java

示例10: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
/**
 * Calls the cleaner to do its work
 */
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    // extract the content cleaner to use
    Object abstractAuthenticationServiceRef = jobData.get("abstractAuthenticationService");
    if (abstractAuthenticationServiceRef == null || !(abstractAuthenticationServiceRef instanceof AbstractAuthenticationService))
    {
        throw new AlfrescoRuntimeException(
                "ContentStoreCleanupJob data must contain valid 'contentStoreCleaner' reference");
    }
    AbstractAuthenticationService abstractAuthenticationService = (AbstractAuthenticationService) abstractAuthenticationServiceRef;
    abstractAuthenticationService.invalidateTickets(true);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:TicketCleanupJob.java

示例11: executeJob

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void executeJob(JobExecutionContext context) throws JobExecutionException {
	JobDataMap jobData = context.getJobDetail().getJobDataMap();

	// Extract the Job executer to use
	Object executerObj = jobData.get("jobExecuter");
	if (executerObj == null || !(executerObj instanceof MonitorJobService)) {
		throw new AlfrescoRuntimeException("Job data must contain valid 'Executer' reference");
	}

	Object executerCreateObj = jobData.get("jobCreateExecuter");
	if (executerCreateObj == null || !(executerCreateObj instanceof NodesHierarchyJob)) {
		throw new AlfrescoRuntimeException("SitesCountJob data must contain valid 'CreateExecuter' reference");
	}
	Object executerTransactHelper = jobData.get("jobTransactionHelper");
	if (executerTransactHelper == null || !(executerTransactHelper instanceof RetryingTransactionHelper)) {
		throw new AlfrescoRuntimeException(
				"jobTransactionHelper data must contain valid 'Transaction helper' reference");
	}
	final NodesHierarchyJob jobCreateExecuter = (NodesHierarchyJob) executerCreateObj;
	final MonitorJobService jobExecuter = (MonitorJobService) executerObj;
	final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper) executerTransactHelper;
	AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>() {

		public Object doWork() throws Exception {
			return transactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>() {
				@Override
				public NodeRef execute() throws Throwable {
					final NodeRef jobNode = jobCreateExecuter.createTriggerJob();
					jobExecuter.runMonitorOperation(jobNode);
					return null;
				}
			}, false, true);
		}
	}, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:37,代码来源:NodesHierarchyTriggerJob.java

示例12: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    // extract the object to use
    Object asyncPatchObj = jobData.get(JOB_NAME);
    if (asyncPatchObj == null || !(asyncPatchObj instanceof AsynchronousPatch))
    {
        throw new AlfrescoRuntimeException(JOB_NAME + " data must contain valid 'AsynchronousPatch' reference");
    }
    // Job Lock
    AsynchronousPatch patch = (AsynchronousPatch) asyncPatchObj;
    patch.executeAsynchronously();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:15,代码来源:AsynchronousPatch.java

示例13: sendEmail

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void sendEmail(JobDataMap map) {
	String subject 	   = map.getString("subject");
	String messageBody = map.getString("messageBody");
	List<String> to    = (List<String>) map.get("to");
	List<String> cc	   = (List<String>) map.get("cc");
	List<String> bcc   = (List<String>) map.get("bcc");
	
	MimeMessage message = mailSender.createMimeMessage();

	try {
		MimeMessageHelper helper = new MimeMessageHelper(message, false);
		for(String receipient : to) {
			helper.setFrom("[email protected]", "Julius from Dynamic Quartz");
			helper.setTo(receipient);
			helper.setSubject(subject);
			helper.setText(messageBody);
			if(!isEmpty(cc))
				helper.setCc(cc.stream().toArray(String[]::new));
			if(!isEmpty(bcc))
				helper.setBcc(bcc.stream().toArray(String[]::new));
			mailSender.send(message);
		}
	} catch (MessagingException | UnsupportedEncodingException e) {
		log.error("An error occurred: {}", e.getLocalizedMessage());
	}
}
 
开发者ID:juliuskrah,项目名称:quartz-manager,代码行数:28,代码来源:EmailJob.java

示例14: execute

import org.quartz.JobDataMap; //导入方法依赖的package包/类
/**
 * Calls the post cleaner to do its work
 */
public void execute(JobExecutionContext context) throws JobExecutionException
{
    JobDataMap jobData = context.getJobDetail().getJobDataMap();
    // extract the post cleaner to use
    Object postCleanerObj = jobData.get("postCleaner");
    if (postCleanerObj == null || !(postCleanerObj instanceof PostCleaner))
    {
        throw new AlfrescoRuntimeException(
                "FeedCleanupJob data must contain valid 'postCleaner' reference");
    }
    PostCleaner postCleaner = (PostCleaner)postCleanerObj;
    postCleaner.execute();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:PostCleanupJob.java

示例15: executeJob

import org.quartz.JobDataMap; //导入方法依赖的package包/类
@Override
public void executeJob(JobExecutionContext context) throws JobExecutionException {
	JobDataMap jobData = context.getJobDetail().getJobDataMap();

	// Extract the Job executer to use
	Object executerObj = jobData.get("jobExecuter");
	if (executerObj == null || !(executerObj instanceof MonitorJobService)) {
		throw new AlfrescoRuntimeException("SitesCountJob data must contain valid 'Executer' reference");
	}
	
	Object executerCreateObj = jobData.get("jobCreateExecuter");
	if (executerCreateObj == null || !(executerCreateObj instanceof SitesCountJob)) {
		throw new AlfrescoRuntimeException("SitesCountJob data must contain valid 'CreateExecuter' reference");
	}
	
	Object executerTransactHelper = jobData.get("jobTransactionHelper");
	if (executerTransactHelper == null || !(executerTransactHelper instanceof RetryingTransactionHelper)) {
		throw new AlfrescoRuntimeException("jobTransactionHelper data must contain valid 'Transaction helper' reference");
	}
	
	final SitesCountJob jobCreateExecuter = (SitesCountJob) executerCreateObj;
	final MonitorJobService jobExecuter = (MonitorJobService) executerObj;
	final RetryingTransactionHelper transactionHelper = (RetryingTransactionHelper)executerTransactHelper;
	
	AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<NodeRef>() {
		public NodeRef doWork() throws Exception {
			return transactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>() {
				@Override
				public NodeRef execute() throws Throwable {
					final NodeRef jobNode = jobCreateExecuter.createSitesCountJob();
					jobExecuter.runMonitorOperation(jobNode);
					return jobNode;
				}
			}, false, true);
		}
	}, AuthenticationUtil.getSystemUserName());
}
 
开发者ID:Vitezslav-Sliz,项目名称:tieto-alfresco-repository_monitor,代码行数:38,代码来源:SitesCountTriggerJob.java


注:本文中的org.quartz.JobDataMap.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。