You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Mark Struberg <st...@yahoo.de> on 2010/02/21 11:17:11 UTC

let's get rid of javassist ProxyFactory

Hi!

I think the javassist ProxyFactory is simply not made for us.
From the JavaDoc:

> setHandler
>
> public void setHandler(MethodHandler mi)
>    Sets the default invocation handler. This invocation handler is shared 
> among all the instances of a proxy class unless another is explicitly 
> specified. 

Which means that we cannot store _anything_ in a javassist ProxyHandler :(

What I remember from java.lang.reflec.ProxyHandler is that this is possible.
That's what I also find backed in the JavaDoc:

> Each proxy instance has an associated invocation handler. When a method
> is invoked on a proxy instance, the method invocation is encoded and
> dispatched to the invoke  method of its invocation handler. 
 
LieGrue,
strub

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 

Re: let's get rid of javassist ProxyFactory

Posted by Mark Struberg <st...@yahoo.de>.
in the meantime I fixed Javassist to support serialization properly (hopefully!):

http://github.com/struberg/javassist

LieGrue,
strub

--- Mark Struberg <st...@yahoo.de> schrieb am So, 21.2.2010:

> Von: Mark Struberg <st...@yahoo.de>
> Betreff: Re: let's get rid of javassist ProxyFactory
> An: dev@openwebbeans.apache.org
> Datum: Sonntag, 21. Februar, 2010 14:00 Uhr
> Yes, did that already.
> 
> The problem is that this special MethodHandler doesn't get
> serialized by javassist.
> 
> I've talked with Pete and they suffer from the same
> problem.
> 
> First I need to add a MethodHandler getHandler() in
> bytecode, then we can serialize this spezial Handler along
> with the proxy.
> 
> Currently trying that out ...
> 
> LieGrue,
> strub
> 
> --- Sven Linstaedt <sv...@googlemail.com>
> schrieb am So, 21.2.2010:
> 
> > Von: Sven Linstaedt <sv...@googlemail.com>
> > Betreff: Re: let's get rid of javassist ProxyFactory
> > An: dev@openwebbeans.apache.org
> > Datum: Sonntag, 21. Februar, 2010 13:43 Uhr
> > Hi Mark,
> > 
> > have you tried casting the proxy instance to
> > javassist.util.proxy.ProxyObject and calling
> > ProxyObject.setHandler() ?
> > 
> > br, Sven
> > 
> > 
> > 
> > 2010/2/21 Mark Struberg <st...@yahoo.de>
> > 
> > > Hi!
> > >
> > > I think the javassist ProxyFactory is simply not
> made
> > for us.
> > > From the JavaDoc:
> > >
> > > > setHandler
> > > >
> > > > public void setHandler(MethodHandler mi)
> > > >    Sets the default invocation handler.
> > This invocation handler is shared
> > > > among all the instances of a proxy class
> unless
> > another is explicitly
> > > > specified.
> > >
> > > Which means that we cannot store _anything_ in a
> > javassist ProxyHandler :(
> > >
> > > What I remember from
> java.lang.reflec.ProxyHandler is
> > that this is
> > > possible.
> > > That's what I also find backed in the JavaDoc:
> > >
> > > > Each proxy instance has an associated
> invocation
> > handler. When a method
> > > > is invoked on a proxy instance, the method
> > invocation is encoded and
> > > > dispatched to the invoke  method of its
> > invocation handler.
> > >
> > > LieGrue,
> > > strub
> > >
> > >
> __________________________________________________
> > > Do You Yahoo!?
> > > Sie sind Spam leid? Yahoo! Mail verfügt über
> einen
> > herausragenden Schutz
> > > gegen Massenmails.
> > > http://mail.yahoo.com
> > >
> > 
> 
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen
> herausragenden Schutz gegen Massenmails. 
> http://mail.yahoo.com
> 

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 

Re: let's get rid of javassist ProxyFactory

Posted by Mark Struberg <st...@yahoo.de>.
Yes, did that already.

The problem is that this special MethodHandler doesn't get serialized by javassist.

I've talked with Pete and they suffer from the same problem.

First I need to add a MethodHandler getHandler() in bytecode, then we can serialize this spezial Handler along with the proxy.

Currently trying that out ...

LieGrue,
strub

--- Sven Linstaedt <sv...@googlemail.com> schrieb am So, 21.2.2010:

> Von: Sven Linstaedt <sv...@googlemail.com>
> Betreff: Re: let's get rid of javassist ProxyFactory
> An: dev@openwebbeans.apache.org
> Datum: Sonntag, 21. Februar, 2010 13:43 Uhr
> Hi Mark,
> 
> have you tried casting the proxy instance to
> javassist.util.proxy.ProxyObject and calling
> ProxyObject.setHandler() ?
> 
> br, Sven
> 
> 
> 
> 2010/2/21 Mark Struberg <st...@yahoo.de>
> 
> > Hi!
> >
> > I think the javassist ProxyFactory is simply not made
> for us.
> > From the JavaDoc:
> >
> > > setHandler
> > >
> > > public void setHandler(MethodHandler mi)
> > >    Sets the default invocation handler.
> This invocation handler is shared
> > > among all the instances of a proxy class unless
> another is explicitly
> > > specified.
> >
> > Which means that we cannot store _anything_ in a
> javassist ProxyHandler :(
> >
> > What I remember from java.lang.reflec.ProxyHandler is
> that this is
> > possible.
> > That's what I also find backed in the JavaDoc:
> >
> > > Each proxy instance has an associated invocation
> handler. When a method
> > > is invoked on a proxy instance, the method
> invocation is encoded and
> > > dispatched to the invoke  method of its
> invocation handler.
> >
> > LieGrue,
> > strub
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Sie sind Spam leid? Yahoo! Mail verfügt über einen
> herausragenden Schutz
> > gegen Massenmails.
> > http://mail.yahoo.com
> >
> 

__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 

Re: let's get rid of javassist ProxyFactory

Posted by Sven Linstaedt <sv...@googlemail.com>.
Hi Mark,

have you tried casting the proxy instance to
javassist.util.proxy.ProxyObject and calling ProxyObject.setHandler() ?

br, Sven



2010/2/21 Mark Struberg <st...@yahoo.de>

> Hi!
>
> I think the javassist ProxyFactory is simply not made for us.
> From the JavaDoc:
>
> > setHandler
> >
> > public void setHandler(MethodHandler mi)
> >    Sets the default invocation handler. This invocation handler is shared
> > among all the instances of a proxy class unless another is explicitly
> > specified.
>
> Which means that we cannot store _anything_ in a javassist ProxyHandler :(
>
> What I remember from java.lang.reflec.ProxyHandler is that this is
> possible.
> That's what I also find backed in the JavaDoc:
>
> > Each proxy instance has an associated invocation handler. When a method
> > is invoked on a proxy instance, the method invocation is encoded and
> > dispatched to the invoke  method of its invocation handler.
>
> LieGrue,
> strub
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
> gegen Massenmails.
> http://mail.yahoo.com
>

Re: let's get rid of javassist ProxyFactory

Posted by James Carman <jc...@carmanconsulting.com>.
Perhaps you guys should check out Commons Proxy's code?

On Sun, Feb 21, 2010 at 5:17 AM, Mark Struberg <st...@yahoo.de> wrote:
> Hi!
>
> I think the javassist ProxyFactory is simply not made for us.
> From the JavaDoc:
>
>> setHandler
>>
>> public void setHandler(MethodHandler mi)
>>    Sets the default invocation handler. This invocation handler is shared
>> among all the instances of a proxy class unless another is explicitly
>> specified.
>
> Which means that we cannot store _anything_ in a javassist ProxyHandler :(
>
> What I remember from java.lang.reflec.ProxyHandler is that this is possible.
> That's what I also find backed in the JavaDoc:
>
>> Each proxy instance has an associated invocation handler. When a method
>> is invoked on a proxy instance, the method invocation is encoded and
>> dispatched to the invoke  method of its invocation handler.
>
> LieGrue,
> strub
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
> http://mail.yahoo.com
>