On 26 February 2013 09:48, Ian Boston <[email protected]> wrote: > On 26 February 2013 00:27, Felix Meschberger <[email protected]> wrote: >> Hi, >> >> Ok, I understand. Yet your solution is quite intrusive (requires code >> changes and Code Dependencies). >> >> OTOH: I just was made aware of JAMon [1]. It looks like this may do a lot of >> things but is not intrusive since it seems to transparently work with >> wrappers and proxies. >> >> WDYT ? >> > > It looks interesting however the license [1] will be a problem. Its > wording looks like BSD but only allows binary code redistribution. > Thats not really open source and makes me worry about sustainability ? > > But I like the approach, almost like Mockito with > > MonitorFactory.proxy(Repository.class).login(); > > What happens when you use aspects or CGLib with OSGi ? > Ideally we would want to be able to monitor classes not exported. > Has anyone tried ? >
Outcome of some research, reading the JAMon code base and other reading: JAmon creates proxies which you have to use instead of the object. I was wrong about its Mockito like behaviour: so MyClass proxyMyclass = MonitorFactory.proxy(myClass); proxyMyclass.doSomething(); Will record 1 call for proxyMyclass and not for all calls to doSomething() on all instances of MyClass (ie its not like a aspect pointcut). As such, it might be of use if wrapping service registration. Second issue: It uses JDK proxies which can only proxy interfaces and not classes. I also looked at AspectJ in an OSGi context which is probably a non starter since load-time weaving has to be configured in the base container and will modify the behaviour of the classloaders blocking reloading of bundles. Equinox has weaving with [1]. I didn't find anything for Felix other than [2] which uses a modified service registration mechanism. All of this (AOP/AspectJ/JDKProxies) will only allow monitory of visible interfaces and not recording of stats within an implementation, below the service interface level. Proxying with CGLib will allow proxying of clases as well as interfaces but to use this to monitor classes with no code changes in the bundles will require modification to something within Felix (classloaders ?), all of which is probably too extreem to address a monitoring requirement. For completeness I've asked the authors of JAMon about their license wrt BSD. Ian 1 http://eclipse.org/equinox/weaving/ 2 http://www.mail-archive.com/[email protected]/msg07065.html > > > 1 http://jamonapi.sourceforge.net/JAMonLicense.html > > > <snip>
