dev@javaserverfaces.java.net

Re: Review: Initial Fixes for Issue 125

From: Ed Burns <ed.burns_at_sun.com>
Date: Sat, 2 Jul 2005 13:31:34 -0700

>>>>> On Sat, 02 Jul 2005 02:50:11 -0500, Jacob Hookom <jacob_at_hookom.net> said:

JH> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=125
JH> ============

JH> In order to optimize processing on leaf nodes, we need to predicate
JH> calls to:

JH> - UIComponent.getChildren()
JH> - UIComponent.getFacets()

JH> Lots of wasteful object instantiation was occuring within
JH> UIComponentBase's logic. JSF Impl
JH> RenderKits and other objects should also be reviewed once this
JH> changebundle is applied.


JH> 1. The method getFacetCount() was added to UIComponent and UIComponentBase

JH> 2. Reworked UIComponentBase and Renderer to first check for the
JH> existence of children/facets
JH> before calling getXXXX(), removing the possibility of lazy
JH> instantiating these items

JH> 3. StateSaving was reworked to simplify/optimize the tree walk and
JH> Facet storage

JH> 4. The method getFacetsAndChildIterator() was redone

JH> The test target needs to be run against Glassfish yet. Demo
JH> applications function fine
JH> with these modifications. Tested by adding a UIComponent to the tree
JH> which throws an
JH> exception if getChildren or getFacets is ever invoked on it.

I'd like to get this in but I understand the problem with testing
against glassfish. Please hold until we can make sure the tests still
work.

JH> + // For state saving
JH> + private final static Object[] EMPTY_ARRAY = new Object[0];
JH> +
JH> + // Empty iterator for short circuiting operations
JH> + private final static Iterator EMPTY_ITERATOR = new Iterator() {
JH> +
JH> + public void remove() {
JH> + throw new UnsupportedOperationException();
JH> + }
JH> +
JH> + public Object next() {
JH> + throw new NoSuchElementException("Empty Iterator");
JH> + }
JH> +
JH> + public boolean hasNext() {
JH> + return false;
JH> + }
JH> + };

No need for this. Use java.util.Collections.EMPTY_LIST.iterator().

Otherwise, I concurr withd Adam's comments. Once you get my +1 on the
EG for getFacetCount(), you have r=edburns for going through the checkin
process (doing the tests and all).

Ed

-- 
| ed.burns_at_sun.com  | {home: 407 869 9587, office: 408 884 9519 OR x31640}
| homepage:         | http://purl.oclc.org/NET/edburns/
| aim: edburns0sunw | iim: ed.burns_at_sun.com