org.quartz.SchedulerMetaData Java Examples

The following examples show how to use org.quartz.SchedulerMetaData. 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: RemoteScheduler.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
    try {
        RemotableQuartzScheduler sched = getRemoteScheduler();
        return new SchedulerMetaData(getSchedulerName(),
                getSchedulerInstanceId(), getClass(), true, isStarted(), 
                isInStandbyMode(), isShutdown(), sched.runningSince(), 
                sched.numJobsExecuted(), sched.getJobStoreClass(), 
                sched.supportsPersistence(), sched.isClustered(), sched.getThreadPoolClass(), 
                sched.getThreadPoolSize(), sched.getVersion());

    } catch (RemoteException re) {
        throw invalidateHandleCreateException(
                "Error communicating with remote scheduler.", re);
    }

}
 
Example #2
Source File: RemoteScheduler.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
    try {
        RemotableQuartzScheduler sched = getRemoteScheduler();
        return new SchedulerMetaData(getSchedulerName(),
                getSchedulerInstanceId(), getClass(), true, isStarted(), 
                isInStandbyMode(), isShutdown(), sched.runningSince(), 
                sched.numJobsExecuted(), sched.getJobStoreClass(), 
                sched.supportsPersistence(), sched.isClustered(), sched.getThreadPoolClass(), 
                sched.getThreadPoolSize(), sched.getVersion());

    } catch (RemoteException re) {
        throw invalidateHandleCreateException(
                "Error communicating with remote scheduler.", re);
    }

}
 
Example #3
Source File: QuartzScheduler.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
public void initialize() throws SchedulerException {
    
    try {
        bind();
    } catch (Exception re) {
        throw new SchedulerException(
                "Unable to bind scheduler to RMI Registry.", re);
    }
    
    if (resources.getJMXExport()) {
        try {
            registerJMX();
        } catch (Exception e) {
            throw new SchedulerException(
                    "Unable to register scheduler with MBeanServer.", e);
        }
    }
    
    getLog().info("Scheduler meta-data: " +
            (new SchedulerMetaData(getSchedulerName(),
                    getSchedulerInstanceId(), getClass(), boundRemotely, runningSince() != null, 
                    isInStandbyMode(), isShutdown(), runningSince(), 
                    numJobsExecuted(), getJobStoreClass(), 
                    supportsPersistence(), isClustered(), getThreadPoolClass(), 
                    getThreadPoolSize(), getVersion())).toString());
}
 
Example #4
Source File: RemoteMBeanScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
    AttributeList attributeList =
        getAttributes(
            new String[] {
                "SchedulerName",
                "SchedulerInstanceId",
                "StandbyMode",
                "Shutdown",
                "JobStoreClassName",
                "ThreadPoolClassName",
                "ThreadPoolSize",
                "Version",
                "PerformanceMetrics"
            });

    try {
        return new SchedulerMetaData(
                (String)getAttribute(attributeList, 0).getValue(),
                (String)getAttribute(attributeList, 1).getValue(),
                getClass(), true, false,
                (Boolean)getAttribute(attributeList, 2).getValue(),
                (Boolean)getAttribute(attributeList, 3).getValue(),
                null,
                Integer.parseInt(((Map)getAttribute(attributeList, 8).getValue()).get("JobsExecuted").toString()),
                Class.forName((String)getAttribute(attributeList, 4).getValue()),
                false,
                false,
                Class.forName((String)getAttribute(attributeList, 5).getValue()),
                (Integer)getAttribute(attributeList, 6).getValue(),
                (String)getAttribute(attributeList, 7).getValue());
    } catch (ClassNotFoundException e) {
        throw new SchedulerException(e);
    }
}
 
Example #5
Source File: StdScheduler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public SchedulerMetaData getMetaData() {
    return new SchedulerMetaData(getSchedulerName(),
            getSchedulerInstanceId(), getClass(), false, isStarted(), 
            isInStandbyMode(), isShutdown(), sched.runningSince(), 
            sched.numJobsExecuted(), sched.getJobStoreClass(), 
            sched.supportsPersistence(), sched.isClustered(), sched.getThreadPoolClass(), 
            sched.getThreadPoolSize(), sched.getVersion());

}
 
Example #6
Source File: RemoteMBeanScheduler.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
    AttributeList attributeList = 
        getAttributes(
            new String[] {
                "schedulerName",
                "schedulerInstanceId",
                "inStandbyMode",
                "shutdown",
                "jobStoreClass",
                "threadPoolClass",
                "threadPoolSize",
                "version"
            });
    
    return new SchedulerMetaData(
            (String)attributeList.get(0),
            (String)attributeList.get(1),
            getClass(), true, isStarted(), 
            ((Boolean)attributeList.get(2)).booleanValue(), 
            ((Boolean)attributeList.get(3)).booleanValue(), 
            (Date)invoke("runningSince", new Object[] {}, new String[] {}), 
            ((Integer)invoke("numJobsExecuted", new Object[] {}, new String[] {})).intValue(),
            (Class)attributeList.get(4),
            ((Boolean)invoke("supportsPersistence", new Object[] {}, new String[] {})).booleanValue(),
            ((Boolean)invoke("isClustered", new Object[] {}, new String[] {})).booleanValue(),
            (Class)attributeList.get(5),
            ((Integer)attributeList.get(6)).intValue(),
            (String)attributeList.get(7));
}
 
