use of org.quartz.SchedulerMetaData in project kylo by Teradata.
the class QuartzScheduler method getMetaData.
public Map<String, Object> getMetaData() throws JobSchedulerException {
Map<String, Object> map = new HashMap<String, Object>();
try {
SchedulerMetaData metaData = getScheduler().getMetaData();
if (metaData != null) {
ObjectMapper objectMapper = new ObjectMapper();
map = objectMapper.convertValue(metaData, Map.class);
}
} catch (IllegalArgumentException | SchedulerException e) {
throw new JobSchedulerException(e);
}
return map;
}
use of org.quartz.SchedulerMetaData in project iaf by ibissource.
the class SchedulerAdapter method getSchedulerMetaDataToXml.
public XmlBuilder getSchedulerMetaDataToXml(Scheduler theScheduler) {
XmlBuilder xbRoot = new XmlBuilder("schedulerMetaData");
try {
SchedulerMetaData smd = theScheduler.getMetaData();
xbRoot.addAttribute("schedulerName", smd.getSchedulerName());
xbRoot.addAttribute("schedulerInstanceId", smd.getSchedulerInstanceId().toString());
xbRoot.addAttribute("version", smd.getVersion());
xbRoot.addAttribute("isPaused", (smd.isInStandbyMode() ? "True" : "False"));
xbRoot.addAttribute("isSchedulerRemote", (smd.isSchedulerRemote() ? "True" : "False"));
xbRoot.addAttribute("isShutdown", (smd.isShutdown() ? "True" : "False"));
xbRoot.addAttribute("isStarted", (smd.isStarted() ? "True" : "False"));
xbRoot.addAttribute("jobStoreSupportsPersistence", (smd.jobStoreSupportsPersistence() ? "True" : "False"));
xbRoot.addAttribute("numJobsExecuted", Integer.toString(smd.getNumberOfJobsExecuted()));
try {
Date runningSince = smd.getRunningSince();
xbRoot.addAttribute("runningSince", (null == runningSince ? "unknown" : DateUtils.format(runningSince, DateUtils.FORMAT_GENERICDATETIME)));
} catch (Exception e) {
log.debug(e);
}
;
xbRoot.addAttribute("jobStoreClass", smd.getJobStoreClass().getName());
xbRoot.addAttribute("schedulerClass", smd.getSchedulerClass().getName());
xbRoot.addAttribute("threadPoolClass", smd.getThreadPoolClass().getName());
xbRoot.addAttribute("threadPoolSize", Integer.toString(smd.getThreadPoolSize()));
} catch (SchedulerException se) {
log.error(se);
}
return xbRoot;
}
use of org.quartz.SchedulerMetaData in project iaf by ibissource.
the class ShowScheduler method getSchedulerMetaData.
private Map<String, Object> getSchedulerMetaData(Scheduler scheduler) throws ApiException {
Map<String, Object> schedulesMap = new HashMap<String, Object>();
try {
SchedulerMetaData schedulerMetaData = scheduler.getMetaData();
schedulesMap.put("name", schedulerMetaData.getSchedulerName());
schedulesMap.put("instanceId", schedulerMetaData.getSchedulerInstanceId().toString());
schedulesMap.put("version", schedulerMetaData.getVersion());
schedulesMap.put("isSchedulerRemote", schedulerMetaData.isSchedulerRemote());
String state = "unknown";
if (schedulerMetaData.isStarted())
state = "started";
if (schedulerMetaData.isInStandbyMode())
state = "paused";
if (schedulerMetaData.isShutdown())
state = "stopped";
schedulesMap.put("state", state);
schedulesMap.put("shutdown", schedulerMetaData.isShutdown());
schedulesMap.put("started", schedulerMetaData.isStarted());
schedulesMap.put("paused", schedulerMetaData.isInStandbyMode());
schedulesMap.put("jobStoreSupportsPersistence", schedulerMetaData.jobStoreSupportsPersistence());
schedulesMap.put("jobsExecuted", schedulerMetaData.getNumberOfJobsExecuted());
long runningSinceInLong = 0;
try {
Date runningSince = schedulerMetaData.getRunningSince();
runningSinceInLong = runningSince.getTime();
} catch (Exception e) {
log.debug(e);
}
schedulesMap.put("runningSince", runningSinceInLong);
schedulesMap.put("jobStoreClass", schedulerMetaData.getJobStoreClass().getName());
schedulesMap.put("schedulerClass", schedulerMetaData.getSchedulerClass().getName());
schedulesMap.put("threadPoolClass", schedulerMetaData.getThreadPoolClass().getName());
schedulesMap.put("threadPoolSize", schedulerMetaData.getThreadPoolSize());
} catch (SchedulerException se) {
log.error(se);
}
return schedulesMap;
}
Aggregations