本文整理匯總了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());
}