当前位置: 首页>>代码示例>>Java>>正文


Java SchedulerException.printStackTrace方法代码示例

本文整理汇总了Java中org.quartz.SchedulerException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SchedulerException.printStackTrace方法的具体用法?Java SchedulerException.printStackTrace怎么用?Java SchedulerException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.quartz.SchedulerException的用法示例。


在下文中一共展示了SchedulerException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: view

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@RequestMapping(value = ACTION_VIEW, method = RequestMethod.GET)
public String view(HttpServletRequest request, HttpServletResponse response) {
	try {
		Iterator<?> it = request.getParameterMap().entrySet().iterator();
		QuartzSchedule entity = new QuartzSchedule();
		while (it.hasNext()) {
			Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
			entity.setValue((String) ent.getKey(),
					((String[]) ent.getValue())[0]);
		}
		List<?> list = service.iQuartzGroupService
				.selectByWhere(new QuartzGroup());
		request.setAttribute(LIST, list);
		Map<?, ?> map = (Map<?, ?>) service.iQuartzScheduleService
				.select(entity);
		request.setAttribute(ENTITY, map);
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
	return VIEW_WIDGET + VIEW_QUARTZ + PAGE_VIEW;
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:22,代码来源:QuartzController.java

示例2: quartz

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@RequestMapping(value = ACTION_LIST)
public String quartz(HttpServletRequest request,
		HttpServletResponse response) {
	try {
		Iterator<?> it = request.getParameterMap().entrySet().iterator();
		QuartzSchedule entity = new QuartzSchedule();
		while (it.hasNext()) {
			Map.Entry<?, ?> ent = (Entry<?, ?>) it.next();
			entity.setValue((String) ent.getKey(),
					((String[]) ent.getValue())[0]);
		}
		request.setAttribute("group", entity.getGroup());
		request.setAttribute("title", entity.getName());
		Map<?, ?> map = (Map<?, ?>) service.iQuartzScheduleService
				.selectByWhere(entity);
		List<?> list = service.iQuartzGroupService
				.selectByWhere(new QuartzGroup());
		request.setAttribute(LIST, list);
		request.setAttribute(ENTITY, map);
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
	return VIEW_WIDGET + VIEW_QUARTZ + PAGE_LIST;
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:25,代码来源:QuartzController.java

示例3: run

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@Override
	public void run(String... strings) throws Exception {
		try {
			/*
			 * 在 Quartz 中, scheduler 由 SchedulerFactory创建:DirectSchedulerFactory 或者
			 * StdSchedulerFactory。第二种工厂 StdSchedulerFactory 使用较多,因为
			 * DirectSchedulerFactory 使用起来不够方便,需要作许多详细的手工编码设置。
			 */
			// 获取Scheduler实例
			scheduler = StdSchedulerFactory.getDefaultScheduler();
			scheduler.start();
//			System.out.println("scheduler.start");
//			System.out.println(scheduler.getSchedulerName());
			// 注册任务
			JobDetail jobDetail = JobBuilder.newJob(QuartzTask.class).withIdentity("QuartzTaskJob", "QuartzTaskGroup").build();
			// 设置出发时间(每1天执行1次)
			SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(24).repeatForever();
			Trigger trigger = TriggerBuilder.newTrigger().withIdentity("trigger", "group").startNow().withSchedule(simpleScheduleBuilder).build();
			// 交由Scheduler安排触发
			scheduler.scheduleJob(jobDetail, trigger);
		} catch (SchedulerException e) {
			e.printStackTrace();
		}
	}
 
开发者ID:CharleyXu,项目名称:tulingchat,代码行数:25,代码来源:QuartzConfig.java

示例4: stopJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Stop a job
 */
@Override
public boolean stopJob(String jobName) {
	System.out.println("JobServiceImpl.stopJob()");
	try{	
		String jobKey = jobName;
		String groupKey = "SampleGroup";

		Scheduler scheduler = schedulerFactoryBean.getScheduler();
		JobKey jkey = new JobKey(jobKey, groupKey);

		return scheduler.interrupt(jkey);

	} catch (SchedulerException e) {
		System.out.println("SchedulerException while stopping job. error message :"+e.getMessage());
		e.printStackTrace();
	}
	return false;
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:22,代码来源:JobServiceImpl.java

示例5: execute

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * 执行单个定时任务
 * 
 * @param strVal
 * @return String
 * @throws SchedulerException
 */
@Override
public String execute(String strVal) throws SchedulerException {
	JobKey key = null;
	try {
		String[] jobKey = strVal.split("\\.");
		if (jobKey.length > 0) {
			key = JobKey.jobKey(jobKey[1], jobKey[0]);
			Trigger trigger = newTrigger()
					.withIdentity(jobKey[1] + UUID.randomUUID().toString(),
							jobKey[0]).withPriority(100).forJob(key)
					.build();
			scheduler.scheduleJob(trigger);
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
	return key.toString();
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:26,代码来源:QuartzScheduleServiceImpl.java

示例6: stopNow

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@Transactional(rollbackFor = Exception.class)
public void stopNow(Integer id) {
    JobDetailDO jobDetailDO = daoSupport.get(id, JobDetailDO.class);
    if (Objects.isNull(jobDetailDO) || jobDetailDO.getState().intValue() != 1) {
        throw new BusinessException(ExceptionEnum.FAIL);
    }
    //先保留原状态,原表达式。
    Integer origState = jobDetailDO.getState();
    String origCron = jobDetailDO.getCron();
    //调用任务处理service,删除job。
    jobDetailDO.setState(2);
    try {
        initJobService.deleteJob(jobDetailDO);
    } catch (SchedulerException e) {
        e.printStackTrace();
        throw new BusinessException(ExceptionEnum.FAIL);
    }
    //增加操作记录
    JobDetailEditAO jobDetailEditAO = buildJobDetailEditAO(origState, origCron, JobDetailEditTypeEnum.DELETE.getCode(), jobDetailDO);
    jobDetailEditNotesService.addEditNote(jobDetailEditAO);
}
 
开发者ID:wu05281,项目名称:admin-shiro,代码行数:22,代码来源:JobDetailService.java

示例7: unScheduleJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Remove the indicated Trigger from the scheduler. 
 * If the related job does not have any other triggers, and the job is not durable, then the job will also be deleted.
 */
@Override
public boolean unScheduleJob(String jobName) {
	System.out.println("Request received for Unscheduleding job.");

	String jobKey = jobName;

	TriggerKey tkey = new TriggerKey(jobKey);
	System.out.println("Parameters received for unscheduling job : tkey :"+jobKey);
	try {
		boolean status = schedulerFactoryBean.getScheduler().unscheduleJob(tkey);
		System.out.println("Trigger associated with jobKey :"+jobKey+ " unscheduled with status :"+status);
		return status;
	} catch (SchedulerException e) {
		System.out.println("SchedulerException while unscheduling job with key :"+jobKey + " message :"+e.getMessage());
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:23,代码来源:JobServiceImpl.java

示例8: deleteJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Delete the identified Job from the Scheduler - and any associated Triggers.
 */
@Override
public boolean deleteJob(String jobName) {
	System.out.println("Request received for deleting job.");

	String jobKey = jobName;
	String groupKey = "SampleGroup";

	JobKey jkey = new JobKey(jobKey, groupKey); 
	System.out.println("Parameters received for deleting job : jobKey :"+jobKey);

	try {
		boolean status = schedulerFactoryBean.getScheduler().deleteJob(jkey);
		System.out.println("Job with jobKey :"+jobKey+ " deleted with status :"+status);
		return status;
	} catch (SchedulerException e) {
		System.out.println("SchedulerException while deleting job with key :"+jobKey + " message :"+e.getMessage());
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:24,代码来源:JobServiceImpl.java

示例9: pauseJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Pause a job
 */
@Override
public boolean pauseJob(String jobName) {
	System.out.println("Request received for pausing job.");

	String jobKey = jobName;
	String groupKey = "SampleGroup";
	JobKey jkey = new JobKey(jobKey, groupKey); 
	System.out.println("Parameters received for pausing job : jobKey :"+jobKey+ ", groupKey :"+groupKey);

	try {
		schedulerFactoryBean.getScheduler().pauseJob(jkey);
		System.out.println("Job with jobKey :"+jobKey+ " paused succesfully.");
		return true;
	} catch (SchedulerException e) {
		System.out.println("SchedulerException while pausing job with key :"+jobName + " message :"+e.getMessage());
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:23,代码来源:JobServiceImpl.java

示例10: resumeJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Resume paused job
 */
@Override
public boolean resumeJob(String jobName) {
	System.out.println("Request received for resuming job.");

	String jobKey = jobName;
	String groupKey = "SampleGroup";

	JobKey jKey = new JobKey(jobKey, groupKey); 
	System.out.println("Parameters received for resuming job : jobKey :"+jobKey);
	try {
		schedulerFactoryBean.getScheduler().resumeJob(jKey);
		System.out.println("Job with jobKey :"+jobKey+ " resumed succesfully.");
		return true;
	} catch (SchedulerException e) {
		System.out.println("SchedulerException while resuming job with key :"+jobKey+ " message :"+e.getMessage());
		e.printStackTrace();
		return false;
	}
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:23,代码来源:JobServiceImpl.java

示例11: resume

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@RequestMapping(value = ACTION_RESUME)
public String resume(HttpServletRequest request,
		HttpServletResponse response) {
	try {
		String jobKeys = request.getParameter("id");
		if (null != jobKeys) {
			service.iQuartzScheduleService.resume(jobKeys);
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
	return REDIRECT + VIEW_WIDGET + VIEW_QUARTZ + PAGE_LIST;
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:14,代码来源:QuartzController.java

示例12: pause

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * 暂停单个定时任务
 * 
 * @param strVal
 * @return String
 * @throws SchedulerException
 */
@Override
public String pause(String strVal) throws SchedulerException {
	JobKey key = null;
	try {
		String[] jobKey = strVal.split("\\.");
		if (jobKey.length > 0) {
			key = JobKey.jobKey(jobKey[1], jobKey[0]);
			scheduler.pauseJob(key);
		}
	} catch (SchedulerException e) {
		e.printStackTrace();
	}
	return key.toString();
}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:22,代码来源:QuartzScheduleServiceImpl.java

示例13: triggerJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
@Override
public ReturnT<String> triggerJob(int id) {
       XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(id);
       String group = String.valueOf(xxlJobInfo.getJobGroup());
       String name = String.valueOf(xxlJobInfo.getId());

	try {
		XxlJobDynamicScheduler.triggerJob(name, group);
		return ReturnT.SUCCESS;
	} catch (SchedulerException e) {
		e.printStackTrace();
		return ReturnT.FAIL;
	}
}
 
开发者ID:kevinKaiF,项目名称:xxl-job,代码行数:15,代码来源:XxlJobServiceImpl.java

示例14: pauseJob

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/** 
 * @Description:暂停一个任务 
 * @param jobName 
 * @param jobGroupName 
 *  
 */  
public static void pauseJob(String jobName, String jobGroupName) {  
    JobKey jobKey =JobKey.jobKey(jobName, jobName);  
    try {  
        Scheduler sched = gSchedulerFactory.getScheduler();  
        sched.pauseJob(jobKey);  
    } catch (SchedulerException e) {  
        // TODO Auto-generated catch block  
        e.printStackTrace();  
    }  
}
 
开发者ID:jeffreyning,项目名称:nh-micro,代码行数:17,代码来源:MicroQuartzManager.java

示例15: getJobState

import org.quartz.SchedulerException; //导入方法依赖的package包/类
/**
 * Get the current state of job
 */
public String getJobState(String jobName) {
	System.out.println("JobServiceImpl.getJobState()");

	try {
		String groupKey = "SampleGroup";
		JobKey jobKey = new JobKey(jobName, groupKey);

		Scheduler scheduler = schedulerFactoryBean.getScheduler();
		JobDetail jobDetail = scheduler.getJobDetail(jobKey);

		List<? extends Trigger> triggers = scheduler.getTriggersOfJob(jobDetail.getKey());
		if(triggers != null && triggers.size() > 0){
			for (Trigger trigger : triggers) {
				TriggerState triggerState = scheduler.getTriggerState(trigger.getKey());

				if (TriggerState.PAUSED.equals(triggerState)) {
					return "PAUSED";
				}else if (TriggerState.BLOCKED.equals(triggerState)) {
					return "BLOCKED";
				}else if (TriggerState.COMPLETE.equals(triggerState)) {
					return "COMPLETE";
				}else if (TriggerState.ERROR.equals(triggerState)) {
					return "ERROR";
				}else if (TriggerState.NONE.equals(triggerState)) {
					return "NONE";
				}else if (TriggerState.NORMAL.equals(triggerState)) {
					return "SCHEDULED";
				}
			}
		}
	} catch (SchedulerException e) {
		System.out.println("SchedulerException while checking job with name and group exist:"+e.getMessage());
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:javabypatel,项目名称:spring-boot-quartz-demo,代码行数:40,代码来源:JobServiceImpl.java


注:本文中的org.quartz.SchedulerException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。