Re: Class load order

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Le 12/01/2010 18:32, Peter Veentjer a écrit :
>
> Hi guys,
>
> I'm struggling with an issue that is caused by the order of loading 
> classes.
>
> I add additional methods to classes and this works great. If enhanced 
> class A is loaded before enhanced class B, B is allowed to call these 
> extra methods of A. But if class B is loaded before class A is 
> loaded,  i get à verify error that i'm calling a non existing method 
> on A.
>
> If i manually force loading A before B everything is allright.
>
> I would like to learn an approach to deal with this problem so that 
> the instrumentation process gets more predictable.
>
> More info about the transformation. I'm building an stm and i add 
> transactions to classes. This is done by creating an extra method with 
> an extra argument of type transaction. All the original Logic is moved 
> to this method. The code in the original method is replaced by 
> transaction management code that forwards the call inclusive the 
> transaction to the added method.
>
> The optimization i want to add is that if transactional methods are 
> called from the original code, that the method calls are replaced by 
> the version that acceps à transaction. There is no need to go through 
> the transaction management and access à threadlocal to get the 
> transaction.
>

You can also retransform (or redefine) a class :
http://download.java.net/jdk7/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses%28java.lang.Class...%29

Rémi
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.