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 201538 - Race condition(?) in NetbinoxHooks
Summary: Race condition(?) in NetbinoxHooks
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Netigso (show other bugs)
Version: 7.1
Hardware: Other Linux
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-02 07:22 UTC by Jaroslav Tulach
Modified: 2011-09-08 11:12 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 Jaroslav Tulach 2011-09-02 07:22:15 UTC
Access to previous field should probably be synchronized:

    @Override
    public void addHooks(HookRegistry hr) {
        hookRegistry = hr;
        hr.addClassLoadingHook(this);
        hr.addBundleFileFactoryHook(this);
        hr.addAdaptorHook(this);
        if (configurators == null) {
            configurators = Lookup.getDefault().lookupResult(HookConfigurator.class);
            configurators.addLookupListener(this);
        }
        resultChanged(null);
    }

    @Override
    public void resultChanged(LookupEvent ev) {
        Collection<? extends HookConfigurator> now = configurators.allInstances();
        Set<HookConfigurator> added = new HashSet<HookConfigurator>(now);
        added.removeAll(previous);
        for (HookConfigurator hc : added) {
            hc.addHooks(hookRegistry);
        }
        previous = now;
    }
Comment 1 Jaroslav Tulach 2011-09-02 08:13:43 UTC
ergonomics#76c92828d69f
Comment 2 Quality Engineering 2011-09-03 14:30:41 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/76c92828d69f
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #201538: Some hook configurators might have been initialized multiple times. Adding proper synchronization of all static variables.
Comment 3 Jaroslav Tulach 2011-09-08 11:12:16 UTC
This report is sign of deeper problems as indicated by bug 201544.