This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 226277
Collapse All | Expand All

(-)a/tasklist.ui/src/org/netbeans/modules/tasklist/impl/FileScanningWorker.java (-26 / +33 lines)
Lines 64-70 Link Here
64
 *
64
 *
65
 * @author S. Aubrecht
65
 * @author S. Aubrecht
66
 */
66
 */
67
class FileScanningWorker implements Runnable {
67
public class FileScanningWorker implements Runnable {
68
    
68
    
69
    private TaskList taskList;
69
    private TaskList taskList;
70
    private boolean isCancel = false;
70
    private boolean isCancel = false;
Lines 168-210 Link Here
168
    public void run() {
168
    public void run() {
169
        synchronized( SLEEP_LOCK ) {
169
        synchronized( SLEEP_LOCK ) {
170
            while( true ) {
170
            while( true ) {
171
                try {
171
172
172
                if( killed ) {
173
                    if( killed ) {
173
                    return;
174
                        return;
174
                }
175
                    }
175
                
176
176
                Set<FileTaskScanner> scannersToNotify = null;
177
                    Set<FileTaskScanner> scannersToNotify = null;
177
                ScanItem item = new ScanItem();
178
                    ScanItem item = new ScanItem();
178
                ScanMonitor monitor = ScanMonitor.getDefault();
179
                    ScanMonitor monitor = ScanMonitor.getDefault();
179
                while( true ) {
180
                    while( true ) {
180
                    monitor.waitEnabled();
181
                        monitor.waitEnabled();
181
                    synchronized( SCAN_LOCK ) {
182
                        synchronized( SCAN_LOCK ) {
182
                        if( getNext( item ) ) {
183
                            if( getNext( item ) ) {
183
                            if( !scan( item ) ) {
184
                                if( !scan( item ) ) {
185
                                    isCancel = true;
186
                                }
187
                            } else {
184
                                isCancel = true;
188
                                isCancel = true;
185
                            }
189
                            }
186
                        } else {
190
                            if( isCancel ) {
187
                            isCancel = true;
191
                                scannersToNotify = new HashSet<FileTaskScanner>( preparedScanners );
192
                            }
188
                        }
193
                        }
194
189
                        if( isCancel ) {
195
                        if( isCancel ) {
190
                            scannersToNotify = new HashSet<FileTaskScanner>( preparedScanners );
196
                            break;
191
                        }
197
                        }
192
                    }
198
                    }
193
199
194
                    if( isCancel ) {
200
                    cleanUp( scannersToNotify );
195
                        break;
201
202
                    try {
203
                        SLEEP_LOCK.wait();
204
                    } catch( InterruptedException e ) {
205
                        //ignore
196
                    }
206
                    }
197
                }
207
                } catch (Exception e) {
198
208
                    Exceptions.printStackTrace(e);
199
                cleanUp( scannersToNotify );
200
                
201
                try {
202
                    SLEEP_LOCK.wait();
203
                } catch( InterruptedException e ) {
204
                    //ignore
205
                }
209
                }
206
            }
210
            }
207
        }
211
        }
212
        
208
    }
213
    }
209
    
214
    
210
    private void wakeup() {
215
    private void wakeup() {
Lines 253-259 Link Here
253
                    //don't let uncaught exceptions break the thread synchronization
258
                    //don't let uncaught exceptions break the thread synchronization
254
                    Exceptions.printStackTrace( e );
259
                    Exceptions.printStackTrace( e );
255
                }
260
                }
261
                if (newTasks != null) {
256
                    scannedTasks.addAll( newTasks );
262
                    scannedTasks.addAll( newTasks );
263
                }
257
264
258
            if( isCancel ) {
265
            if( isCancel ) {
259
                return false;
266
                return false;

Return to bug 226277