You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Pedro Martinez <pr...@gmail.com> on 2005/05/06 00:57:03 UTC

Page recorder for page nn is locked after a commit(), but received a change to property aaa of component nn.

This is an example in which is  possible to  reproduce the "lock after
commit" problem.
It happens when you do a click over the button "Accion 1" 
and immediately you do another click over de button "Accion 2", 


What's going on… 
well Tapestry is trying to resolve the first request when the browser
send the second request.

After follow the stack trace, I found
net.sf.tapestry.record.PageRecorder code at 119 line.

if the locked variable is true, 
Tapestry throws an AplicationRunTimeException Tapestry.getString(
                    "PageRecorder.change-after-lock",
                    component.getPage().getName(),
                    propertyName,
                    component.getExtendedId()));


how can I invoke the locked variable in my application code? to handle
this event in my application?


I suppose.. I should implement the function
ObservedChange(ObservedChangeEvent event) ???

How does suggest me to do it?  




Here is the full example code, wish include the  Temp.html, Temp.page
and Temp.java.

At the end of this document we also include the stack trace.



=============================================================================
=============================	Temp.html	=============================	
=============================================================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Temp</title>
</head>

<body>
    <form jwcid='@Form' listener='ognl:listeners.submitForma'>	
       <table>
	 <tr>
	  <td><input type='text' value='ognl:data1' size='10' 
jwcid='@TextField' disabled='false'/></td>
	  <td><input class="botones"  type="submit" jwcid="@Submit"
selected="ognl:submitListener" tag="ognl:listeners.button1" 
value="Acction 1"/></td>
	 </tr>
	 <tr>
	  <td><input type='text' value='ognl:data2' size='10' 
jwcid='@TextField' disabled='false'/></td>
	  <td><input class="botones"  type="submit" jwcid="@Submit"
selected="ognl:submitListener" tag="ognl:listeners.button2" 
value="Acction 2"/></td>
	 </tr>
	</table>
    </form> 
</body>
</html>

=============================================================================
=============================	Temp.page	=============================
=============================================================================


<page-specification class="com.edesa.matri.temp.Temp">

     <property-specification 
    	name="submitListener" 
    	type="org.apache.tapestry.IActionListener"
    />
    
    <property-specification 
    	name="data1" 
    	type="java.lang.String" 
		initial-value='new java.lang.String("0")'
		persistent="yes"
    />
    
    <property-specification 
    	name="data2" 
    	type="java.lang.String" 
		initial-value='new java.lang.String("0")'
		persistent="yes"
    />
    
     <property-specification 
    	name="message" 
    	type="java.lang.String" 
		initial-value="new java.lang.String()"
		persistent="yes"
    />

</page-specification>

=============================================================================
=============================	Temp.java	=============================
=============================================================================


public abstract class Temp extends BasePage implements PageRenderListener
{
	/**
	 * 
	 */
	private static final Logger log = Logger.getLogger(Temp.class);
	
	 public void pageBeginRender(PageEvent event)
	 {
	 	boolean rewinding= event.getRequestCycle().isRewinding();
		
		if(rewinding)
			return;
		
		log.info("pageBeginRender");
		
	 }
	 
	 /**
	  * 
	  */
	public void attach(IEngine value)
	{
		log.info("attach");
		super.attach(value);
	}
	
	/**
	 * 
	 */
	public void detach() 
	{
		log.info("detach");
		super.detach();
	}
	 
	 
	/**
	 * 
	 * @param cycle
	 */
	 public void submitForma(IRequestCycle cycle) 
	 {
	 	log.info("submitForma");
	 	
	 	IActionListener submitListener = getSubmitListener();

	    if (submitListener != null)
	    	submitListener.actionTriggered(null, cycle);
	 }
	 
	 /**
	  * 
	  * @param cycle
	  */
	 public void button1(IRequestCycle cycle) 
	 {
		log.info("button 1 START");
		
		int i=0;
 		for(i=0;i<100;i++)
		{
			System.out.println("=====");
		}
 		
 		int temp=Integer.parseInt(getData1());
 		
 		setData1(Integer.toString(1+temp));
		log.info("button 1 END");
	 }
	 
	 /**
	  * 
	  * @param cycle
	  */
	 public void button2(IRequestCycle cycle) 
	 {
	 	log.info("button 2 START");
		
		int i=0;
 		for(i=0;i<100;i++)
		{
 			System.out.println("+++++");
		}
 		int temp=Integer.parseInt(getData2());
 		
 		setData2(Integer.toString(1+temp));
 		log.info("button 2 END");
	 }
	 
	 
	 
	public abstract String getMessage();
	public abstract void setMessage(String message);

	public abstract String getData1();
	public abstract void setData1(String data1);
	
	public abstract String getData2();
	public abstract void setData2(String data2);
	
	public abstract IActionListener getSubmitListener();
	public abstract void setSubmitListener(IActionListener submitListener);
}






=============================================================================
=============================	Stack Trace	=============================
=============================================================================
This is the result of the stack trace:




You may continue by restarting the session. 

Page recorder for page Temp is locked after a commit(), but received a
change to property data2 of component Temp.
Stack Trace: 
org.apache.tapestry.record.PageRecorder.observeChange(PageRecorder.java:119) 
org.apache.tapestry.Tapestry.fireObservedChange(Tapestry.java:1339) 
org.apache.tapestry.AbstractComponent.fireObservedChange(AbstractComponent.java:304)
com.edesa.matri.temp.Temp$Enhance_10.setData2(Temp$Enhance_10.java) 
com.edesa.matri.temp.Temp.button2(Temp.java:100) 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324) 
org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46) 
org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
com.edesa.matri.temp.Temp.submitForma(Temp.java:62) 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324) 
org.apache.tapestry.listener.ListenerMap.invokeTargetMethod(ListenerMap.java:257)
org.apache.tapestry.listener.ListenerMap.access$100(ListenerMap.java:46) 
org.apache.tapestry.listener.ListenerMap$SyntheticListener.invoke(ListenerMap.java:97)
org.apache.tapestry.listener.ListenerMap$SyntheticListener.actionTriggered(ListenerMap.java:102)
org.apache.tapestry.form.Form.renderComponent(Form.java:423) 
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:857) 
org.apache.tapestry.form.Form.rewind(Form.java:568) 
org.apache.tapestry.engine.RequestCycle.rewindForm(RequestCycle.java:432) 
org.apache.tapestry.form.Form.trigger(Form.java:582) 
org.apache.tapestry.engine.DirectService.service(DirectService.java:169) 
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:889) 
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:198) 
org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:327) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:158)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) 
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) 
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)

Re: Page recorder for page nn is locked after a commit(), but received a change to property aaa of component nn.

Posted by Kent Tong <ke...@cpttm.org.mo>.
Pedro Martinez <profco <at> gmail.com> writes:

> This is an example in which is  possible to  reproduce the "lock after
> commit" problem.
> It happens when you do a click over the button "Accion 1" 
> and immediately you do another click over de button "Accion 2", 

Please see
http://article.gmane.org/gmane.comp.java.tapestry.user/19128


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org