Java Code Examples for org.quartz.SchedulerMetaData#isInStandbyMode()

The following examples show how to use org.quartz.SchedulerMetaData#isInStandbyMode() . 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: QuartzSchedulerSPI.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@Guarded(by = STARTED)
public String renderStatusMessage() {
  StringBuilder buff = new StringBuilder();

  SchedulerMetaData metaData;
  try {
    metaData = scheduler.getMetaData();
  }
  catch (SchedulerException e) {
    throw new RuntimeException(e);
  }

  if (metaData.isShutdown()) {
    buff.append("Shutdown");
  }
  else {
    if (metaData.getRunningSince() != null) {
      buff.append("Started");
    }
    else {
      buff.append("Stopped");
    }
    if (metaData.isInStandbyMode()) {
      buff.append("; Stand-by");
    }
  }
  return buff.toString();
}
 
Example 2
Source File: ShowScheduler.java    From iaf with Apache License 2.0 4 votes vote down vote up
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;
}