You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org> on 2008/10/28 23:00:46 UTC
[jira] Commented: (TAP5-128) Render phase short-circuiting is not
implemented for methods of the same phase.
[ https://issues.apache.org/jira/browse/TAP5-128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12643346#action_12643346 ]
Howard M. Lewis Ship commented on TAP5-128:
-------------------------------------------
I can see a problem in this code:
private void invoke(boolean reverse, ComponentCallback callback)
{
try
{ // Optimization: In the most general case (just the one component, no mixins)
// invoke the callback on the component and be done ... no iterators, no nothing.
if (components == null)
{
callback.run(coreComponent);
return;
}
Iterator<Component> i = reverse ? InternalUtils.reverseIterator(components) : components.iterator();
while (i.hasNext()) callback.run(i.next());
}
catch (RuntimeException ex)
{
throw new TapestryException(ex.getMessage(), getLocation(), ex);
}
}
Looks like we work our way through the full components list (mixins plus the component itself) even once the event is aborted (because a non-null/non-void value was returned).
> Render phase short-circuiting is not implemented for methods of the same phase.
> -------------------------------------------------------------------------------
>
> Key: TAP5-128
> URL: https://issues.apache.org/jira/browse/TAP5-128
> Project: Tapestry 5
> Issue Type: Bug
> Reporter: Nick Westgate
> Priority: Critical
> Attachments: jira1662sample.tgz
>
>
> According to the docs on render phase short-circuiting for methods of the same phase:
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/rendering.html
> "If a method returns a true or false value, this will short circuit processing.
> Other methods within the phase that would ordinarily be invoked will not be invoked."
> This is currently unimplemented. (Only other "inner" phases are short-circuited & not invoked.)
> Changes would primarily affect:
> org.apache.tapestry.internal.structure.ComponentCallback
> org.apache.tapestry.internal.structure.ComponentPageElementImpl
> In ComponentPageElementImpl.invoke(...), the loop:
> while (i.hasNext())
> callback.run(i.next());
> needs to implement the short circuiting, for example:
> while (i.hasNext())
> if (callback.run(i.next()))
> break;
> This change would cascade up to ComponentCallback and all its usage in ComponentPageElementImpl.
> Cheers,
> Nick.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org