Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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
You can’t perform that action at this time.