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.

Bug 225478 - Schedulers are not initialized on GlobalPathRegistry update
Summary: Schedulers are not initialized on GlobalPathRegistry update
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-29 14:16 UTC by Egor Ushakov
Modified: 2013-07-02 15:34 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Egor Ushakov 2013-01-29 14:16:41 UTC
For now in CND we would like to use parsing API but not indexing API and it looks like registering a path in GlobalPathRegistry is not enough. TaskProcessor is not created until the first access and so on. So the hack we're using now is to intialize all schedulers by hand in project opening hook like:
for(Scheduler s : Lookup.getDefault().lookupAll(Scheduler.class)) {}
(I took this hack from ClassMemberPanel)
That would be better to have this triggered on GlobalPathRegistry.register.
Comment 1 Jan Lahoda 2013-01-29 14:31:42 UTC
(In reply to comment #0)
> For now in CND we would like to use parsing API but not indexing API and it
> looks like registering a path in GlobalPathRegistry is not enough.

Actually, I think that the parsing part of parsing.api should work even if nothing is registered in GPR. Only indexing part should depend on GPR.

> TaskProcessor is not created until the first access and so on. So the hack
> we're using now is to intialize all schedulers by hand in project opening hook
> like:
> for(Scheduler s : Lookup.getDefault().lookupAll(Scheduler.class)) {}
> (I took this hack from ClassMemberPanel)
> That would be better to have this triggered on GlobalPathRegistry.register.

The bug appears to be in:
parsing.api/src/org/netbeans/modules/parsing/impl/Schedulers.java.init:
taskSchedulers = Lookup.getDefault ().lookupAll (Scheduler.class);

Which apparently tries to instantiate and initialize all the Schedulers. This might have work when the code was introduced, but I am pretty sure it does virtually nothing now, as (I think) lookupAll is now lazy. One actually needs to iterate the collection to force the instantiation of the Schedulers.

(I think that this code, to be fully correct, should do lookupResult, listen on the result and list all instances whenever the result changes. Otherwise Schedulers in newly enabled modules may remain uninitialized. That's the fun with NB Lookup.)
Comment 2 Egor Ushakov 2013-01-29 14:45:57 UTC
if it does not requre GPR it will be even better, then there will be no issues with other indexers overhead
Comment 3 Egor Ushakov 2013-06-12 09:51:51 UTC
Can this be fixed in 7.4? We may try to use some of the Parsing API soon.
Comment 4 Tomas Zezula 2013-06-28 10:26:21 UTC
Fixed jet-main a600132f16ca
Comment 5 Egor Ushakov 2013-07-02 15:34:50 UTC
verified in trunk, thanks!