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 252073
Collapse All | Expand All

(-)a/openide.loaders/src/org/netbeans/modules/openide/loaders/DataNodeUtils.java (-1 / +36 lines)
Lines 37-42 Link Here
37
 */
37
 */
38
package org.netbeans.modules.openide.loaders;
38
package org.netbeans.modules.openide.loaders;
39
39
40
import java.util.Map;
41
import java.util.WeakHashMap;
42
import org.openide.filesystems.FileObject;
43
import org.openide.filesystems.FileStateInvalidException;
44
import org.openide.filesystems.FileSystem;
40
import org.openide.util.RequestProcessor;
45
import org.openide.util.RequestProcessor;
41
46
42
/** Currently allows to share RP for nodes used by different packages
47
/** Currently allows to share RP for nodes used by different packages
Lines 46-56 Link Here
46
 */
51
 */
47
public final class DataNodeUtils {
52
public final class DataNodeUtils {
48
    private static final RequestProcessor RP = new RequestProcessor("Data System Nodes"); // NOI18N
53
    private static final RequestProcessor RP = new RequestProcessor("Data System Nodes"); // NOI18N
49
    
54
55
    private static final Map<FileSystem, RequestProcessor> FS_2_RP
56
            = new WeakHashMap<FileSystem, RequestProcessor>();
57
50
    private DataNodeUtils() {
58
    private DataNodeUtils() {
51
    }
59
    }
52
60
53
    public static RequestProcessor reqProcessor() {
61
    public static RequestProcessor reqProcessor() {
54
        return RP;
62
        return RP;
55
    }
63
    }
64
65
    /**
66
     * Get request processor for a file.
67
     *
68
     * @param fo Some FileObject.
69
     * @return Request Processor (newly) assigned to the file's filesystem.
70
     */
71
    public static RequestProcessor reqProcessor(FileObject fo) {
72
        if (fo == null) {
73
            return RP;
74
        }
75
        FileSystem fs;
76
        try {
77
            fs = fo.getFileSystem();
78
            synchronized (FS_2_RP) {
79
                RequestProcessor rp = FS_2_RP.get(fs);
80
                if (rp == null) {
81
                    rp = new RequestProcessor("Data System Nodes for " //NOI18N
82
                            + fs.getDisplayName());
83
                    FS_2_RP.put(fs, rp);
84
                }
85
                return rp;
86
            }
87
        } catch (FileStateInvalidException ex) {
88
            return RP;
89
        }
90
    }
56
}
91
}
(-)a/openide.loaders/src/org/openide/loaders/FolderChildren.java (-1 / +9 lines)
Lines 177-184 Link Here
177
        class R implements Runnable {
177
        class R implements Runnable {
178
            List<FolderChildrenPair> positioned = null;
178
            List<FolderChildrenPair> positioned = null;
179
            RefreshMode op;
179
            RefreshMode op;
180
            Task prevTask = null;
180
            @Override
181
            @Override
181
            public void run() {
182
            public void run() {
183
                if (prevTask != null) {
184
                    prevTask.waitFinished();
185
                    prevTask = null; // do not hold task chain indefinitely
186
                }
182
                if (op == RefreshMode.DEEP) {
187
                if (op == RefreshMode.DEEP) {
183
                    positioned = getPositionedFolderChildrenPairs(); //#229746
188
                    positioned = getPositionedFolderChildrenPairs(); //#229746
184
                    op = RefreshMode.DEEP_LATER;
189
                    op = RefreshMode.DEEP_LATER;
Lines 230-236 Link Here
230
            run.run();
235
            run.run();
231
        } else {
236
        } else {
232
            run.op = operation;
237
            run.op = operation;
233
            refTask = DataNodeUtils.reqProcessor().post(run);
238
            synchronized (this) {
239
                run.prevTask = refTask;
240
                refTask = DataNodeUtils.reqProcessor(folder.getPrimaryFile()).post(run);
241
            }
234
        }
242
        }
235
    }
243
    }
236
244

Return to bug 252073