Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. public static void main(String[] args) throws SchedulerException {
  2. Stations stations = new Stations();
  3. // Specify the job' s details..
  4. JobDetail job = JobBuilder.newJob(ScheduledJob.class)
  5. .withIdentity("testJob").build();
  6.  
  7. // Specify the running period of the job
  8. Trigger trigger = TriggerBuilder.newTrigger()
  9. .withSchedule(SimpleScheduleBuilder.simpleSchedule()
  10. .withIntervalInSeconds(60).repeatForever())
  11. .build();
  12.  
  13. // Schedule the job
  14. SchedulerFactory sf = new StdSchedulerFactory();
  15. Scheduler sched = sf.getScheduler();
  16. sched.start();
  17. sched.scheduleJob(job, trigger);
  18. System.out.println(job.getJobDataMap());
  19.  
  20. public void execute(JobExecutionContext context) throws JobExecutionException {
  21. JobDataMap jDM= context.getMergedJobDataMap();
  22. Client client = ClientBuilder.newClient();
  23. WebTarget targetAdd = client.target("http://wservice.viabicing.cat/").path("v2/stations");
  24. Stations stations = targetAdd.request(MediaType.APPLICATION_JSON_TYPE).get(new GenericType<Stations>(){});
  25. jDM.put("Stations", stations);
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement