Bug 173038 - Slow initialization of the list of entities in REST from Entity wizard
Slow initialization of the list of entities in REST from Entity wizard
Status: RESOLVED FIXED
Product: webservices
Classification: Unclassified
Component: REST
6.x
All All
: P3 (vote)
: 7.1
Assigned To: Denis Anisimov
issues@webservices
: PERFORMANCE, PLAN
: 132796 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-24 15:31 UTC by Petr Jiricka
Modified: 2011-09-06 14:25 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2009-09-24 15:31:05 UTC
1. Create a web application
2. Create some entities using Entity from Database wizard
3. Run the RESTful Web Services from Entity Classes wizard

Notice that the left list displays a "Retrieving..." message for a few seconds, and only after that it show the list of
available entities. Compare this to the "JSF Pages from Entity Classes" wizard, which displays the list of entities
immediately.
Comment 1 Milan Kuchtiak 2009-10-07 14:51:00 UTC
The second panel from the wizard should be replaced by PersistenceClientEntitySelection from Java Persistence API support.
The same panel which is used in "JSF Pages from Entity Classes" wizard.
Comment 2 Denis Anisimov 2010-10-27 11:01:43 UTC
*** Bug 132796 has been marked as a duplicate of this bug. ***
Comment 3 Denis Anisimov 2010-10-28 07:44:51 UTC
It is too risky to fix this at the upcoming release .
Needs to be fixed in the next release.
Comment 4 Denis Anisimov 2010-11-15 18:56:59 UTC
This is definitely not for 7.0 release.

The problem is more deeply than just reusage of existing persistence 
functionality .
Wizards "JPA Controller Classes from Entity Classes" and "Sessions Beans For 
Entity  Classes" uses org.netbeans.modules.j2ee.persistence.wizard.EntityClosure 
class which provides ONLY entity classes defined inside  project folder.

On the contrary "RESTful WS from Entity Classes" wizard cares also about entity
classes in the binary classpath ( which defined in the jar files on classpath ).
This is exactly the reason of slow entities list initialization. 

I don't know whether we need to care in this wizard about such entities.
There is no way to improve performance if we really need to care about 
"runtime" entities .
The only thing that can be improved here :  currently "runtime" entities 
retrieval is badly implemented . Full scan of binary classpath is started each 
time when wizard is open . Such scan is not needed when wizard is invoked 
twice. This can be improved. Any following invocation of wizard will work 
quickly. Only first time will be time consuming.

So there are two questions :
- Do we really need to care about "runtime" entities in the binary classpath at 
the wizard
- Wizard panels can be reused in case of ignoring of "runtime" entities. If we
still need to care about them then probably current panel should be kept. 
It cannot be reused from j2ee.persistence module. In the latter case only 
"runtime" entities initialization should be improved.
Comment 5 Denis Anisimov 2010-11-23 09:23:42 UTC
OK, I think I have found the way how it can be done in more convenient way:
- one need to refactor and adopt wizard panel which is used f.e. for 
"Persistence / JPA Controller Classes from Entity " . It's current implementation
works only with entities which are defined in the project sources group 
( ignore entities defined in the project jar files ).
This panel should allows to add additional entities via public methods.
So the algorithm for entities search should be : current algorithm for 
entities defined in the project sources and additionally entities that could be 
added externally.
- existed panel should be also adopted for some UI changes. F.e. RESTful from 
entities requires to handle referenced entities . So the checkbox in the 
existed persistence panel should be either non visible or disabled.
- changes described above will allow to add additional entities from the usage
code. F.e. in the case of RESTful from entities one will be able to add 
entities from runtime jar files : add "Retrieving..." list item instead of 
real entities while search is performed. Remove this item from the list and
replace it by found entities when they are identified. The behavior is like
current except type of entities which requires a time consuming search:
entities which are defined in the project source root will be shown very quickly  
( immediately ) when wizard panel is shown. And only additional entities 
will be shown ( if any ) after some time. In most cases user don't want runtime
entities . So there is no need to wait until additional entities will be found.
So the navigation through the wizard could be done without any pause.
- last thing which should be also done for improving functionality : I have 
already mentioned that currently search of runtime entities badly designed. 
Each time this search starts from the scratch . This can be optimized by 
caching entities which have been found at first time . One need to care only 
about changes in the binary classpath ( listen jar additions/ deletions ).

All this changes will improve the wizard and covers all any possible 
requirements. 
But such improvement requires a huge number of changes in two different 
modules. So it is really risky to do it for the 7.0 release.
Should be done for Next release.
Comment 6 Denis Anisimov 2011-09-05 10:00:38 UTC
web-main#0c706d06f918
Comment 7 Quality Engineering 2011-09-06 14:25:23 UTC
Integrated into 'main-golden', will be available in build *201109060600* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/0c706d06f918
User: Denis Anisimov <ads@netbeans.org>
Log: Fix for BZ#173038 - Slow initialization of the list of entities in REST from Entity wizard


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