Java Code Examples for org.quartz.Scheduler#getMetaData()
The following examples show how to use
org.quartz.Scheduler#getMetaData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SchedulerAdapter.java From iaf with Apache License 2.0 | 5 votes |
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()); xbRoot.addAttribute("isSchedulerRemote", smd.isSchedulerRemote()); xbRoot.addAttribute("isShutdown", smd.isShutdown()); xbRoot.addAttribute("isStarted", smd.isStarted()); xbRoot.addAttribute("jobStoreSupportsPersistence", smd.isJobStoreSupportsPersistence()); 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; }
Example 2
Source File: ShowScheduler.java From iaf with Apache License 2.0 | 4 votes |
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.isJobStoreSupportsPersistence()); schedulesMap.put("jobsExecuted", schedulerMetaData.getNumberOfJobsExecuted()); long runningSinceInLong = 0; try { Date runningSince = schedulerMetaData.getRunningSince(); runningSinceInLong = runningSince.getTime(); } catch (Exception e) { log.debug("unable to determine running since", 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("unable to retrieve SchedulerMetaData", se); } return schedulesMap; }