Spring Framework CronTrigger - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework CronTrigger class.

This code example shows how to use the following methods:getExpression
	 * Create a new {@code CronTask}. 
	 * @param runnable the underlying task to execute 
	 * @param expression cron expression defining when the task should be executed 
	 */ 
	public CronTask(Runnable runnable, String expression) {
		this(runnable, new CronTrigger(expression));
	} 
 
	/** 
	 * Create a new {@code CronTask}. 
	 * @param runnable the underlying task to execute 
	 * @param cronTrigger the cron trigger defining when the task should be executed 
	 */ 
	public CronTask(Runnable runnable, CronTrigger cronTrigger) {
		super(runnable, cronTrigger);
		this.expression = cronTrigger.getExpression();
	} 
 
 
	public String getExpression() {
		return this.expression;
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
		threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
		threadPoolTaskScheduler.setThreadNamePrefix("SpringCronJob");
		threadPoolTaskScheduler.initialize();
 
		threadPoolTaskScheduler.schedule(this, new CronTrigger(cronExpression));
	} 
 
	@PreDestroy 
	public void stop() { 
		ScheduledExecutorService scheduledExecutorService = threadPoolTaskScheduler.getScheduledExecutor();
		Threads.normalShutdown(scheduledExecutorService, shutdownTimeout, TimeUnit.SECONDS);
	} 
 
	/** 
	 * 定时打印当前用户数到日志. 
	 */ 
	@Override 
	public void run() { 
		userCountScanner.executeBySpringCronByJava();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
      return false; 
    } 
    alreadyScheduledProjects.add(project);
 
    QualityAnalyzerService qualityAnalyzerService = createDefaultQualityAnalyzer();
    scheduler.schedule(new AnalyzerRunnable(project, projectRepository, qualityAnalyzerService), new CronTrigger(project.getCronExpression()));
    log.info("Scheduled analyzer job for project {} with cron expression {}", project.getName(), project.getCronExpression());
    return true; 
  } 
 
  private DefaultQualityAnalyzerService createDefaultQualityAnalyzer() { 
    return new DefaultQualityAnalyzerService(violationsCalculatorService,
        scmAvailabilityCheckerServiceFactory,
        codeChangeProbabilityCalculatorFactory,
        secureChangeProbabilityCalculator,
        costsCalculator,
        qualityAnalysisRepository);
  } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java