Example #7
Source File: StdScheduler.java    From AsuraFramework with Apache License 2.0 5 votes vote down vote up
public SchedulerMetaData getMetaData() {
    return new SchedulerMetaData(getSchedulerName(),
            getSchedulerInstanceId(), getClass(), false, isStarted(), 
            isInStandbyMode(), isShutdown(), sched.runningSince(), 
            sched.numJobsExecuted(), sched.getJobStoreClass(), 
            sched.supportsPersistence(), sched.isClustered(), sched.getThreadPoolClass(), 
            sched.getThreadPoolSize(), sched.getVersion());

}
 
Example #8
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 #9
Source File: SchedulerAdapter.java    From iaf with Apache License 2.0 5 votes vote down vote up
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 #10
Source File: ScheduleService.java    From elasticsearch-quartz with Apache License 2.0 5 votes vote down vote up
public SchedulerMetaData getMetaData() {
    try {
        return scheduler.getMetaData();
    } catch (final SchedulerException e) {
        throw new QuartzSchedulerException(e);
    }
}
 
Example #11
Source File: QuartzScheduler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void initialize() throws SchedulerException {
    
    try {
        bind();
    } catch (Exception re) {
        throw new SchedulerException(
                "Unable to bind scheduler to RMI Registry.", re);
    }
    
    if (resources.getJMXExport()) {
        try {
            registerJMX();
        } catch (Exception e) {
            throw new SchedulerException(
                    "Unable to register scheduler with MBeanServer.", e);
        }
    }

    // ManagementRESTServiceConfiguration managementRESTServiceConfiguration
    // = resources.getManagementRESTServiceConfiguration();
    //
    // if (managementRESTServiceConfiguration != null &&
    // managementRESTServiceConfiguration.isEnabled()) {
    // try {
    // /**
    // * ManagementServer will only be instantiated and started if one
    // * isn't already running on the configured port for this class
    // * loader space.
    // */
    // synchronized (QuartzScheduler.class) {
    // if
    // (!MGMT_SVR_BY_BIND.containsKey(managementRESTServiceConfiguration.getBind()))
    // {
    // Class<?> managementServerImplClass =
    // Class.forName("org.quartz.management.ManagementServerImpl");
    // Class<?> managementRESTServiceConfigurationClass[] = new Class[] {
    // managementRESTServiceConfiguration.getClass() };
    // Constructor<?> managementRESTServiceConfigurationConstructor =
    // managementServerImplClass
    // .getConstructor(managementRESTServiceConfigurationClass);
    // Object arglist[] = new Object[] { managementRESTServiceConfiguration
    // };
    // ManagementServer embeddedRESTServer = ((ManagementServer)
    // managementRESTServiceConfigurationConstructor.newInstance(arglist));
    // embeddedRESTServer.start();
    // MGMT_SVR_BY_BIND.put(managementRESTServiceConfiguration.getBind(),
    // embeddedRESTServer);
    // }
    // registeredManagementServerBind =
    // managementRESTServiceConfiguration.getBind();
    // ManagementServer embeddedRESTServer =
    // MGMT_SVR_BY_BIND.get(registeredManagementServerBind);
    // embeddedRESTServer.register(this);
    // }
    // } catch (Exception e) {
    // throw new
    // SchedulerException("Unable to start the scheduler management REST service",
    // e);
    // }
    // }

    
    getLog().info("Scheduler meta-data: " +
            (new SchedulerMetaData(getSchedulerName(),
                    getSchedulerInstanceId(), getClass(), boundRemotely, runningSince() != null, 
                    isInStandbyMode(), isShutdown(), runningSince(), 
                    numJobsExecuted(), getJobStoreClass(), 
                    supportsPersistence(), isClustered(), getThreadPoolClass(), 
                    getThreadPoolSize(), getVersion())).toString());
}
 
Example #12
Source File: ScheduleJobService.java    From springboot-quartz with MIT License 4 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
	SchedulerMetaData metaData = scheduler.getMetaData();
	return metaData;
}
 
Example #13
Source File: FoxbpmScheduler.java    From FoxBPM with Apache License 2.0 4 votes vote down vote up
public SchedulerMetaData getMetaData() throws SchedulerException {
	return scheduler.getMetaData();
}
 
Example #14
Source File: AbstractScheduler.java    From smarthome with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public SchedulerMetaData getMetaData() throws SchedulerException {
    throw new UnsupportedOperationException();
}
 
Example #15
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;
}