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 204445 - ejbjar classes are loaded at startup
Summary: ejbjar classes are loaded at startup
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 7.1
Hardware: PC All
: P3 normal (vote)
Assignee: Denis Anisimov
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2011-10-31 12:28 UTC by Petr Cyhelsky
Modified: 2011-11-16 15:45 UTC (History)
3 users (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 Petr Cyhelsky 2011-10-31 12:28:10 UTC
According to Whitelist test 3 the following modules are loaded on startup with
JavaSE project:

org.netbeans.modules.j2ee.api.ejbjar.Car
org.netbeans.modules.j2ee.api.ejbjar.EjbJar
org.netbeans.modules.j2ee.ejbjar.CarAccessor
org.netbeans.modules.j2ee.ejbjar.EjbJarAccessor
org.netbeans.modules.j2ee.spi.ejbjar.CarProvider
org.netbeans.modules.j2ee.spi.ejbjar.CarsInProject
org.netbeans.modules.j2ee.spi.ejbjar.EjbJarProvider
org.netbeans.modules.j2ee.spi.ejbjar.EjbJarsInProject

details are available at: http://deadlock.netbeans.org/hudson/job/ergonomics/
Comment 1 Petr Cyhelsky 2011-10-31 12:30:18 UTC
When fixed please remove the classes from whitelist added by
http://hg.netbeans.org/ergonomics/rev/6bcc4d4b6c11
Comment 2 Martin Fousek 2011-11-11 15:15:54 UTC
It's same situation like in the issue #204449. I checked reported classes and all of them are loaded by CdiAnalysisResult.getBeansTargetFolder() method as well. This method looks to be called because of looking for beans.xml in the project. So I don't see anything what could be done on EJB side here. Probably the only solution would be to not use EJB, WEB APIs for checking of enbaled CDI, but don't know it's possible or not. Denis?
Comment 3 Denis Anisimov 2011-11-11 15:34:05 UTC
(In reply to comment #2)
> It's same situation like in the issue #204449. I checked reported classes and
> all of them are loaded by CdiAnalysisResult.getBeansTargetFolder() method as
> well. This method looks to be called because of looking for beans.xml in the
> project. So I don't see anything what could be done on EJB side here. Probably
> the only solution would be to not use EJB, WEB APIs for checking of enbaled
> CDI, but don't know it's possible or not. Denis?

getBeansTargetFolder() could be used in many ways. But I believe the main 
issue is usage its via static "isCdiEnabled" method inside CdiOpenHook.
The latter class has no any other purpose except CDI tracking usage. 
It was added some time ago to handle request for usage tracking.

The latter class could be refactored actually to avoid reusing common method
CdiAnalysisResult.isCdiEnabled().
One need to create 4 classes for each project type and implement 
method getBeansTargetFolder() based on target project type.

I'm reassigning this issue to myself.
Comment 4 Denis Anisimov 2011-11-15 07:28:41 UTC
isCdiEnabled() method logic is localized for now in the class which will be 
load only per specific project type. 
It eliminates need of unnecessarily class loading.
Unfortunately there is a bug in the lookup infrastructure that require loading
two classes instead of one. So I still need ProjectopenHook impl class and usage logging class.
web-main#50793f496510
Comment 5 Quality Engineering 2011-11-16 15:45:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/50793f496510
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#204445 - ejbjar classes are loaded at startup