Skip to content

Instantly share code, notes, and snippets.

@mike-neck
Forked from yusuke/バルス.groovy
Last active December 20, 2015 13:29
Show Gist options
  • Save mike-neck/6138873 to your computer and use it in GitHub Desktop.
Save mike-neck/6138873 to your computer and use it in GitHub Desktop.
@Grab(group='org.quartz-scheduler', module='quartz', version='2.2.0')
@Grab(group='org.twitter4j', module='twitter4j-core', version='3.0.3')
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.jobDetail.jobDataMap
バルスTask task = dataMap["バルスTask"]
task.バルス()
}
}
バルスTask task = new バルスTask()
//specify your scheduler task details
JobDetail job = new JobDetail()
job.name = "バルスJob"
job.jobClass = バルスJob
Map dataMap = job.jobDataMap()
dataMap["バルスTask"] = task
//configure the scheduler time
CronTrigger trigger = new CronTrigger()
trigger.name = "runMeJobTesting"
trigger.cronExpression = "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