Bug 28210 - [all] Need to re-use MessageFormat instances
Summary: [all] Need to re-use MessageFormat instances
Status: RESOLVED DUPLICATE of bug 37712
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC All
: P2 normal (vote)
Target Milestone: 3.1   Edit
Assignee: DJ Houghton CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2002-12-12 15:33 EST by DJ Houghton CLA
Modified: 2005-01-24 14:12 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2002-12-12 15:33:51 EST
In all our Policy classes we call the static method on MessageFormat.
We should be re-using a single MessageFormat instance.
Comment 1 Rafael Chaves CLA 2003-01-14 09:32:06 EST
Clarified intention with DJ: we could reuse a single instance per Policy class 
and call #applyPattern before resolving each message.

I think it would be ok, except for format classes not being thread-safe (I 
already had weird problems with DateFormat because of that). Maybe having to 
enter in a synchronized block (eventually waiting for the lock) every time we 
create a message would be worse than creating a MessageFormat every time we 
need one. 

It seems also that #applyPattern recreates the whole object state from scratch, 
so we would be just avoiding the creation of MessageFormat objects (but not of 
their sub-objects).
Comment 2 DJ Houghton CLA 2004-04-02 14:28:37 EST
McQ to investigate.
Comment 3 John Arthorne CLA 2005-01-12 16:45:58 EST
Moving to DJ to consider in new message catalog work.
Comment 4 DJ Houghton CLA 2005-01-24 14:12:54 EST
Part of the new resource bundle work. 

*** This bug has been marked as a duplicate of 37712 ***