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 29150 - avoid keeping static references to resource bundles
Summary: avoid keeping static references to resource bundles
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Schema2Beans (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: schema2beans-issues@ide
URL: http://www.netbeans.org/download/dev/...
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2002-11-28 16:10 UTC by _ rkubacki
Modified: 2003-01-17 09:53 UTC (History)
0 users

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 _ rkubacki 2002-11-28 16:10:46 UTC
schema2beans/src/org/netbeans/modules/schema2beans/Common.java
caches ResourceBundle. It would be better to use
NbBundle that can do better caching for the IDE.
Comment 1 _ cliffwd 2002-12-06 21:27:42 UTC
Okay, it now gets the ResourceBundle every time.
Comment 2 _ rkubacki 2002-12-09 07:52:12 UTC
Cliff, I am afraid that it is not better now. I suggested to use
NbBundle that utilizes its own cache of SoftReferences to resource
bundles. java.util.ResourceBundle doesn't have this (also it may not
support branding, I am not sure here) so it will load this bundle
every time what is probably worse than keeping one bundle in memory.

The question is likely do we have to access bundle keys w/o OpenIDE?
Hopefully it would be better to discuss some solution on nbdev
Comment 3 _ rkubacki 2003-01-17 09:53:34 UTC
http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#perf-static-bundles
is very brief. The idea is to do caching in NbBundle with possibility
to remove it from cache when it is not used for some time. This is
especially usefull if the bundle is only rarely used (like property
editors)

If you cache it in static variable the only chance to release it is
during class unload which is uncommon and memory usage is only growing
as more and more Bundles is kept during IDE session. 

Unfortunately asking for ResourceBundle every time bypass any caching
and thus give us worse result. So if you really need to keep your code
independent on OpenAPI it would be better to revert to original state
(the penalty is not so bad).