This week's book giveaway is in the Agile forum.
We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line!
See this thread for details.
The moose likes JSF and the fly likes optimizing dynamic component construction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "optimizing dynamic component construction" Watch "optimizing dynamic component construction" New topic

optimizing dynamic component construction

evan k. stone

Joined: Nov 29, 2006
Posts: 16
Hi All,

I have a rather difficult problem to solve, since I do not have the time to actually re-architect a new & better solution (which I really need to do)...

I'm dynamically building a GridPanel in a method in a bean that creates a table of CommandLinks (it's actually a little more complicated than that, since our web designer was pretty specific in the layout, which was not supported by, say, a datatable or whatever).

OK, so the real problem is that when I built this thing, there were only 300 or so items in the list and it was building correctly and completely, but now it turns out there are 4,000 (yes, four thousand) items in the list*, and it seems that the server is timing out (or something along those lines) as it's building the list, so I end up with an incomplete, truncated list. The results vary from server to server: it works fine on my machine (to use the cliche'), but when deployed to the server our QA team is using it creates truncated lists of varying lengths (but sometimes completes properly too).

I'm not entirely sure that that's the real problem here, but what I'm wondering is:

  • Are there tools that I can use to get at the bottom of this problem and find out for sure if it's timing out (other than through logging), or if an exception is being thrown that I'm not aware of?
  • Is there a way to optimize the creation of these components, or perhaps cache them in some way?
  • Is there a technique similar to response.flushBuffer() (or some other method) that I can use from within the bean's method to prevent server timeout?

  • I'm not really concerned about performance at this point in time, I just want it to build a complete list.

    Any suggestions or recommendations would be greatly appreciated.

    Thanks in Advance!!!


    *My first reaction was, "gee, it would have been nice to know that up front, so the designer and I could have worked up a better solution to handle these requirements...", but we're looking for a quick fix now (of course), with a view to refactoring the design & architecture at a later date.
    [ March 28, 2007: Message edited by: evan k. stone ]
    Have you tried LearnNowOnline?
    subject: optimizing dynamic component construction