コード例 #1
0
  @Override
  public void updateVirusDatabase() {
    try {
      String jobName = _updateCronTriggerBean.getJobDetail().getName();
      String jobGroup = _updateCronTriggerBean.getJobDetail().getGroup();

      _updateCronTriggerBean.getScheduler().triggerJob(jobName, jobGroup);
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }
コード例 #2
0
  @Override
  public void updateCronExpression(String cronExpression) {
    ParameterCheck.mandatory("cronExpression", cronExpression);

    NodeRef updateStatusNode = _acavNodeService.getUpdateStatusNode();

    _nodeService.setProperty(updateStatusNode, AcavModel.PROP_UPDATE_CRON, cronExpression);

    _updateCronTriggerBean.setCronExpression(cronExpression);

    try {
      String jobName = _updateCronTriggerBean.getJobDetail().getName();
      String jobGroup = _updateCronTriggerBean.getJobDetail().getGroup();

      CronTrigger trigger = (CronTrigger) _updateCronTriggerBean.getTrigger();
      trigger.setJobName("kalle");

      _updateCronTriggerBean.destroy();

      _updateCronTriggerBean.getScheduler().rescheduleJob(jobName, jobGroup, trigger);
      _updateCronTriggerBean.afterPropertiesSet();
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    }
  }