You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Jean Safar <je...@finobject.com> on 2005/07/19 08:18:08 UTC

[QUESTION] Proxy Generation Motivation

Hi, 

I have been looking at HiveMind for a little while and I was wondering what
motivated the use of proxy generation when creating the component through
the registry. I could not find any explanation on that in the documentation.

It surely prevents cheating when playing with the interfaces as it prevents
the instance to be cast to a known implementation of the desired interface
which would break the programming by interface paradigm. Was there other
jutifications?

Best Regards
Jean Safar


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


Re: [QUESTION] Proxy Generation Motivation

Posted by Howard Lewis Ship <hl...@gmail.com>.
The dual proxy pattern is used so that we can do thread safe,
just-in-time creation of the real service.  The inner proxy is
synchronized on all methods and, within that synchronized block,
replaces itself in the outer proxy with the actual service
implementation (or the outermost interceptor).  This trades off
construction cost and the one-time cost of creating the service
implementation against a constant need to synchronize access.

On 7/20/05, James Carman <ja...@carmanconsulting.com> wrote:
> Yes, but that's not what the "outer" proxy (the one the client gets that
> delegates to the interceptor stack once it's created) is for, is it?  The
> "inner" proxy (the one at the bottom of the interceptor stack) is the one
> that delegates to the appropriate implementation object for threaded/pooled
> service models, correct?
> 
> -----Original Message-----
> From: Howard Lewis Ship [mailto:hlship@gmail.com]
> Sent: Wednesday, July 20, 2005 9:43 AM
> To: hivemind-user@jakarta.apache.org; Glen Stampoultzis
> Subject: Re: [QUESTION] Proxy Generation Motivation
> 
> On 7/19/05, Glen Stampoultzis <gs...@gmail.com> wrote:
> 
> > Another thing is that proxies allow you to adjust the scope/lifetime
> > of an object while still holding on to the original reference.
> >
> 
> 
> Very well put!
> --
> Howard M. Lewis Ship
> Independent J2EE / Open-Source Java Consultant
> Creator, Jakarta Tapestry
> Creator, Jakarta HiveMind
> 
> Professional Tapestry training, mentoring, support
> and project work.  http://howardlewisship.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


RE: [QUESTION] Proxy Generation Motivation

Posted by James Carman <ja...@carmanconsulting.com>.
Yes, but that's not what the "outer" proxy (the one the client gets that
delegates to the interceptor stack once it's created) is for, is it?  The
"inner" proxy (the one at the bottom of the interceptor stack) is the one
that delegates to the appropriate implementation object for threaded/pooled
service models, correct? 

-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com] 
Sent: Wednesday, July 20, 2005 9:43 AM
To: hivemind-user@jakarta.apache.org; Glen Stampoultzis
Subject: Re: [QUESTION] Proxy Generation Motivation

On 7/19/05, Glen Stampoultzis <gs...@gmail.com> wrote:

> Another thing is that proxies allow you to adjust the scope/lifetime
> of an object while still holding on to the original reference.
> 


Very well put!
-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


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


Re: [QUESTION] Proxy Generation Motivation

Posted by Howard Lewis Ship <hl...@gmail.com>.
On 7/19/05, Glen Stampoultzis <gs...@gmail.com> wrote:

> Another thing is that proxies allow you to adjust the scope/lifetime
> of an object while still holding on to the original reference.
> 


Very well put!
-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: [QUESTION] Proxy Generation Motivation

Posted by Glen Stampoultzis <gs...@gmail.com>.
On 7/19/05, Jean Safar <je...@finobject.com> wrote:
> Hi,
> 
> I have been looking at HiveMind for a little while and I was wondering what
> motivated the use of proxy generation when creating the component through
> the registry. I could not find any explanation on that in the documentation.
> 
> It surely prevents cheating when playing with the interfaces as it prevents
> the instance to be cast to a known implementation of the desired interface
> which would break the programming by interface paradigm. Was there other
> jutifications?
> 

Another thing is that proxies allow you to adjust the scope/lifetime
of an object while still holding on to the original reference.

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


RE: [QUESTION] Proxy Generation Motivation

Posted by Jean Safar <js...@quartetfs.com>.
Thanx a lot for those insight. There is another use that I saw, although I
am not sure it was a motivation. Rule based engines such as Jess, or Oracle
Business Rules perform shallow copies of objects passed through 

fact assertion. Having a proxy does help as it copies only the reference of
the original object.

 

regards,

  _____  

From: James Carman [mailto:james@carmanconsulting.com] 
Sent: Tuesday, July 19, 2005 3:05 PM
To: hivemind-user@jakarta.apache.org; 'belaran'
Subject: RE: [QUESTION] Proxy Generation Motivation

 

What about service interceptors?  How would you implement service
interceptors without using some form of a proxy?

 

  _____  

From: belaran [mailto:belaran@gmail.com] 
Sent: Tuesday, July 19, 2005 7:58 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: [QUESTION] Proxy Generation Motivation

 

Lazy Loading/Eager Loading would be my best guest...
Indeed, the use of proxy allow you "lazy load" your object. When you ask for
the object, HM creates the proxy and it's only when your really call the
object that it really created...

I hope got your question , last time i answer one of those, i failed to
really understand the question
 : /

2005/7/19, Jean Safar <je...@finobject.com>:

Hi,

I have been looking at HiveMind for a little while and I was wondering what
motivated the use of proxy generation when creating the component through
the registry. I could not find any explanation on that in the documentation.


It surely prevents cheating when playing with the interfaces as it prevents
the instance to be cast to a known implementation of the desired interface
which would break the programming by interface paradigm. Was there other 
jutifications?

Best Regards
Jean Safar


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




-- 
Belaran,
"What'do'ya mean ?"
"As a motto, I just avoid meaning anything..." 


RE: [QUESTION] Proxy Generation Motivation

Posted by James Carman <ja...@carmanconsulting.com>.
What about service interceptors?  How would you implement service
interceptors without using some form of a proxy?

 

  _____  

From: belaran [mailto:belaran@gmail.com] 
Sent: Tuesday, July 19, 2005 7:58 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: [QUESTION] Proxy Generation Motivation

 

Lazy Loading/Eager Loading would be my best guest...
Indeed, the use of proxy allow you "lazy load" your object. When you ask for
the object, HM creates the proxy and it's only when your really call the
object that it really created...

I hope got your question , last time i answer one of those, i failed to
really understand the question
 : /

2005/7/19, Jean Safar <je...@finobject.com>:

Hi,

I have been looking at HiveMind for a little while and I was wondering what
motivated the use of proxy generation when creating the component through
the registry. I could not find any explanation on that in the documentation.


It surely prevents cheating when playing with the interfaces as it prevents
the instance to be cast to a known implementation of the desired interface
which would break the programming by interface paradigm. Was there other 
jutifications?

Best Regards
Jean Safar


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




-- 
Belaran,
"What'do'ya mean ?"
"As a motto, I just avoid meaning anything..." 


Re: [QUESTION] Proxy Generation Motivation

Posted by belaran <be...@gmail.com>.
Lazy Loading/Eager Loading would be my best guest...
Indeed, the use of proxy allow you "lazy load" your object. When you ask for 
the object, HM creates the proxy and it's only when your really call the 
object that it really created...

I hope got your question , last time i answer one of those, i failed to 
really understand the question
: /

2005/7/19, Jean Safar <je...@finobject.com>:
> 
> Hi,
> 
> I have been looking at HiveMind for a little while and I was wondering 
> what
> motivated the use of proxy generation when creating the component through
> the registry. I could not find any explanation on that in the 
> documentation.
> 
> It surely prevents cheating when playing with the interfaces as it 
> prevents
> the instance to be cast to a known implementation of the desired interface
> which would break the programming by interface paradigm. Was there other
> jutifications?
> 
> Best Regards
> Jean Safar
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


-- 
Belaran,
"What'do'ya mean ?"
"As a motto, I just avoid meaning anything..."