Java 类org.quartz.SchedulerMetaData 实例源码

项目:lams    文件:RemoteScheduler.java   
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);
    }

}
项目:asura    文件:RemoteScheduler.java   
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);
    }

}
项目:asura    文件:QuartzScheduler.java   
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());
}
项目:liveoak    文件:SchedulerResource.java   
@Override
public Map<String, ?> properties(RequestContext ctx) throws Exception {
    Map<String, Object> result = new HashMap<>();
    if (this.scheduler.isStarted()) {
        result.put("status", "started");
    } else {
        result.put("stats", "stopped");
    }

    result.put("name", this.scheduler.getSchedulerName());
    result.put("instance-id", this.scheduler.getSchedulerInstanceId());

    SchedulerMetaData metaData = this.scheduler.getMetaData();
    result.put("running-since", metaData.getRunningSince());
    return result;
}
项目:lams    文件:RemoteMBeanScheduler.java   
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);
    }
}
项目:lams    文件:StdScheduler.java   
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());

}
项目:asura    文件:RemoteMBeanScheduler.java   
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));
}
项目:asura    文件:StdScheduler.java   
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());

}
项目:nexus-public    文件:QuartzSchedulerSPI.java   
@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();
}
项目:iaf    文件:SchedulerAdapter.java   
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;
}
项目:elasticsearch-quartz    文件:ScheduleService.java   
public SchedulerMetaData getMetaData() {
    try {
        return scheduler.getMetaData();
    } catch (final SchedulerException e) {
        throw new QuartzSchedulerException(e);
    }
}
项目:lams    文件:QuartzScheduler.java   
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());
}
项目:springboot-quartz    文件:ScheduleJobService.java   
public SchedulerMetaData getMetaData() throws SchedulerException {
    SchedulerMetaData metaData = scheduler.getMetaData();
    return metaData;
}
项目:sce-backend    文件:Main.java   
public String getSchedulerMetadata() {
    String result;
    try {
        SchedulerMetaData schedulerMetadata = sched.getMetaData();
        JSONObject results_obj = new JSONObject();

        JSONArray jsonList1 = new JSONArray();
        jsonList1.add(schedulerMetadata.getNumberOfJobsExecuted());
        jsonList1.add("Reports the number of jobs executed since the scheduler started");
        results_obj.put("Number of jobs executed", jsonList1);

        JSONArray jsonList2 = new JSONArray();
        jsonList2.add(schedulerMetadata.getRunningSince().toString());
        jsonList2.add("Reports the date at which the scheduler started running");
        results_obj.put("Running since", jsonList2);

        JSONArray jsonList3 = new JSONArray();
        jsonList3.add(schedulerMetadata.getSchedulerInstanceId());
        jsonList3.add("Reports the instance id of the scheduler");
        results_obj.put("Scheduler instance id", jsonList3);

        JSONArray jsonList4 = new JSONArray();
        jsonList4.add(schedulerMetadata.getSchedulerName());
        jsonList4.add("Reports the name of the scheduler");
        results_obj.put("Scheduler name", jsonList4);

        JSONArray jsonList5 = new JSONArray();
        jsonList5.add(schedulerMetadata.isInStandbyMode() ? "yes" : "no");
        jsonList5.add("Reports whether the scheduler is in standby mode");
        results_obj.put("Standby mode", jsonList5);

        JSONArray jsonList6 = new JSONArray();
        jsonList6.add(schedulerMetadata.isJobStoreClustered() ? "yes" : "no");
        jsonList6.add("Reports whether or not the scheduler's JobStore is clustered");
        results_obj.put("JobStore Clustered", jsonList6);

        JSONArray jsonList7 = new JSONArray();
        jsonList7.add(schedulerMetadata.isJobStoreSupportsPersistence() ? "yes" : "no");
        jsonList7.add("Reports whether or not the scheduler's JobStore instance supports persistence");
        results_obj.put("JobStore supports persistence", jsonList7);

        JSONArray jsonList8 = new JSONArray();
        jsonList8.add(schedulerMetadata.isSchedulerRemote() ? "yes" : "no");
        jsonList8.add("Reports whether the scheduler is being used remotely (via RMI)");
        results_obj.put("Remote Scheduler", jsonList8);

        JSONArray jsonList9 = new JSONArray();
        jsonList9.add(schedulerMetadata.isShutdown() ? "yes" : "no");
        jsonList9.add("Reports whether the scheduler has been shutdown");
        results_obj.put("Scheduler shutdown", jsonList9);

        JSONArray jsonList10 = new JSONArray();
        jsonList10.add(schedulerMetadata.isStarted() ? "yes" : "no");
        jsonList10.add("Reports whether the scheduler has been started");
        results_obj.put("Scheduler started", jsonList10);

        result = results_obj.toJSONString();

        jsonList1.clear();
        jsonList2.clear();
        jsonList3.clear();
        jsonList4.clear();
        jsonList5.clear();
        jsonList6.clear();
        jsonList7.clear();
        jsonList8.clear();
        jsonList9.clear();
        jsonList10.clear();
    } catch (SchedulerException e) {
        result = "";
    }
    return result;
}
项目:FoxBPM    文件:FoxbpmScheduler.java   
public SchedulerMetaData getMetaData() throws SchedulerException {
    return scheduler.getMetaData();
}
项目:iaf    文件:ShowScheduler.java   
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;
}