Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws SchedulerException {
- Stations stations = new Stations();
- // Specify the job' s details..
- JobDetail job = JobBuilder.newJob(ScheduledJob.class)
- .withIdentity("testJob").build();
- // Specify the running period of the job
- Trigger trigger = TriggerBuilder.newTrigger()
- .withSchedule(SimpleScheduleBuilder.simpleSchedule()
- .withIntervalInSeconds(60).repeatForever())
- .build();
- // Schedule the job
- SchedulerFactory sf = new StdSchedulerFactory();
- Scheduler sched = sf.getScheduler();
- sched.start();
- sched.scheduleJob(job, trigger);
- System.out.println(job.getJobDataMap());
- public void execute(JobExecutionContext context) throws JobExecutionException {
- JobDataMap jDM= context.getMergedJobDataMap();
- Client client = ClientBuilder.newClient();
- WebTarget targetAdd = client.target("http://wservice.viabicing.cat/").path("v2/stations");
- Stations stations = targetAdd.request(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<Stations>(){});
- jDM.put("Stations", stations);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement