Re: ajax and rundata disposal

tony <[email protected]> Wed, 02 Dec 2009 10:33:33 -0600
Newsgroups gmane.comp.jakarta.turbine.user
Message-ID <[email protected]>
Let me see if I have this straight...

(1) You create an object and while initializing it you store a reference 
to RunData.  A reference to this object is stored in the session.
...

(2) Another event takes place causing you to reference the session 
object, where you in turn attempt to use the original reference to your 
original RunData object
...


Instead of (1) and (2) simply include a reference of RunData as a 
parameter to the methods on your object... Do not store any references 
to any instance of RunData.  Also, you should not care if you  are 
working with different instances of RunData as each instance is single 
use (per event).

FYI... I would use a parameter approach rather than an init approach...  
Depending upon implementations, I have seen cases where the form object 
gets called, then the event, and then the form gets called 
redundantly... Even if you are referencing an event (where you might 
always expect the event to be first in the sequence).

...

If you are worried about maintaining state just use the methods on the 
current RunData instance to access whatever you have stored in the 
session.  Your state is maintained in the session, and not in any 
particular instance of RunData.





Christian Kaiser wrote:
> I think I got it now.
> Please correct me if I misconceive.
> log:
>
> 14:51:27,027 [TP-Processor8] DEBUG ...BmsRunData
> recycle  ...BmsRunData@1f3bb61
> 14:51:27,033 [TP-Processor8] DEBUG ...ModelTool   -
> refresh  ...BmsRunData@1f3bb61
>
> 14:51:27,168 [TP-Processor2] DEBUG ...BmsRunData  -
> recycle  ...BmsRunData@3e65be
> 14:51:27,183 [TP-Processor2] DEBUG ...ModelTool   -
> refresh  ...BmsRunData@3e65be
> 14:51:27,245 [TP-Processor2] DEBUG ...BmsRunData  -
> dispose  ...BmsRunData@3e65be
>
> 14:51:27,249 [TP-Processor8] ERROR ...ModelTool   - NPE
> for  ...BmsRunData@3e65be
> 14:51:27,256 [TP-Processor8] DEBUG ...BmsRunData  -
> dispose  ...BmsRunData@1f3bb61
>
>
> Processor2 overtakes Processor8.
>
> The modeltool runs in session scope, so only one instance of it exists.
> After P8 refreshes the rundata in the tool,
> P2 overwrites it with its rundata.
> P2 finished and disposed the rundata.
> The model tool in P8 has a disposed rundata.
>
>
> I can prevent from this, when I set the tool in a request scope.
> That means the refresh method of the RunDataApplicationTool is not
> called, but the Rundata is passed to the Tool with the init method.
> The tool gets initialized on every request.
>
> Thats about it for now.
> Feel free to add your thoughts.
> Thanks for your hints, so far.
>
> Christian
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>