Re: model detached many times

2009-07-13 Thread Vladimir K

Martijn,

you probably mean how chained models would be detached. So instead of
propagating detach in IChainedModel they would be detached automatically?

Is there a vision how it would be accomplished?


Martijn Dashorst wrote:
 
 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
 Carmanjcar...@carmanconsulting.com 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 cycle?

 On Fri, Jul 10, 2009 at 4:00 AM, Martijn
 Dashorstmartijn.dasho...@gmail.com 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.

 Martijn

 On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLartyian.macla...@gmail.com
 wrote:
 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 via a CompoundPropertyModel, so I guess lots of calls
 to the detach method of the model should be expected?

 Ian.

 On Fri, Jul 10, 2009 at 5:17 PM, Eelco
 Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com
 wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/model-detached-many-times-tp24422368p24457432.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
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 James Carman
No, he means *all* models.  The idea would be that Wicket would look
for fields of type IModel (or its descendants) on components/pages.
If it sees one, it would automatically detach it.

On Mon, Jul 13, 2009 at 3:47 AM, Vladimir Kkoval...@gmail.com wrote:

 Martijn,

 you probably mean how chained models would be detached. So instead of
 propagating detach in IChainedModel they would be detached automatically?

 Is there a vision how it would be accomplished?


 Martijn Dashorst wrote:

 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
 Carmanjcar...@carmanconsulting.com 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 cycle?

 On Fri, Jul 10, 2009 at 4:00 AM, Martijn
 Dashorstmartijn.dasho...@gmail.com 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.

 Martijn

 On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLartyian.macla...@gmail.com
 wrote:
 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 via a CompoundPropertyModel, so I guess lots of calls
 to the detach method of the model should be expected?

 Ian.

 On Fri, Jul 10, 2009 at 5:17 PM, Eelco
 Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com
 wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 View this message in context: 
 http://www.nabble.com/model-detached-many-times-tp24422368p24457432.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
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 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 detach is set a field to null.


Regards,
   Erik.


James Carman wrote:

No, he means *all* models.  The idea would be that Wicket would look
for fields of type IModel (or its descendants) on components/pages.
If it sees one, it would automatically detach it.

On Mon, Jul 13, 2009 at 3:47 AM, Vladimir Kkoval...@gmail.com wrote:
  

Martijn,

you probably mean how chained models would be detached. So instead of
propagating detach in IChainedModel they would be detached automatically?

Is there a vision how it would be accomplished?


Martijn Dashorst wrote:


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
Carmanjcar...@carmanconsulting.com 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 cycle?

On Fri, Jul 10, 2009 at 4:00 AM, Martijn
Dashorstmartijn.dasho...@gmail.com 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.

Martijn

On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLartyian.macla...@gmail.com
wrote:
  

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 via a CompoundPropertyModel, so I guess lots of calls
to the detach method of the model should be expected?

Ian.

On Fri, Jul 10, 2009 at 5:17 PM, Eelco
Hilleniuseelco.hillen...@gmail.com wrote:


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 MacLartyian.macla...@gmail.com
wrote:
  

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.




--

Erik van Oosten
http://day-to-day-stuff.blogspot.com/



-
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 James Carman
On Mon, Jul 13, 2009 at 7:32 AM, Erik van Oostene.vanoos...@grons.nl 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 detach is set a field to null.

Some models could do some weird stuff like remove connections to
resources, though, on detach.

-
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 Ian MacLarty
On Mon, Jul 13, 2009 at 9:43 PM, James
Carmanjcar...@carmanconsulting.com wrote:
 On Mon, Jul 13, 2009 at 7:32 AM, Erik van Oostene.vanoos...@grons.nl 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 detach is set a field to null.

 Some models could do some weird stuff like remove connections to
 resources, though, on detach.


I close a connection to another server on detach.   I null out the
connection field after closing it though, so I never close it twice.

Ian.

-
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-12 Thread Ian MacLarty
On Fri, Jul 10, 2009 at 6:00 PM, Martijn
Dashorstmartijn.dasho...@gmail.com 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, thanks for clearing that up.

Ian.

-
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-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 MacLartyian.macla...@gmail.com wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
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-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 via a CompoundPropertyModel, so I guess lots of calls
to the detach method of the model should be expected?

Ian.

On Fri, Jul 10, 2009 at 5:17 PM, Eelco
Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
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-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 MacLartyian.macla...@gmail.com wrote:
 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 via a CompoundPropertyModel, so I guess lots of calls
 to the detach method of the model should be expected?

 Ian.

 On Fri, Jul 10, 2009 at 5:17 PM, Eelco
 Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

-
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-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
Carmanjcar...@carmanconsulting.com 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 cycle?

 On Fri, Jul 10, 2009 at 4:00 AM, Martijn
 Dashorstmartijn.dasho...@gmail.com 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.

 Martijn

 On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLartyian.macla...@gmail.com wrote:
 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 via a CompoundPropertyModel, so I guess lots of calls
 to the detach method of the model should be expected?

 Ian.

 On Fri, Jul 10, 2009 at 5:17 PM, Eelco
 Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com 
 wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

-
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-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
Dashorstmartijn.dasho...@gmail.com wrote:
 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
 Carmanjcar...@carmanconsulting.com 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 cycle?

 On Fri, Jul 10, 2009 at 4:00 AM, Martijn
 Dashorstmartijn.dasho...@gmail.com 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.

 Martijn

 On Fri, Jul 10, 2009 at 9:41 AM, Ian MacLartyian.macla...@gmail.com wrote:
 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 via a CompoundPropertyModel, so I guess lots of calls
 to the detach method of the model should be expected?

 Ian.

 On Fri, Jul 10, 2009 at 5:17 PM, Eelco
 Hilleniuseelco.hillen...@gmail.com wrote:
 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 MacLartyian.macla...@gmail.com 
 wrote:
 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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@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.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org