-
-
Save mike-neck/6138873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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