use of org.quartz.JobExecutionException in project alfresco-repository by Alfresco.
the class UserUsageCollapseJob method execute.
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();
}
use of org.quartz.JobExecutionException in project alfresco-repository by Alfresco.
the class DownloadsCleanupJob method execute.
/*
* @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
*/
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap jobData = context.getJobDetail().getJobDataMap();
// extract the services and max age to use
final DownloadService downloadService = (DownloadService) jobData.get(KEY_DOWNLOAD_SERVICE);
final TenantAdminService tenantAdminService = (TenantAdminService) jobData.get(KEY_TENANT_ADMIN_SERVICE);
final int maxAgeInMinutes = Integer.parseInt((String) jobData.get(KEY_MAX_AGE));
final int batchSize = Integer.parseInt((String) jobData.get(BATCH_SIZE));
final boolean cleanAllSysDownloadFolders = Boolean.parseBoolean((String) jobData.get(CLEAN_All_SYS_DOWNLOAD_FOLDERS));
final DateTime before = new DateTime().minusMinutes(maxAgeInMinutes);
AuthenticationUtil.runAs(new RunAsWork<Object>() {
public Object doWork() throws Exception {
downloadService.deleteDownloads(before.toDate(), batchSize, cleanAllSysDownloadFolders);
return null;
}
}, AuthenticationUtil.getSystemUserName());
if ((tenantAdminService != null) && tenantAdminService.isEnabled()) {
List<Tenant> tenants = tenantAdminService.getAllTenants();
for (Tenant tenant : tenants) {
TenantUtil.runAsSystemTenant(new TenantRunAsWork<Object>() {
public Object doWork() throws Exception {
downloadService.deleteDownloads(before.toDate(), batchSize, cleanAllSysDownloadFolders);
return null;
}
}, tenant.getTenantDomain());
}
}
}
use of org.quartz.JobExecutionException in project iaf by ibissource.
the class ServiceJob method execute.
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
try {
log.info("executing" + getLogPrefix(context));
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
String serviceName = dataMap.getString(JAVALISTENER_KEY);
Message message = new Message(dataMap.getString(MESSAGE_KEY));
// send job
IbisLocalSender localSender = new IbisLocalSender();
localSender.setJavaListener(serviceName);
localSender.setIsolated(false);
localSender.setName("ServiceJob");
localSender.configure();
localSender.open();
try {
localSender.sendMessage(message, null);
} finally {
localSender.close();
}
} catch (Exception e) {
log.error("JobExecutionException while running " + getLogPrefix(context), e);
throw new JobExecutionException(e, false);
}
log.debug(getLogPrefix(context) + "completed");
}
use of org.quartz.JobExecutionException in project jmxtrans by jmxtrans.
the class ServerJob method execute.
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap map = context.getMergedJobDataMap();
Server server = (Server) map.get(Server.class.getName());
log.debug("+++++ Started server job: {}", server);
try {
jmxUtils.processServer(server);
} catch (Exception e) {
throw new JobExecutionException(e);
}
log.debug("+++++ Finished server job: {}", server);
}
use of org.quartz.JobExecutionException in project pinot by linkedin.
the class AlertTaskRunnerV2 method sendFailureEmail.
private void sendFailureEmail(Throwable t) throws JobExecutionException {
HtmlEmail email = new HtmlEmail();
String subject = String.format("[ThirdEye Anomaly Detector] FAILED ALERT ID=%d for config %s", alertConfig.getId(), alertConfig.getName());
String textBody = String.format("%s%n%nException:%s", alertConfig.toString(), ExceptionUtils.getStackTrace(t));
try {
EmailHelper.sendEmailWithTextBody(email, thirdeyeConfig.getSmtpConfiguration(), subject, textBody, thirdeyeConfig.getFailureFromAddress(), thirdeyeConfig.getFailureToAddress());
} catch (EmailException e) {
throw new JobExecutionException(e);
}
}
Aggregations