org.quartz.Scheduler.getMetaData()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.quartz.Scheduler.getMetaData()方法的一些代码示例,展示了Scheduler.getMetaData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scheduler.getMetaData()方法的具体详情如下:
包路径:org.quartz.Scheduler
类名称:Scheduler
方法名:getMetaData

Scheduler.getMetaData介绍

[英]Get a SchedulerMetaData object describing the settings and capabilities of the scheduler instance.

Note that the data returned is an 'instantaneous' snap-shot, and that as soon as it's returned, the meta data values may be different.
[中]获取一个SchedulerMetaData对象,描述调度程序实例的设置和功能。
请注意,返回的数据是“即时”快照,一旦返回,元数据值可能会不同。

代码示例

代码示例来源:origin: kiegroup/jbpm

@Override
public boolean isTransactional() {
  try {
    Class<?> jobStoreClass = scheduler.getMetaData().getJobStoreClass();
    if (JobStoreSupport.class.isAssignableFrom(jobStoreClass)) {
      return true;
    }
  } catch (Exception e) {
    logger.warn("Unable to determine if quartz is transactional due to problems when checking job store class", e);
  }
  return false;
}

代码示例来源:origin: kiegroup/jbpm

@Override
public boolean removeJob(JobHandle jobHandle) {
  GlobalQuartzJobHandle quartzJobHandle = (GlobalQuartzJobHandle) jobHandle;
  
  try {
    
    boolean removed =  scheduler.deleteJob(jobKey(quartzJobHandle.getJobName(), quartzJobHandle.getJobGroup()));            
    return removed;
  } catch (SchedulerException e) {     
    
    throw new RuntimeException("Exception while removing job", e);
  } catch (RuntimeException e) {
    SchedulerMetaData metadata;
    try {
      metadata = scheduler.getMetaData();
      if (metadata.getJobStoreClass().isAssignableFrom(JobStoreCMT.class)) {
        return true;
      }
    } catch (SchedulerException e1) {
      
    }
    throw e;
  }
}

代码示例来源:origin: jiwenxing/springboot-quartz

public SchedulerMetaData getMetaData() throws SchedulerException {
  SchedulerMetaData metaData = scheduler.getMetaData();
  return metaData;
}

代码示例来源:origin: org.rhq/rhq-enterprise-server

public SchedulerMetaData getMetaData() throws SchedulerException {
  return this.scheduler.getMetaData();
}

代码示例来源:origin: org.rhq/rhq-enterprise-server

public SchedulerMetaData getMetaData() throws SchedulerException {
  return scheduler.getMetaData();
}

代码示例来源:origin: org.jbpm/jbpm-flow

@Override
public boolean isTransactional() {
  try {
    Class<?> jobStoreClass = scheduler.getMetaData().getJobStoreClass();
    if (JobStoreSupport.class.isAssignableFrom(jobStoreClass)) {
      return true;
    }
  } catch (Exception e) {
    logger.warn("Unable to determine if quartz is transactional due to problems when checking job store class", e);
  }
  return false;
}

代码示例来源:origin: org.codelibs/elasticsearch-quartz

public SchedulerMetaData getMetaData() {
  try {
    return scheduler.getMetaData();
  } catch (final SchedulerException e) {
    throw new QuartzSchedulerException(e);
  }
}

代码示例来源:origin: myschedule/myschedule-quartz-extra

public SchedulerMetaData getMetaData() {
  try {
    return scheduler.getMetaData();
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: myschedule/myschedule-quartz-extra

public SchedulerMetaData getSchedulerMetaData() {
  try {
    return scheduler.getMetaData();
  } catch (SchedulerException e) {
    throw new QuartzRuntimeException(e);
  }
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

@Override
public SchedulerMetaData getMetaData() throws SchedulerException {
  return getScheduler().getMetaData();
}

代码示例来源:origin: com.phloc/phloc-schedule

/**
 * Get the metadata of the scheduler. The state of the scheduler is not
 * changed within this method.
 * 
 * @return The metadata of the underlying scheduler.
 */
@Nonnull
public static SchedulerMetaData getSchedulerMetaData ()
{
 try
 {
  // Get the scheduler without starting it
  return s_aSchedulerFactory.getScheduler ().getMetaData ();
 }
 catch (final SchedulerException ex)
 {
  throw new IllegalStateException ("Failed to get scheduler metadata", ex); //$NON-NLS-1$
 }
}

代码示例来源:origin: org.apache.camel/camel-quartz

/**
 * Is the quartz scheduler clustered?
 */
public boolean isClustered() throws SchedulerException {
  try {
    return getScheduler().getMetaData().isJobStoreClustered();
  } catch (NoSuchMethodError e) {
    LOG.debug("Job clustering is only supported since Quartz 1.7, isClustered returning false");
    return false;
  }
}

代码示例来源:origin: org.apache.camel/camel-quartz2

/**
 * Is the quartz scheduler clustered?
 */
public boolean isClustered() throws SchedulerException {
  return getScheduler().getMetaData().isJobStoreClustered();
}

代码示例来源:origin: liveoak-io/liveoak

@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;
}

代码示例来源:origin: org.apache.synapse/synapse-core

public void stop() {
  if (state == State.START) {
    try {
      if (scheduler != null && scheduler.isStarted()) {
        if (log.isDebugEnabled()) {
          log.debug("ShuttingDown Message Processor Scheduler : " + scheduler.getMetaData());
        }
        scheduler.standby();
      }
      state = State.STOP;
    } catch (SchedulerException e) {
      throw new SynapseException("Error ShuttingDown Message processor scheduler ", e);
    }
  }
}

代码示例来源:origin: wso2/wso2-synapse

@Override
public boolean start() {
  assertInitialized();
  try {
    synchronized (lock) {
      if (!scheduler.isStarted()) {
        if (logger.isDebugEnabled()) {
          logger.debug("Starting a Scheduler : [ " + scheduler.getMetaData() + " ]");
        }
        scheduler.start();
      }
    }
  } catch (SchedulerException e) {
    throw new SynapseTaskException("Error starting scheduler ", e, logger);
  }
  return true;
}

代码示例来源:origin: org.apache.camel/camel-quartz2

public void pauseTrigger() throws Exception {
  Scheduler scheduler = getComponent().getScheduler();
  boolean isClustered = scheduler.getMetaData().isJobStoreClustered();
  if (jobPaused.get() || isClustered) {
    return;
  }
  
  jobPaused.set(true);
  if (!scheduler.isShutdown()) {
    LOG.info("Pausing trigger {}", triggerKey);
    scheduler.pauseTrigger(triggerKey);
  }
}

代码示例来源:origin: com.threewks.thundr/thundr-quartz

@Override
public SchedulerMetaData getMetaData() throws QuartzException {
  try {
    return delegate.getMetaData();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: com.threewks.thundr/thundr-contrib-quartz

@Override
public SchedulerMetaData getMetaData() throws QuartzException {
  try {
    return delegate.getMetaData();
  } catch (SchedulerException e) {
    Logger.error(e.getMessage());
    throw new QuartzException(e);
  }
}

代码示例来源:origin: org.exoplatform.kernel/exo.kernel.component.common

/**
* Indicates whether or not the job store supports the persistence. If we cannot know, we assume that it is not
* supported.
*/
private boolean isJobStoreSupportsPersistence()
{
 try
 {
   return scheduler_.getMetaData().isJobStoreSupportsPersistence();
 }
 catch (SchedulerException e)
 {
   LOG.error("Cannot know if the job store supports the persistence, we assume by default that it is not supported: "
    + e.getMessage());
 }
 return false;
}

相关文章