package com.itranswarp.shici.scheduler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.itranswarp.shici.service.JobService;

@Component
public class Schedulers {

	// 1 minute in milliseconds:
	static final long ONE_MINUTE = 60000L;

	@Autowired
	JobService jobService;

	@Autowired
	IndexTask indexTask;

	@Autowired
	UnindexTask unindexTask;

	@Scheduled(initialDelay = ONE_MINUTE * 10, fixedRate = ONE_MINUTE * 10)
	public void scanTimeoutJobs() {
		jobService.findTimeoutJob(System.currentTimeMillis());
	}

	@Scheduled(initialDelay = ONE_MINUTE * 5, fixedRate = ONE_MINUTE * 1)
	public void executeIndexTask() {
		indexTask.execute();
	}

	@Scheduled(initialDelay = ONE_MINUTE * 5, fixedRate = ONE_MINUTE * 5)
	public void executeUnindexTask() {
		unindexTask.execute();
	}
}

@@ -254,16 +254,58 @@
 Service;
+%0Aimport com.itranswarp.wxapi.WeixinClient;
 %0A%0A@Compo
@@ -518,16 +518,249 @@
 xTask;%0A%0A
+%09@Autowired%0A%09WeixinClient weixinClient;%0A%0A%09@Scheduled(initialDelay = WeixinClient.REFRESH_TOKEN_IN_MILLIS, fixedRate = WeixinClient.REFRESH_TOKEN_IN_MILLIS)%0A%09public void refreshAccessToken() %7B%0A%09%09weixinClient.refreshAccessToken();%0A%09%7D%0A%0A
 %09@Schedu

update weixin token in scheduler