Bug 54445 [Jobs] Duplicate search marker jobs
Build 20040310 While doing operations, I got locked while a build was running. Looking at the progress, I observed there were 3 instances of a searching marker job in the queue, awaiting to proceed. The scheduling of these search jobs should be smart enough to avoid stepping on itself. If it is already scheduled, it shouldn't reschedule one, or if doing so, it should cancel pre-enqueued one.
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/RestartableJob.java
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.views.markers.internal;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.internal.ide.StatusUtil;
/**
 * Represents a job that can be restarted. When a job is "restarted", the currently running
 * instance is cancelled and a new instance is scheduled once the previous one terminates.
 * This does not inherit from the Jobs API. Instead of subclassing this class, a pointer to
 * a IRunnableWithProgress should be passed into the constructor. 
 */
public final class RestartableJob {