model detached many times

2009-07-09 Thread Ian MacLarty
Hi, I noticed that my IDetachable model is being detached many times (hundreds) for each request. Is that something to worry about, or is it just because the detach method is called for each component that points to this model? Ian. --

Re: model detached many times

2009-07-10 Thread Eelco Hillenius
It's fine if a model if detached multiple times in a request, but hundreds for a single model sounds suspicious. Try to trace what components fire the detach method and see if there's anything weird with that. Eelco On Thu, Jul 9, 2009 at 11:21 PM, Ian MacLarty wrote: > Hi, > > I noticed that my

Re: model detached many times

2009-07-10 Thread Ian MacLarty
I put a breakpoint on the detach method of my model and had a look at the Components whose detach methods were called higher up in the stack trace. It looks like the detach method on the model is being called for every component on the page. All the components link to the same underlying model vi

Re: model detached many times

2009-07-10 Thread Martijn Dashorst
If you share a model between components, then yes–each component will call detach on the model. That's encapsulation for you: one component doesn't know about another component, so it can't know that its model was detached. Martijn On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLarty wrote: > I put a br

Re: model detached many times

2009-07-10 Thread Martijn Dashorst
Automatic detachment is one of the things we're looking into for 1.5 or 1.6 Martijn On Fri, Jul 10, 2009 at 12:47 PM, James Carman wrote: > Perhaps there could be some sort of registry for models that need to > be detached.  Then, after rendering, they're all detached as part of > the request cyc

Re: model detached many times

2009-07-10 Thread James Carman
Perhaps there could be some sort of registry for models that need to be detached. Then, after rendering, they're all detached as part of the request cycle? On Fri, Jul 10, 2009 at 4:00 AM, Martijn Dashorst wrote: > If you share a model between components, then yes–each component will > call detac

Re: model detached many times

2009-07-10 Thread James Carman
Right, but they shouldn't have to be detached multiple times. My point is that we should collect all the models that need detaching and call detach on them only once. Automatically deciding which ones need to be detached is a separate issue. On Fri, Jul 10, 2009 at 7:18 AM, Martijn Dashorst wrot

Re: model detached many times

2009-07-12 Thread Ian MacLarty
On Fri, Jul 10, 2009 at 6:00 PM, Martijn Dashorst wrote: > If you share a model between components, then yes–each component will > call detach on the model. That's encapsulation for you: one component > doesn't know about another component, so it can't know that its model > was detached. > Okay, t

Re: model detached many times

2009-07-13 Thread Vladimir K
@wicket.apache.org >>>> >>>> >>> >>> >>> >>> -- >>> Become a Wicket expert, learn from the best: http://wicketinaction.com >>> Apache Wicket 1.3.5 is released >>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. >>> >>&g

Re: model detached many times

2009-07-13 Thread James Carman
t; - >>>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >>>>> For additional commands, e-mail: users-h...@wicket.apache.org >>>>> >>>>> >>>> >>

Re: model detached many times

2009-07-13 Thread Erik van Oosten
As models are nested this is not possible with the current setup. If a model nests another model, the nesting model is responsible for calling detach on the nested model. Multiple models may nest the same model. So the best thing to do for now is to have some flag to see if you're already deta

Re: model detached many times

2009-07-13 Thread James Carman
On Mon, Jul 13, 2009 at 7:32 AM, Erik van Oosten wrote: > So the best thing to do for now is to have some flag to see if you're > already detached. In getObject the flag is cleared. For most models however, > it should not matter if they're called multiple times; the typical thing you > do in detac

Re: model detached many times

2009-07-13 Thread Ian MacLarty
On Mon, Jul 13, 2009 at 9:43 PM, James Carman wrote: > On Mon, Jul 13, 2009 at 7:32 AM, Erik van Oosten wrote: >> So the best thing to do for now is to have some flag to see if you're >> already detached. In getObject the flag is cleared. For most models however, >> it should not matter if they're