[aspectwerkz-user] dumped JoinPoint implementations

Michael Haupt <[email protected]>
Newsgroups gmane.comp.java.aspectwerkz.user
Organization TU Darmstadt
Message-ID <[email protected]>
Hi,

this is gory detail, but I need to know. :-)

I'm running a little application with hot deployment whose main() method 
looks like this:

-----
HelloWorld hw = new HelloWorld();
hw.sayHello();
Deployer.deploy(HelloAspect.class);
hw.sayHello();
Deployer.undeploy(HelloAspect.class);
hw.sayHello();
-----

The HelloAspect simply attaches a before advice to the execution of 
HelloWorld.sayHello(). The deployment scope defined in an XML file 
solely contains this very method execution.

Environment: Java 5, -javaagent (as recommended).

As far as I have understood the AspectWerkz workflow, the following happens:

-----
1.

Upon loading the HelloWorld class, the deployment scope is applied to 
it, and the original implementation of sayHello() is replaced with 
something that sends an invoke() to an instance of the generated 
HelloWorld_stuff_and_numbers class that implements StaticJoinPoint.

This HelloWorld_stuff_and_numbers just simply hands control back to the 
HelloWorld instance by invoking the original method implementation.

So, the first call to sayHello() yields the intended original behaviour, 
only with one additional indirection.

2.

When the aspect is deployed, the very HelloWorld_stuff_and_numbers class 
is *overwritten* (redefined), and its new implementation of invoke() 
sends another invoke() to an instance of HelloWorld_stuff_and_numbers_1 
- which in turn invokes the advice method and the original method.

3.

When the aspect is undeployed, HelloWorld_stuff_and_numbers is *again* 
overwritten, but this time, it redirects to an instance of 
HelloWorld_stuff_and_numbers_2 which in turn calls the original behaviour.
-----

Bingo. :-) Did I get that right?

If so, then I have the following questions:

(a) Why isn't the original implementation of 
HelloWorld_stuff_and_numbers re-established upon undeployment? Why is 
the additional indirection introduced?

(b) Why is the indirection through HelloWorld_stuff_and_numbers_1 
introduced in the first place? Why isn't 
HelloWorld_stuff_and_numbers.invoke() simply replaced by the method that 
can instead be found in HelloWorld_stuff_and_numbers_1?

I hope I've made myself clear. :-)

Best,

Michael Haupt

-- 
Dipl.-Ing. Michael Haupt            [email protected]
Software Technology Group           Phone:  ++49 (0) 6151-16-5306
Darmstadt University of Technology  Fax:    ++49 (0) 6151-16-5410
Hochschulstr. 10, 64289 Darmstadt, Germany
http://www.st.informatik.tu-darmstadt.de/
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.