本文整理汇总了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());
}
示例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);
}
}
}
示例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);
}
}
}
});
}
示例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();
}
示例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);
}
}
}
});
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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);
}
示例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();
}
示例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());
}
}
示例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();
}
示例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());
}