Re: [aspectwerkz-user] dumped JoinPoint implementations
Alexandre Vasseur <[email protected]>
| Newsgroups | gmane.comp.java.aspectwerkz.user |
|---|---|
| Message-ID | <[email protected]> |
that s right (and gorry). Some notes: in (1) modern VM will inline the static final "invoke" redirection, and thus the flow will just looks like the hello world you wrote. We just consume some memory on the perm size of the heap I think (since we have this extra class HelloWorld_stuff_and_numbers. The optimization(s) you raise would be possible for this very simple example. But in general, the HelloWorld_stuff_and_numbers_xxx schema (field numbers and types especially) is changing a lot (f.e deploy a new aspect and then deploy yet another one). Since we are using hotswap (Java 5) or hotswap thru our native backported implementation (Java 1.4 + aspectwerkz.dll / .so module), and that all current hotswap impl. don't allow schema change, we have added this indirection. Note that the indirection depth is at most 2 no matter how many time you hot deploy things (1 as long as nothing is hot deploy), and they are all static final invocations... Alex On 4/20/05, Michael Haupt <[email protected]> wrote: > 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/ > >