[jboss-user] [Javassist Development] New message: "Re: Problems with proxy classes and a proposed resolution"

Andrew Dinn do-not-reply at jboss.com
Thu Mar 18 13:22:04 EDT 2010


User development,

A new message was posted in the thread "Problems with proxy classes and a proposed resolution":

http://community.jboss.org/message/532866#532866

Author  : Andrew Dinn
Profile : http://community.jboss.org/people/adinn

Message:
--------------------------------------------------------------
Here are the diffs for my modified version of the proxy factory code against the current trunk.
 
The cache works without leaks and supports serialization. By default classes are created to use the old writeReplace implementation which now reuses proxy classes but still fails to serialize inherited fields.
 
However,  if you disable generation of the  writeReplace method then you can serialize and deserialize the +full+ object state so long as you do it using a ProxyObjectOutputStream and ProxyObjectInputStream. The static field ProxyFactory.useWriteReplace represents the default setting for new factories. It is initialized to true to retain backwards compatiility. you can reset this default or else you can configure the behaviour of each new factory by calling factory.setuseWriteReplace(boolean).
 
Also, I have modified static field ProxyFactory.useCache along the same lines. It defines the default behaviour for new factories. So, iIf you reset this field to false and create a factory then it will not install its classes in the cache. You can also oevrride the setting per factory by calling factory.setUseCache(boolean).
 
See the javadoc in ProxyFactory, ProxyObjectOutputStream and ProxyObjectInputStream for full details.
 
n.b. I managed to avoid having to change the naming scheme for generated classes. I did have to introduce a method filter signature to the iidentity criteria for a class. This is, a byte[] which enncodes the behaviour of a method filter instance.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/532866#532866




More information about the jboss-user mailing list