/** * Create a job to refresh the specified resources with the subscriber. * * @param participant the subscriber participant * @param jobName * @param taskName * @param listener */ public RefreshParticipantJob( ISynchronizeParticipant participant, String jobName, String taskName, IRefreshSubscriberListener listener) { super(jobName); Assert.isNotNull(participant); this.participant = participant; this.taskName = taskName; setPriority(Job.DECORATE); setRefreshInterval(3600 /* 1 hour */); // Handle restarting of job if it is configured as a scheduled refresh job. addJobChangeListener( new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (shouldReschedule()) { IStatus result = event.getResult(); if (result.getSeverity() == IStatus.CANCEL && !restartOnCancel) { return; } long delay = scheduleDelay; if (result == POSTPONED) { // Restart in 5 seconds delay = 5000; } RefreshParticipantJob.this.schedule(delay); restartOnCancel = true; } } }); if (listener != null) initialize(listener); }
/* (non-Javadoc) * @see Job#setName(String) */ protected void setName(String name) { Assert.isNotNull(name); this.name = name; }
/* (non-Javadoc) * @see Job#setProgressGroup(IProgressMonitor, int) */ protected void setProgressGroup(IProgressMonitor group, int ticks) { Assert.isNotNull(group); IProgressMonitor pm = manager.createMonitor(this, group, ticks); if (pm != null) setProgressMonitor(pm); }
protected InternalJob(String name) { Assert.isNotNull(name); this.name = name; }