Dear users, can we take away your pain?
People often complain about performance of the source scanning. For example:
Indeed it is a significant and still not fully resolved issue of NetBeans caused by various factors. We are working on fixes, however in spite of that we are offering this ScanOnDemand alternative. It is not replacement for fixes, it is an add on. It may not be needed for your needs. On the other hand, you may find it beneficial. Especially if:
I am starting NetBeans to do what I want!
As soon as you start the NetBeans IDE, the system does so called "up-to-date check" to verify that no files have been changed. If this seems to take too long in your case, and prevents you from performing your work, you may be interested in ScanOnDemand.
The most basic functionality of ScanOnDemand is to disable (potentially long) up-to-date check after start of the IDE. This is done under the expectation that most of the operations with your sources are done from inside the IDE and thus when the IDE is shut down, no important change can happen and thus there is no need to rescan anything. Indeed, this may not be fully accurate, but the fix is easy, in the rare situation where your significantly updated your sources using other tools, just trigger the refresh manually.
Once again the NetBeans IDE gives you more control. You stay in charge, deciding what to do and when.
I am switching to NetBeans to do what I want!
VOCs, user polls and frequency of slowness detector usages seem to indicate that our users are not really happy that first thing the NetBeans IDE does after being switched to (from browser or mail client) is wrong. Right now all know files used by the IDE are verified for being up to date (from filesystem point of view). This is often very long operation especially with cold filesystem caches.
The user is switching to the NetBeans IDE to do something: to edit a file, to choose an action, etc. However none of this is possible as the system gets blocked by never ending I/O (especially annoying for PHP users with sources on slow NFS). Many users don't go well with this and would rather prefer to be in charge and do what they want first, and refresh later (if ever).
To help in this area, we decided to create an experimental module, which is available on Update Center (as of release 6.7). The module omits automatic updates in certain situations (e.g. up-to-date check after startup and after switch to main window). The responsibility to invoke rescan and so make the data up-to-date is on the user - via explicit refresh action. If you face scanning-related problems like described above, please try the module and let us know how it works for you! Add your comment to bug report or post to nbusers mailing list or forum.
The Bitter Pill?
Common worry is that this module increases chance that indexes are out of date and this can seriously hurt user experience and even cause loss of data. This is true, with ScanOnDemand module it is easy to desynchronize indexes and the actual files.
How does it work
In current trunk build, scanning can be triggered when these types of event occur:
- file created, modified, deleted
- class-path root added/removed
- editor focus is lost
- document is modified (does not trigger immediately, but document is marked dirty and can trigger the scanning even when querying index)
When user installs SoD module, any attempt to automatically detect external changes will be abandoned and manual refresh is available from main menu and on folder context menu.
From user point of view, scanning runs (and data will be correct) when:
- creating a new project,
- adding/removing dependency,
- switching editor tabs when document modified,
- switching to other window when document modified.
Warning: Currently, this plugin only works with development builds. DO NOT use these instructions with an official release!!!
Module is available on "Latest Development Plugins" update center. Steps:
- Run the IDE,
- go to Tools | Plugins
- choose Settings and verify "Latest Development Plugins" update center is there.
- if not, add it, the URL is: http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz
- Watch out! From the moment you add it you'll start receiving notifications for yet not stable updates, so you may want to check new updates carefully before installing.
- click the "Reload Catalog" button,
- search for "Scan On Demand",
- install module.
Alternatively download the NBM file from here and install manually in the plugins manager.
Once module is installed the module prevents check for external changes and changes after start of the IDE. There is action available in Source menu called Scan for External Changes. When you think you should refresh internal indexes, invoke this action. When finished, all data should be up-to-date.
Find out what is going on
If you want to know what the module is doing, run your IDE with logging turned on:
Then the messages.log file with contain information about files that trigger the rescan. Which you can use for proper bug reporting and also for individual treaks.
Prevent Rescan on Certain Files
You can create a configuration file in
and enlist there files that you explicitly want to ignore from rescan. The format is path of the file (specified as regular expression) equals IGNORE. So if you want to ignore changes in all JAR files, you can use:
if you are interested to ignore changes in all unimportant java files try:
You need to restart your IDE to effectively apply changes in this configuration file.