- Robert
Craig R. McClanahan wrote:
On Mon, 10 Mar 2003 [EMAIL PROTECTED] wrote:
Date: Mon, 10 Mar 2003 17:07:29 -0700 From: [EMAIL PROTECTED] Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]> Subject: DynaActionForm
Hi, We are creating a derivitive of DynaActionForm that needs to add FormPropertyConfigs to the FormBeanConfig at runtime however are running into this frozen config thing. How can we get around this and why does Struts prevent this in the first place?
Struts freezes the configuration information because it uses HashMaps to store the XxxConfig beans, and we don't want to have to synchronize on them for every request (such as FindActionConfig()) just on the off chance that someone might be trying to modify the configuration data. Freezing ensures that nobody will run into mysterious results from trying to read a HashMap that someone else is trying to modify.
If you can calculate all your dynamic stuff at webapp startup time, you're still in luck -- the freeze happens after PlugIns are initialized, so you can use one of them to set up the stuff that was not in the config files. If you really need to modify these structures at runtime, you're going to need to create modified versions of the appropriate config classes -- and be sure you synchronize on the accesses (paying the inevitable performance cost of this).
Thank you!
Craig
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]