ScanOnDemand

Contents


Dear users, can we take away your pain?

People often complain about performance of the source scanning. For example:

Is there any way to stop the scanning projects?
netbeans 6.5.1 is unusable due to excessive project scanning

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).

The Cure!

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.

Installation

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.
  • 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.


Image:PluginMng_ScanOnDemand.png

Usage

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:

-J-Dorg.netbeans.modules.scanondemand.level=FINEST

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

$userdir/config/Preferences/org/netbeans/modules/scanondemand.properties

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:

.*\.jar=IGNORE

if you are interested to ignore changes in all unimportant java files try:

.*/Unimportant.*\.java=IGNORE

You need to restart your IDE to effectively apply changes in this configuration file.

See also: FaqScanningAndIndexingPerformanceHints, FaqScanningAndIndexingIssues

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo