I have made some experiment with JBoss AOP. I have quickly implemented a pool/factory for Invocation and InvocationResponse.
- reduce the number of object creation drastically
- almost 10% faster on dummy test (1000000 invocations)
- each Invocation creation must be done through the pool/factory
- when the final target is invoked the Invocation must be released
- each InvocationResponse creation must be done through the pool/factory
- when the caller grab the InvocationResponse, he must release it
Most of the creation/release code is in the aop core classes. So it is fairly transparent to most of the already defined aspects.
But it defines a contract for Interceptor writers if they have to break the interception chain (either invocation or response). Leaks can occurs it the contract is broken
Any thoughts ?