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

(-)a/masterfs.nio2/src/org/netbeans/modules/masterfs/watcher/nio2/NioNotifier.java (-2 / +11 lines)
Lines 60-71 Link Here
60
 *
60
 *
61
 * @author Egor Ushakov <gorrus@netbeans.org>
61
 * @author Egor Ushakov <gorrus@netbeans.org>
62
 */
62
 */
63
@ServiceProvider(service=Notifier.class, position=1010)
63
@ServiceProvider(service=Notifier.class, position=400)
64
public class NioNotifier extends Notifier<WatchKey> {
64
public class NioNotifier extends Notifier<WatchKey> {
65
    private final WatchService watcher;
65
    private final WatchService watcher;
66
    private final boolean DISABLED = Boolean.getBoolean("org.netbeans"  //NOI18N
67
                + ".modules.masterfs.watcher.enforceNativeNotifier");   //NOI18N
66
68
67
    public NioNotifier() throws IOException {
69
    public NioNotifier() throws IOException {
68
        this.watcher = FileSystems.getDefault().newWatchService();
70
        if (!DISABLED) {
71
            this.watcher = FileSystems.getDefault().newWatchService();
72
        } else {
73
            this.watcher = null;
74
        }
69
    }
75
    }
70
    
76
    
71
    @Override
77
    @Override
Lines 113-118 Link Here
113
119
114
    @Override
120
    @Override
115
    protected void start() throws IOException {
121
    protected void start() throws IOException {
122
        if (DISABLED) {
123
            throw new IOException("Native notifier is enforced.");      //NOI18N
124
        }
116
    }
125
    }
117
126
118
    @Override
127
    @Override
(-)a/masterfs.windows/src/org/netbeans/modules/masterfs/watcher/windows/WindowsNotifier.java (-1 / +1 lines)
Lines 73-79 Link Here
73
 *
73
 *
74
 * @author nenik
74
 * @author nenik
75
 */
75
 */
76
@ServiceProvider(service=Notifier.class, position=100)
76
@ServiceProvider(service=Notifier.class, position=600)
77
public final class WindowsNotifier extends Notifier<Void> {
77
public final class WindowsNotifier extends Notifier<Void> {
78
    static final Logger LOG = Logger.getLogger(WindowsNotifier.class.getName());
78
    static final Logger LOG = Logger.getLogger(WindowsNotifier.class.getName());
79
79
(-)a/masterfs/src/org/netbeans/modules/masterfs/watcher/Watcher.java (+28 lines)
Lines 77-82 Link Here
77
    private static final Map<FileObject,int[]> MODIFIED = new WeakHashMap<FileObject, int[]>();
77
    private static final Map<FileObject,int[]> MODIFIED = new WeakHashMap<FileObject, int[]>();
78
    private final Ext<?> ext;
78
    private final Ext<?> ext;
79
    
79
    
80
    private static long regCount = 0;
81
    private static long regTime = 0;
82
83
    private static long unregCount = 0;
84
    private static long unregTime = 0;
85
80
    public Watcher() {
86
    public Watcher() {
81
        // Watcher disabled manually or for some tests
87
        // Watcher disabled manually or for some tests
82
        if (Boolean.getBoolean("org.netbeans.modules.masterfs.watcher.disable")) {
88
        if (Boolean.getBoolean("org.netbeans.modules.masterfs.watcher.disable")) {
Lines 114-120 Link Here
114
        if (fo.isData()) {
120
        if (fo.isData()) {
115
            fo = fo.getParent();
121
            fo = fo.getParent();
116
        }
122
        }
123
        // TODO remove new lines for time measurement
124
        long start = System.currentTimeMillis();
117
        ext.register(fo);
125
        ext.register(fo);
126
        long end = System.currentTimeMillis();
127
128
        regCount ++;
129
        regTime += (end - start);
130
131
        if (regCount % 100 == 0) {
132
            LOG.log(Level.INFO, "Registered {0} watchers in average time {1} ms",
133
                    new Object[] {regCount, (double) regTime / regCount});
134
        }
118
    }
135
    }
119
    
136
    
120
    public static void unregister(FileObject fo) {
137
    public static void unregister(FileObject fo) {
Lines 128-134 Link Here
128
                return;
145
                return;
129
            }
146
            }
130
        }
147
        }
148
        // TODO remove new lines for time measurement
149
        long start = System.currentTimeMillis();
131
        ext.unregister(fo);
150
        ext.unregister(fo);
151
        long end = System.currentTimeMillis();
152
153
        unregCount ++;
154
        unregTime += (end - start);
155
156
        if (unregCount % 100 == 0) {
157
            LOG.log(Level.INFO, "Unregistered {0} watchers in average time {1} ms",
158
                    new Object[] {unregCount, (double) unregTime / unregCount});
159
        }
132
    }
160
    }
133
161
134
    public static File wrap(File f, FileObject fo) {
162
    public static File wrap(File f, FileObject fo) {

Return to bug 255757