Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
指定時刻に #バルス とツイートする Groovy コード
import org.quartz.*
import org.quartz.impl.StdSchedulerFactory
import twitter4j.TwitterFactory
class バルスTask {
public void バルス() {
TwitterFactory.singleton.updateStatus("#バルス"))
}
}
public class バルスJob implements Job {
public void execute(JobExecutionContext context)
throws JobExecutionException {
Map dataMap = context.getJobDetail().getJobDataMap()
バルスTask task = (バルスTask) dataMap.get("バルスTask")
task.バルス()
}
}
バルスTask task = new バルスTask()
//specify your scheduler task details
JobDetail job = new JobDetail()
job.setName("バルスJob")
job.setJobClass(バルスJob.class)
Map dataMap = job.getJobDataMap()
dataMap.put("バルスTask", task)
//configure the scheduler time
CronTrigger trigger = new CronTrigger()
trigger.setName("runMeJobTesting")
trigger.setCronExpression("0 19 23 2 AUG FRI 2013")
//schedule it
Scheduler scheduler = new StdSchedulerFactory().getScheduler()
scheduler.start()
scheduler.scheduleJob(job, trigger)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.