protected synchronized JobScheduler getInternalScheduler() throws Exception { if (this.started.get()) { if (this.scheduler == null && store != null) { this.scheduler = store.getJobScheduler("JMS"); this.scheduler.addListener(this); this.scheduler.startDispatching(); } return this.scheduler; } return null; }
@Override public List<Job> getAllJobs() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { return js.getAllJobs(); } return Collections.emptyList(); }
@Override public String getName() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { return js.getName(); } return ""; }
long finish = (Long) TypeConversionSupport.convert(endTime, Long.class); for (Job job : scheduler.getAllJobs(start, finish)) { sendScheduledJob(producerExchange.getConnectionContext(), job, replyTo); for (Job job : scheduler.getAllJobs()) { sendScheduledJob(producerExchange.getConnectionContext(), job, replyTo); scheduler.remove(jobId); } else if (action.equals(ScheduledMessage.AMQ_SCHEDULER_ACTION_REMOVEALL)) { long finish = (Long) TypeConversionSupport.convert(endTime, Long.class); scheduler.removeAllJobs(start, finish); } else { scheduler.removeAllJobs();
@Override public void schedule(String jobId, ByteSequence payload, long delay) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.schedule(jobId, payload, delay); } }
@Override public void removeJob(String jobId) throws Exception { this.jobScheduler.remove(jobId); }
@Override public void removeAllJobs() throws Exception { this.jobScheduler.removeAllJobs(); }
@Override public void removeListener(JobListener l) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.removeListener(l); } }
@Override public List<Job> getNextScheduleJobs() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { return js.getNextScheduleJobs(); } return Collections.emptyList(); }
@Override public String getNextScheduleTime() throws Exception { long time = this.jobScheduler.getNextScheduleTime(); return JobSupport.getDateTime(time); }
@Override public void addListener(JobListener l) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.addListener(l); } }
@Override public void startDispatching() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.startDispatching(); } }
@Override public void schedule(String jobId, ByteSequence payload, String cronEntry) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.schedule(jobId, payload, cronEntry); } }
@Override public void remove(long time) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.remove(time); } }
@Override public void removeAllJobs() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.removeAllJobs(); } }
@Override public void stop() throws Exception { if (this.started.compareAndSet(true, false)) { if (this.store != null) { this.store.stop(); } if (this.scheduler != null) { this.scheduler.removeListener(this); this.scheduler = null; } } super.stop(); }
@Override public TabularData getNextScheduleJobs() throws Exception { OpenTypeFactory factory = OpenTypeSupport.getFactory(Job.class); CompositeType ct = factory.getCompositeType(); TabularType tt = new TabularType("Scheduled Jobs", "Scheduled Jobs", ct, new String[] { "jobId" }); TabularDataSupport rc = new TabularDataSupport(tt); List<Job> jobs = this.jobScheduler.getNextScheduleJobs(); for (Job job : jobs) { rc.put(new CompositeDataSupport(ct, factory.getFields(job))); } return rc; }
@Override public long getNextScheduleTime() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { return js.getNextScheduleTime(); } return 0; }
@Override public void addListener(JobListener l) throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.addListener(l); } }
@Override public void startDispatching() throws Exception { JobScheduler js = this.broker.getInternalScheduler(); if (js != null) { js.startDispatching(); } }