I have a situation where my taglib is pretty expensive in that its execution looks something like this:

startTag()
* get ID passed in as attribute to tag
* lookup object in App scope with that ID (Search list)
* look at object and get 2 dependency IDs from it (statusID and typeID)
* lookup the Status object in the App scope using the statusID (Search list)
* lookup the Type object in the App scope using the typeID (Search list)
* print some stuff to output stream
<eval body tag>
* print the end of the stuff to output stream




So everything with a asterik (*) before it is done in the taglib, and the "Search list" denotes that I'm getting an ArrayList from the App scope, and then searching it for the object with the ID I'm interested in. Now when I ran some load tests on this tag, it was understandably not as fast as I had hoped, so I thought to speed it up, I would remember the last ID asked for when I return from the tag, and if the NEXT TIME the tag is executed, the same ID is asked for, I just reuse the object, its status and its type that I already found the previous time the tag ran, so ti looks something like this:
* get ID passed in as attribute to tag
** if ID is the same as the last ID we processed, jump right to the printing
* lookup object in App scope with that ID (Search list)
* look at object and get 2 dependency IDs from it (statusID and typeID)
* lookup the Status object in the App scope using the statusID (Search list)
* lookup the Type object in the App scope using the typeID (Search list)
** previousID = ID
* print some stuff to output stream
<eval body tag>
* print the end of the stuff to output stream




The lines with douible asteriks is the new code that remembers the last ID. Now this seems to work just fine and sped things up by about a factor of 5 for me, but I'm wondering if I need to worry about any potential synchornization issues... I was thinking no, because it seemed that another call wasn't going to come into this tag until the doTagEnd method had been called, then it would be put back into the Tag pool for use.

Can anyone let me know if this is fine, or if I need to go back to the old slow way because this will totally break with multiple people on the same page using the same tag at the same time?

TIA!
Riyad

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to