Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 201714
Collapse All | Expand All

(-)src/org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoCollector.java (-8 / +17 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 70-89 Link Here
70
	}
70
	}
71
71
72
	/**
72
	/**
73
	 * This causes the calling thread to wait any background collection of out-of-sync resources
73
	 * This causes the calling thread to wait any background collection of
74
	 * to stop before returning.
74
	 * out-of-sync resources to stop before returning.
75
	 * @param monitor a progress monitor
75
	 * 
76
	 * @param monitor
77
	 * 		a progress monitor
76
	 */
78
	 */
77
	public void waitForCollector(IProgressMonitor monitor) {
79
	public void waitForCollector(IProgressMonitor monitor) {
78
		monitor.worked(1);
80
		monitor.worked(1);
79
		// wait for the event handler to process changes.
81
		int i = 0;
80
		while(eventHandler.getEventHandlerJob().getState() != Job.NONE) {
82
		// wait for the event handler to process changes
81
			monitor.worked(1);
83
		while (true) {
82
			try {
84
			try {
83
				Thread.sleep(10);		
85
				Thread.sleep(5);
84
			} catch (InterruptedException e) {
86
			} catch (InterruptedException e) {
85
			}
87
			}
86
			Policy.checkCanceled(monitor);
88
			Policy.checkCanceled(monitor);
89
			
90
			// increment the counter or reset it if the job is running 
91
			i = (eventHandler.getEventHandlerJob().getState() == Job.NONE) ? i + 1 : 0;
92
			
93
			// 50 positive checks in a row 
94
			if (i == 50)
95
				break;
87
		}
96
		}
88
		monitor.worked(1);
97
		monitor.worked(1);
89
	}
98
	}

Return to bug 201714