Can anyone help with the following? I originally sent this to
[EMAIL PROTECTED] but haven't gotten a response yet...
Thanks,
Michael Piwonka
> -----Original Message-----
> From: Michael Piwonka
> Sent: Wednesday, November 29, 2000 10:12 AM
> To: '[EMAIL PROTECTED]'
> Cc: Douglas Burns
> Subject: Problem with synchronized method
>
>
> We are using Orion 1.4.0 with Sun VM on Windows 2000. We use JBuilder 4.0
> IDE.
>
> I've put together a simple test for using custom JSP tags to perform
> language translation. We are using a hashtable to hold the translations
> that the tag handler class will look up. That hashtable is stored in an
> application variable. However, the hashtable is not created until the
> first time a JSP page calls the tag handler, at which time a call is made
> to a synchronized static method to load the hashtable (from EJBs), and
> store it in the application variable.
>
> I'm using a testing tool to hit the page with multiple simultaneous
> threads, and the program works perfectly upon initial start-up of Orion:
> the first thread to hit the page goes into the synchronized method to
> create the hashtable, and all subsequent threads wait until the first
> thread is finished. Upon entering the method, there is another check to
> see if the hashtable has been created so subsequent threads won't
> re-create it.
>
> However, the JSP page I'm hitting is cached in a sub-directory within the
> orion root directory. If I shut down Orion, then re-start it (thus
> clearing out the application variable), the synchronized method is no
> longer "obeyed" if that cache is present -- all threads immediately enter
> the method and begin building the hashtable.
>
> If I delete the cache file (it follows a *.jsp.jspCache naming
> convention), and then restart Orion, the synchronized method works
> correctly again.
>
> What am I doing wrong? What does the cached jsp page have to do with my
> static synchronized method working correctly?
>
> Attached is the java class LTTagHandler. It contains the following
> method:
> private static synchronized void createDictionary(PageContext pc){...}
> which calls another class to buld the hashtable (I assume the other class
> is irrelevant in this situation). I hope it helps...
>
> <<LTTagHandler.java>>
> If anything here is unclear, please e-mail me. We would like to find a
> solution to this problem as well as figure out how orion is handling these
> requests to the tag library.
>
> Michael Piwonka
> Altra Energy Technologies, Inc.
> 713.210.8159
> [EMAIL PROTECTED]
>
LTTagHandler.java