<?xml version="1.0" encoding="iso-8859-1"?>

<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:cc="http://web.resource.org/cc/"
  xmlns="http://purl.org/rss/1.0/">

<channel rdf:about="http://blogs.codehaus.org/people/avasseur//archives/technology.html">
<title>Alex - Technology</title>
<link>http://blogs.codehaus.org/people/avasseur//archives/technology.html</link>
<description></description>
<dc:language>en-us</dc:language>
<dc:creator></dc:creator>
<dc:date>2006-01-13T16:26:21+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.661" />

<items>
<rdf:Seq><rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/001308_free_as_open_source_they_said.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/001281_spring_2x_innovation_or_maturity.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/001120_javaone_2005_aop_distributed_java_and_more.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/001100_java_open_source_playing_with_sharks.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/001002_ejb_3_and_aop_the_ejb_interceptor_dilemna.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000993_bea_joins_eclipse.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000991_junit_test_cases_and_number_of_tests_.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000986_writting_idea_plugins.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000727_see_you_at_eworld.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000607_its_life.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000235_threadlocal_and_memory_leaks.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000107_besee_donated_to_aspectwerkz.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000106_bcel_patch_submitted.html" />
<rdf:li rdf:resource="http://blogs.codehaus.org/people/avasseur/archives/000101_bcel_internal.html" />
</rdf:Seq>
</items>

</channel>

<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/001308_free_as_open_source_they_said.html">
<title>Free as Open Source they said?</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/001308_free_as_open_source_they_said.html</link>
<description><![CDATA[<p>It's interseting to follow the different strategies around Open Source these days.<br />
<b>Can Open Source be FOSS at all?</b></p>

<p>I have been myself leading a project for some time with <a href="http://www.jonasboner.com">Jonas Bonér</a> in the AOP field, and we more than once had potential corporate users willing to be helped or supported (thus charged) with some more formal ways than classic user mailing lists and "fix it yourself / wait for the community to fix it" attitude.</p>

<p>BEA's <b>blended strategy</b> of certifying and supporting 24/7 major open source components (like Spring) is well echoed by several facts these last weeks.</p>

<p>First some post on <a href="http://www.theserverside.com/news/thread.tss?thread_id=38021">TheServerSide "Developping J2EE without xxx? Why?"</a>, xxx beeing your perhaps favorite open source framework, (xxx and yyy abstracted for the purpose of this blog article).</p>

<p>Some various comments from this thread:<br />
<i><br />
"xxx is good"<br />
"Don' t look from the developer angle only"<br />
"Couple of years down the track, if xxx goes bust or I can't find developers who want to work with old technology like xxx as everyone has moved on to yyy_standard or something similar, and my application breaks for certain reason, where will I get support or resource to maintain my application?"</i></p>

<p>More interesting, a <a href="http://www.lemondeinformatique.fr/entretiens/lire-todd-delaughter-hp-software-11.html">recent quote</a> from <b>HP Software head Todd DeLaughter</b> (translated from French):<br />
"We could do something with Open Source. It will depend on the market evolution. [..] Today the problem is that sooner or later customers are asking their software provider to certify and support the stack, and provide services around. That won't change any time soon."</p>

<p>Obviously it would then be intersting to look at the cost of Open Source, beyond the FOSS zero acquisition cost.</p>

<p>It's not secret that <b>JBoss is now selling software (not free, with trial copy and commercial license)</b> and doing marketing around it - see the last JBoss newsletter and the messages around JBoss ON "JBoss Operating Network", the what sounds to be administration solution of JBoss app servers (see f.e. <a href="http://labs.jboss.com/file-access/default/members/jbosslabs/freezone/roadmaps/files/JBossON-Intro.pdf">here</a>).<br />
Quoting the newsletter:<br />
<i>"JBoss is holding a series of workshops [...] will include hands-on training on JBoss ON (trial copies of the software will be provided)"</i></p>

<p>Deploying stuff on an Open Source stack is end to end is definitely not free at the end. FOSS is just one view on one single phase in a project: development.</p>

<p>Left aside the training cost for the young developers themselves.<br />
In a recent <a href="http://opensource.sys-con.com/read/169006.htm">post</a>, Yakov Fain calculates that if you follow introduction trainings on Spring, Hibernate and JBoss, which seems today' minimum to get started on a so called FOSS stack, you'll have to travel some accross the globe, and afford a total of $9000.</p>

<p>Obviously, we then should take into account support prices, and possible performance gaps between each stacks, meaning all in all you'll need more CPU and hosting power here and there to run your beast. And CPU is never free.</p>

<p>I'd be pleased to see the debate around the Java community shift from programming practices and tech buzzwords (IoC AOP ligthweight whatever is best implemented here things) to some from the trench real project end to end considerations.<br />
Obviously lightweight approaches and Open Source do play a key role in the whole picture, both with pros and cons.</p>

<p>So FOSS - free as in free beer? Really? The world is obviously more complex than that.</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2006-01-13T16:26:21+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/001281_spring_2x_innovation_or_maturity.html">
<title>Spring 2.x -  innovation or maturity?</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/001281_spring_2x_innovation_or_maturity.html</link>
<description><![CDATA[<p>
Last week I had the pleasure to discuss some more with the Spring team at <a href="http://www.javapolis.com">JavaPolis</a>, and I was thus given a quick informal update on what they are heading at in Spring 2.x,  especially on the AOP side, discussing with <a href="http://blog.springframework.com/rod/">Rod</a> and <a href="http://blog.springframework.com/rob/">Rob</a>.
</p>

<p>
Spring AOP in Spring 1.x has been easy to use - though missing a good pointcut language. This simplicity is well described in a recent article on dev2dev by <a href="http://dev2dev.bea.com/pub/a/2005/12/spring-aop-with-ejb.html">Eugene</a>, and I had debated this issue and tried to solve it with <a href="http://blogs.codehaus.org/people/avasseur/archives/000961_spring_pointcut_on_steroids.html">Spring pointcuts on steroids with AspectWerkz</a>.
</p>

<p>
In Spring 2.x, with the help of newly appointed excellent <a href="http://www.aspectprogrammer.org/blogs/adrian/">Adrian Coyler</a> as chief scientist, my AspectJ lead peer, Spring AOP will unleash AspectJ and <a href="http://eclipse.org/aspectj/doc/released/adk15notebook/ataspectj.html">@AspectJ</a> that I spent quite some time on this year as per our engagement to merge best of breed AspectWerkz with AspectJ.
</p>

<p>
But going beyond, Spring 2.x also introduces a way to define aspects in your spring bean xml files directly f.e.:
<code language="java">
		<aop:aspect id="countAgeCalls" ref="countingAdvice">
			<aop:pointcut id="setCalls" expression="execution(* *..ITestBean.set*(..))"/>
			<aop:advice pointcut="execution(* *..ITestBean.set*(..))" method="myBeforeAdvice" kind="before"/>
			<aop:advice pointcut-ref="setCalls" method="myAfterAdvice" kind="after"/>
			<aop:advice pointcut-ref="setCalls" method="myAroundAdvice" kind="around"/>
		</aop:aspect>
</code>
</p>

<p>
This is actually a really nice feature that I started playing with 2 years ago when implementing AspectWerkz with <a href="http://www.jonasboner.com">Jonas</a>. So there is not much innovation there.
</p>
<p>
There might actually be some issues and hard work going forward. By having aspects defined this way, the AspectJ runtime that is used when your are using the excellent <a href="http://www.eclipse.org/ajdt/">AJDT Eclipse Plugin for AspectJ</a> will not take those into account (whilst regular @AspectJ ones are fully supported).
</p>
<p>
This means there 'll be definitely a need to open-up some more AJDT and have some extension point in it so that the Spring IDE can leverage it and have the AJDT crosscutting view display the Spring xml defined aspect.
</p>
<p>
Wups - <a href="http://blogs.codehaus.org/people/jboner/archives/000065_aspectwerkz_ruthlessly_refactored.html">xml defined aspect</a> I have said - just like this June 2003' Jonas article introduces, back in AspectWerkz 0.6.3
</p>
<p>
Maturity - finally!
</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-12-23T10:57:12+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/001120_javaone_2005_aop_distributed_java_and_more.html">
<title>JavaOne 2005 - AOP, distributed Java, and more</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/001120_javaone_2005_aop_distributed_java_and_more.html</link>
<description><![CDATA[<p>I thought it would be interesting to post what kind of session and BOF I am planning to attend during <a href="http://java.sun.com/javaone/">JavaOne 2005</a> next week.</p>

<p>There are indeed interesting trends going on, and needless to say I don't really want to hear that the EJB (3) XML deployment descriptors are back or that kind of things. Instead, AOP, Annotations and distributed architectures will get my interest.</p>

<ul>
<li>
BOF-9888, Chasing 9s: Modeling and Measuring Availability of J2EE™ Applications (Sun, monday 7h30 PM)
</li>
<li>
TS-7659, Runtime Aspects With JVM™ Support (BEA JRockit off course, Tuesday 11h AM - <a href="http://blogs.codehaus.org/people/avasseur/archives/001107_jrockit_aop_and_aspectj_5_and_javaone_2005.html">don't miss it ! and meet us at the BEA and Eclipse booth</a>)
</li>
<li>
TS-7695, The Spring Framework: Introduction to Lightweight J2EE™ Architecture (Interface21, Tuesday 11h AM)
</li>
<li>
 TS-7212, Clustering, Consistency, and Caching: An Implementor's View of JSR 107 [JCache] (BEA, Tuesday 01h30 PM)
</li>
<li>
TS-7159, Java™ Platform Clustering: Present and Future (Sun, Tuesday 2h45 PM) (don't miss it, it is a sneak from Sun research labs, about transparent clustering)
</li>
<li>
BOF-9385, Apt Usage of APT: When and How to Use the Annotation Processing Tool (Chariot Solutions, Tuesday 7h30 PM) (I know they will give a quote to <a href="http://aspectj.org">AspectJ</a>)
</li>
<li>
BOF-9161, Exploring Annotation-Based Programming Through the APT and Mirror APIs (BEA/Sun, Tuesday 9h30 PM) (ha ! Annotations that drove <a href="http://aspectwerkz.codehaus.org">AspectWerkz</a> for a while)
</li>
<li>
BOF-9441, Practical Application of Aspects in Everyday Development (ALTERthought, Tuesday 10h30 PM) (AOP from the users - an evidence of adoption phases as regards AOP)
</li>
<li>
TS-5471, Jini™ and JavaSpaces™ Technologies on Wall Street (JPMorgan, GigaSpaces,others, Wednesday 11h AM)
</li>
<li>
TS-7429, Speculative Locking: Breaking the Scale Barrier (Azul, Wednesday 4h PM)
</li>
<li>
TS-7410, Network Attached Processing: Tapping 384-Way SMP, 256GB Java™ Technology Compute Bricks (Azul, Thursday 1h15 PM)
</li>
<li>
TS-7339, Data Grids for J2EE™ Platform Cluster Deployments (GemStone, Thursday 3h45 PM)
</li>
</ul>

<p>See you there !</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-06-22T18:06:28+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/001100_java_open_source_playing_with_sharks.html">
<title>Java Open Source playing with sharks</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/001100_java_open_source_playing_with_sharks.html</link>
<description><![CDATA[<p>As a person largely involved in the Java Open Source landscape, I have been observing radical changes during the last 5 years in this area, and the <a href="http://www.theserverside.com/news/thread.tss?thread_id=34249">5 years birthday of Struts</a> makes me comment it some.</p>

<p>Five years ago, I was starting my own Struts clone for PHP to try to bring an MVC model to the rather new PHP OO stack I was using on a customer site. This project ended up pretty much nowhere (e-php on SF) since, well..., I could luckily do something way more interesting.<br />
But back at that time it was rather simple to start a small Open Source project and try to have it grow. Some were actually even considering you as a strange beast when you happened to be part of that world, one of my former employer beeing the first.</p>

<p>At that time, I also remember sales folks arguing that a Java developer had to have <b>"fluent in Struts"</b> in their resume to actually be a good Java Joe developer (before that you had to have "fluent in Javascript" in their mind, so we had made a big progress for the IT consultants thanks to Struts ;-) )</p>

<p>Most of the (good) Java Joe developers where using Apache projects from the Jakarta line mainly as their sole Open Source use in corporate projects, and Tomcat was pretty much the sole Open Source container that you could find in production.</p>

<p>At that time JBoss started to change the game by grabbing several Open Source fames and projects on board (Tomcat, and then Hibernate to name the most famous).<br />
Back in 2002, it became fairly common to see <b>"JBoss knowledge is a plus"</b> in job descriptions for IT consultants. Open Source had started to play with sharks, and you had to play with it, following the "fluent in Struts" move.</p>

<p>Next in the pie, Eclipse went bigger and bigger, and Open Source projects that were used and presented in conferences were more and more backed by someone that could afford it.<br />
At that time I boosted <a href="http://aspectwerkz.codehaus.org">AspectWerkz</a> by joining Jonas' first iterations, all that on my spare time, unpaid, for the fun of it, as most of the OSS committers, bringing my little Open Source load time weaving framework that I had started some month before (beSee on SF).</p>

<p>AOP and IoC started to gain in popularity, and Spring was doing its first moves. It became common to see <b>"fluent in Hibernate"</b> in job description, and I remember the first time I actually noticed it was in february 2003.</p>

<p>I have been pushing the AOP ball since that time as part of my BEA job, and  Open Source was more and more playing with sharks. AspectWerkz was backed by BEA, AspectJ revealed to be largely backed by IBM as an Eclipse technology project, and sucessfull projects that you could hear about in conferences where almost all backed by a shark - be it a big open source community like Apache, Eclipse, ObjectWeb that can afford its own events, or by a commercial vendor like BEA, IBM or JBoss.<br />
Even more, some projects happens to be backed by more than one shark. AspectWerkz and AspectJ is an evidence of it thru the <a href="http://aspectj.org">AspectJ 5</a> merger.</p>

<p>Back in 2004 the Spring fame became a shark by its own thanks to a well shapped service model around Rod' Interface21, that obviously adressed (and still adresses) Java Joe developer needs.</p>

<p>Last year I was wondering when I would see a <b>"fluent in Spring"</b> requirement in an IT job description, and it happened this morning, on the same line as "Tomcat, JBoss, Hibernate" for a "challenging J2EE architect opportunity" (<a href="http://offres.monster.fr/getjob.asp?JobID=30620015&WT.mc_n=MKT000125">interested?</a>). </p>

<p>I have the feeling that Open Source will not be anymore this hectic group of people working for free for the fun of it as that sound to be back in 2000. Open Source is becoming more and more a distribution channel or a big thing to take into account when thinking about return on investment. If you look closely at some open source projects, you 'll also realize that it is rather common that 80% if not more of the workload is handled by a group of people sitting on the same open space.</p>

<p>The recent <a href="http://www-1.ibm.com/press/PressServletForm.wss?MenuChoice=pressreleases&TemplateName=ShowPressReleaseTemplate&SelectString=t1.docunid=7658&TableName=DataheadApplicationClass&SESSIONKEY=any&WindowTitle=Press+Release&STATUS=publish">deal (backed by concrete M$) done around Geronimo</a> (project that was already backed by Apache) is yet another evidence. Open Source is playing with sharks, so you'd better love that. And if you do want to kickstart an Open Source project, you'd better think which shark will play with you if you want your jewel idea to sustain.</p>

<p>As a last evidence, almost every single IT service company in France finally spinned of an official department dedicated to Open Source, bridging  the gap with "SSLL" models (french acronym for open source service provider, doing consulting only on OSS stacks) . I have noticed this trend those last few months (Devoteam, Atos to name a few).<br />
This not to comment on the Eclipse phenomenon, with almost all software vendors joining it and shaping their product line in a new more or less anticipated direction.</p>

<p>Open Source is not anymore the thing you use to maximize revenues, or to make sure you recruit uptodate brains. It's the thing you have to play with straight within your strategy, no matter if you are a software vendor or an IT service company.</p>

<p>So what will be the next Open Source moves in the Java are(n)a ?<br />
Happy Open Source thoughts !</p>

<p>(note: dates in that post are those I remember and might be approximations. Aside, the job opportunities I am talking about are all for the French market, so you may expect some delta)</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-06-01T12:14:31+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/001002_ejb_3_and_aop_the_ejb_interceptor_dilemna.html">
<title>EJB 3 and AOP: the EJB interceptor dilemna</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/001002_ejb_3_and_aop_the_ejb_interceptor_dilemna.html</link>
<description><![CDATA[<p>
In this post I present an implementation a subset of the EJB 3 specification (JSR-220) : the EJB interceptors. As of today no EJB 3 preview brings an implementation that seamlessly integrates with AOP, despite the concept similarities.<br/>
The proposed implementation is fully runnable out of any container, and introduce a specific extension to allow use of pointcut in EJB interceptors, thanks to AspectWerkz extensible AOP container.<br/>
Wants to know more about EJB 3 interceptors,  and how they are closed to AOP or different from AOP ? Read more.
</p>

<p>
<b>Should we consider EJB interceptor as AOP ?</b>
</p>

<p>
As you may know, the <a href="http://www.jcp.org/en/jsr/detail?id=220">EJB 3 specification (JSR-220)</a> defines 

<b>Interceptors for EJBs (stateless, statefull and message-driven)</b>. If it might be a good idea to spread an answer 

for the need of addressing cross-cutting concerns in J2EE and EJBs in particular, it might be a bad idea to do it for 

those of us (more and more numerous) familiar with AOP implementations like <a href="http://aspectj.org">AspectJ</a> and 

<a href="http://aspectwerkz.codehaus.org">AspectWerkz</a>, especially because huge limitations of what the specification 

allows us to do with those interceptors - at first sight and excluding any vendor specific extension.
</p>

<p>
The most anti-AOP concept in the specification is that the EJB that wants interceptor have to declare it explicitly 

using a @javax.ejb.Interceptor or @javax.ejb.Interceptors class level annotation - which breaks the obliviousness of 

aspects. That in favor of making things explicit, which might be good for J2EE users.
</p>

<p>
Further on, the EJB bean itself can have a method that intercept its own business method ie <i>the bean is the 

aspect</i> (that sounds like marketing isn'it ?). Well. That's a specification and is interesting in the sense that it 

democratize a technology.
So what can we do to democratize AOP as part of the EJB 3 specification ?
</p>

<code language="java">
@javax.ejb.Stateless
@javax.ejb.Interceptor("test.ejb3.MyInterceptor")
public class MyEJBIsTheAspect {

    // business method
    public int businessSum(int i, int j) {
        return i + j;
    }

    // interceptor method within the bean (the bean is the aspect)
    @javax.ejb.AroundInvoke
    public Object interceptMySelf(InvocationContext ctx) throws Exception {
        System.out.println("--> MyEJBIsTheAspect.interceptMySelf");
        System.out.println("  method: " + ctx.getMethod());
        for (int i = 0; i < ctx.getParameters().length; i++) {
            Object o = ctx.getParameters()[i];
            System.out.println("  args["+i+"]: " + o);
        }
        return ctx.proceed();
    }

}
</code>

<p>
<b>State of the art (not that much..) in JBoss and Oracle AS EJB 3 preview</b>
</p>

<p>
After having a look at <a href="http://jboss.org">JBoss EJB 3</a> and <a 

href="http://www.oracle.com/technology/tech/java/ejb30.html">OracleAS EJB 3</a> previews, I was even more disapointed. 

Both of them are <b>using a reflective based approach to invoke the interceptors</b>. This means that 

the performance of the interceptor will be bad, and that a <a 

href="http://www.aip.org/history/heisenberg/p08.htm">Heisenberg</a> effect will be inevitable and actually fairly big 

(no wonder that ones will use interceptor to gather performance metrics and thus as soon as you observe the bean, you 

are observing a different things than what actually happens).
</p>

<p>
Ones may say this is a microscopic view. It is. But when thinking about EJB 2 stories in the past a sound idea would be 

to make sure we don't waste resources where we can avoid it. And thinking about JBoss history around AOP, that's rather 

suprising that the EJB 3 interceptors are not cleanly integrated in their AOP framework. I personnaly consider that we 

have enough technology around to make it far better, and far more consistent with AOP. Given the impact that AOP will 

continue to have, ones would better figuring out how to do that now with EJB 3 - assuming that EJB 3 succeeds.
</p>

<p>
<b>AspectWerkz extensible container value proposal to EJB 3 interceptors</b>
</p>

<p>
I decided to give it a try with the <b>AspectWerkz extensible container</b>. As Jonas Bonér described it in a <a 

href="http://www.theserverside.com/articles/article.tss?l=AspectWerkzP1">TSS article</a>, AspectWerkz can be considered 

as a generic AOP runtime platform, in which ones can hook in any kind of AOP/AOP like programming model. AspectWerkz 

aspects are one, AspectJ aspects are another, and we have implementations for Spring AOP and AOP Alliance aspects. An 

<i>AspectModel</i> answers three essential properties: <i>what is the life cycle of the aspect</i>, <i>how to invoke 

it</i> and <i>how the programming model exposes the closure with wich the user proceed</i>.
</p>

<p>
It happens that <b>the EJB 3 interceptor can be seen as a very simple AOP programming model</b> in two ways:
<ul>
<li>ones can define interceptor class. An interceptor (advice) is thus a @javax.ejb.AroundInvoke annotated method with a 

specific signature (no interface, no mandatory method name) within a class - the interceptor class (aspect).</li>
<li>ones can define a @javax.ejb.AroundInvoke annotated method (advice) in the EJB itself (aspect): <b>the bean is the 

aspect !</b></li>
<li>the closure is defined with the interface javax.ejb.InvocationContext</li>
</ul>
</p>

<code language="java">
public interface javax.ejb.InvocationContext {
	public Object getBean();
	public Method getMethod();
	public Object[] getParameters();
	public void setParameters(Object[]);
	public Context getEJBContext();
	public java.util.Map getContextData();

	public Object proceed() throws Exception;
}
</code>

<p>
The value proposal I am bringing here with the AspectWerkz extensible container is the following:
<ul>
<li>no reflection at all. See performance figure f.e at our <a 

href="http://docs.codehaus.org/display/AW/AOP+Benchmark">benchmark site</a></li>
<li>seamless integration of the interceptors with the aspects. They are made "aspect" thanks to AspectWerkz and the 

other aspect model (AspectWerkz aspect, AspectJ aspect, whatever aspect model registered in the runtime) coexists 

nicely</li>
<li>easy points for vendor specific extension:<ul>
    <li>real pointcut to narrow the matching of an interceptor method to a very precise set of bean methods</li>
    <li>life cycle control for the interceptor class</li>
    <li>supporting cflow(), args() and alike AOP semantics</li>
    <li>introducing high performant hot deployment and undeployment of EJB interceptors</li>
    </ul></li>
<li>"out of container" runtime available</li>
<li>rich integration patterns: application preparation (like ejbc / appc for faster deployment) or seamless 

deployment</li>
</ul>
</p>

<p>
<b>AspectWerkz extensible container details</b>
</p>

<p>
To better understand how things will looks like, you need some background in AspectWerkz:
</p>

<p>
The first key part is "org.codehaus.aspectwerkz.transform.inlining.spi.AspectModel". <b>We will provide two 

implementations of it</b>. One for interceptor class (the interceptor class is the aspect), and one for bean as 

interceptor (the bean is the aspect).
The second key part is in integrating the EJB interceptor closure "InvocationContext" that defines the "proceed()" 

method with the more general idea of "Joinpoint.proceed()" of the runtime. In short, this means that the interceptor 

will be entirely part of the aspect chain, and if there is a transaction aspect to handle EJB transaction boundaries, 

they will share the very same chain - as ones expects - thus making it easy for the implementation to organize 

precedence rules (as define in section 3.5.1 of JSR 220 for example).
As we already wrote this transaction aspect for EJB 3 in a previous <a 

href="http://www.theserverside.com/articles/article.tss?l=AspectWerkzP2">AspectWerkz TSS tutorial</a>, that's rather a 

simple idea and basic requirement.
</p>

<p>
The runtime will take care of aggregating the models depending on which aspect apply to which join point, each aspect 

having its specific AspectModel and each AspectModel implementation being responsible for generating what it needs:
</p>

<code language="java">
// a closure to deal with the join points
// ie models org.codehaus.aspectwerkz.joinpoint.JoinPoint interface
// to fit with the transaction aspect, or any other aspect
// and javax.ejb.InvocationContext to fit EJB3 interceptors
 class jitEJB3Closure implements JoinPoint, InvocationContex  
 {
    
    // the closure hosts state, optimization makes it more complex than that

    // the target of the join point ie the intercepted ejb
    // which is also third aspect: remember the bean is the aspect !
    private MyEJBIsTheAspect target;

    // first aspect in the chain, statically compiled
    private TXAspect aspect_0;

    // second aspect: the interceptor class
    private MyInterceptor aspect_1;           
  
    // details skipped that makes those fields initalized as they should.

    // as defined in javax.ejb.InvocationContext
    public Method getMethod() {...}             

    // as defined in JoinPoint
    public Class getTargetClass {...}           

    // other methods as per each aspect model affecting the join point
    ...

    // generic proceed() method as defined in JoinPoint and InvocationContext
    public Object proceed() throws Throwable    
    {
        // sort of a loop to proceed with the advice chain
        
        // case first round: TX aspect
        // TX aspect
        // as defined in the "AspectWerkzAspectModel implements AspectModel"
	aspect_0.manageTX(this) 
        // "this" is considered as the JoinPoint instance

        ...

        // case second round: interceptor class
        // as defined in the yet to be written
        // "EJBInterceptorModel  implements AspectModel"
	aspect_1.someNameOfYourChoice(this)        
        // "this" is considered as the InvocationContext instance
        
        ...

        // case third round: the bean is the aspect
        // as defined in the yet to be written
        //  "EJBIsTheAspectModel implements AspectModel"
	target.interceptMyself(this)
        // "this" is considered as the InvocationContext instance
        ...
     }

   }
</code>

<p>
That may sound a bit of gory details, but that's actually simple once you get the idea of this closure acting for 

multiple AspectModel in mind. The code is actually <b>15O lines for the interceptor class model (EJBInterceptorModel) 

and 25 lines for the bean is the aspect model (EJBIsTheAspectModel)</b> thanks to some inheritance. It mainly deals with 
<ul>
<li>generating the InvocationContext methods (like getMethod(), getParameters())</li>
<li>dealing with the EJB 3 aspect life cycle ie<ul><li>
	push the EJB instance on stack for the EJBIsTheAspectModel</li>
	<li>create an interceptor class instance, bookeep it and push it on stack for the EJBInterceptorModel (as the spec 

does not specifies the life cycle, I will use a singleton model).</li>
</ul></li></ul>
</p>

<p>
<b>What about the deployment ?</b>
</p>

<p>
I presented the runtime, but there is an interesting topic as well: the deployment. AspectWerkz pioneered the aop.xml to 

define which
aspects are affecting the system. Obviously, we don't want that for EJB interceptor. We need to use the AspectWerkz API 

to register what we need in the system. The interesting concept here is that we will transform <b>what the EJB 

specification defines thanks to annotation (@javax.ejb.Interceptor, @javax.ejb.Interceptors, @javax.ejb.AroundInvoke) in 

real AOP pointcut that the AOP container understand</b>.
That is where a vendor may easily hook in an extension (ie introduce a new annotation for example) to refine the 

interceptor class life cycle, or to introduce a pointcut.
</p>

<p>
I am defining a class that will expose an API that will hide the AOP registration from the user or from the other parts 

of our spec. implementation.
</p>

<code language="java">
public class EJBInterceptorDeployer {

   public static void deploy(String ejbClassName, ClassLoader loader) {
      // step 1 - interceptor class
      
      // read the ejbClass @Interceptor and @Interceptors class level annotation
      // for each interceptor class name found as value of those annotation
      //     get the @AroundInvoke method information
      //     deploy an aspect
      //         using the EJBInterceptorModel
      //         to the pointcut : "execution(!@javax.ejb.AroundInvoke !static * " + ejbClassName + ".*(..))"
      //
      
      // step 2 - @AroundInvoke method of the bean itself
      // find the @AroundInvoke method if any
      // deploy an aspect
      // 	using the EJBIsTheAspectModel
      //	to the same pointcut
      
   }

 // method making use of AspectWerkz aspect deployment API

}
</code>

<p>
The thing to note about the deployer is that it is not using reflection. It is f.e. using our <a 

href="http://backport175.codehaus.org/">BackPort175</a> implementation to read the EJB annotations from the bytecode. If 

we were not doing so, we would trigger the EJB class loading while our system is not yet defined,
and the weaver would not be able to do the job when using load-time weaving approaches.
</p>

<p>
<b>What about running the system ?</b>
</p>

<p>
In the sample application, I am deploying the EJB using the EJBInterceptorDeployer presented in the previous section.
In a full blown container I would hook the call to it when the application or EJB deployer would register the EJB in the 

system.
The nice thing is that I can run my EJB and still have the interceptors when running as a standalone application by 

using AspectWerkz load time weaving, and a simple static block to declare which class is an EJB.
</p>

<p>
The sample application can be run with (for ones familiar with AspectWerkz, there is no aop.xml..)
</p>

<code language="java">
java -javaagent:lib\aspectwerkz-jdk5-2.0.jar test.ejb3.Sample
</code>

<code language="java">
public class Sample {

    static {
        EJBInterceptorDeployer.deploy("test.ejb3.MyEJBIsTheAspect", Sample.class.getClassLoader());
    }

    public static void main(String args[]) throws Throwable {
        // some one would do a lookup or inject for that when in the container
        MyEJBIsTheAspect myEjb = new MyEJBIsTheAspect();

        System.out.println("Calling the EJB");
        int i = myEjb.businessSum(1, 2);
        System.out.println("got : " + i);
    }
}
</code>

<code language="java">
AW EJB3 - Deploying test.ejb3.MyInterceptor for test.ejb3.MyEJBIsTheAspect
AW EJB3 - Deploying test.ejb3.MyEJBIsTheAspect for test.ejb3.MyEJBIsTheAspect
Calling the EJB
--> MyInterceptor.interceptStandalone
  method: public int test.ejb3.MyEJBIsTheAspect.businessSum(int,int)
  args[0]: 1
  args[1]: 2
--> MyEJBIsTheAspect.interceptMySelf
  method: public int test.ejb3.MyEJBIsTheAspect.businessSum(int,int)
  args[0]: 1
  args[1]: 2
got : 3
</code>


<p>
<b>Conclusion</b>
</p>

<p>
Though at first glance I found the interceptor part of the EJB 3 specification fairly odd, and was a bit sad that some 

important AOP concepts like precedence and aspect life cycle, as well as expressiveness of the pointcut language are 

completely sacrified, I must admit that it might help ones familiarize with AOP concepts.
</p>

<p>
It took 1h to implement the EJB 3 interceptor spec and have it perfectly integrated with AOP - unlike so far exposed EJB 

3 previews by JBoss and Oracle (though those are actual preview, while this article is more a technology focus and 

positionning).
It took 15 minutes more to implement a pointcut extension thru a new @org.codehaus.aspectwerkz.ejb3.AroundInvokeAOP 

annotation, that allows me to reuse the expressiveness of the pointcuts ie a vendor extension:
</p>

<code language="java">
public class MyInterceptor {

    @AroundInvoke
    @AroundInvokeAOP("execution(* *.businessSum(..))")
    public Object interceptStandalone(InvocationContext ctx) throws Exception {
        System.out.println("--> MyInterceptor.interceptStandalone");
        System.out.println("  method: " + ctx.getMethod());
        for (int i = 0; i < ctx.getParameters().length; i++) {
            Object o = ctx.getParameters()[i];
            System.out.println("  args["+i+"]: " + o);
        }
        return ctx.proceed();
    }
}
</code>

<p>
Some more time would allow me to have further features, like f.e. supporting cflow and args pointcut, so that an 

interceptor may look like an advice as it looks like in AspectWerkz aspects, with static access to intercepted method 

arguments etc (ie no boxing in an Object[] array).
</p>

<p>
A next iteration would be to integrate with the AspectWerkz hot deployment feature, and this would bring in hot 

deployment of EJB interceptors at no cost - while still having everything statically compiled for the runtime to perform 

at its best.
</p>

<p>
This implementation may seems at first glance full of details, and perhaps like a hammer to address a simple part of the 

spec. I don't think so. I think <b>it address the very crucial point that so far everyone has skept</b> - including 

JBoss folks (that have a foot in the AOP trench): <b>it integrates seamlessly with the aspects and AOP concepts, and 

actually allow advanced user to apply more advanced AOP concepts as well ie bridging the gap between a commercial 

concept and needs (EJB interception) and a sound concept backed by years of research (AOP and cross-cutting)</b>.
</p>

<p>
So which vendor will be the first to have its EJB play well with AOP : like applying an interceptor thru a real 

pointcut, defining programmatic precedence etc, dealing with cflow and hotdeployment of interceptors, and all that with 

an implementation that can scale ?
</p>

<p>
<b>Want the source code ?</b>
This one is part of AspectWerkz CVS.
It can be browsed from <a 

href="http://cvs.aspectwerkz.codehaus.org/viewrep/aspectwerkz/aspectwerkz4/src/compiler-extensions/ejb3">here</a>.
</p>

<br/>
<br/>

<small>
<p>
Side note: my feedback on the specication:
</p>

<p>
There are some odd things in the 3.5 section of the JSR-220 that I have spot:
<ul><li>
- (sect. 3.5.1) an interceptor class or EJB can <i>only have one single</i> @AroundInvoke method (advice) in it, and its 

signature is (sect. 3.5.4) "@AroundInvoke Object someNameOfYourChoice(InvocationContext ctx) throws Exception". Why 

limitating that to having one single method in the interceptor class or EJB (sect. 3.5.1). My guess is that it is tied 

to the fact that precedence between advice would then be harder to define in the spec without new semantics.
Then one might wonder <i>why an interceptor is not defined as an interface</i> with one single method "intercept(...)" 

that the EJB could implement as well. Having this interface would suppress the need for @AroundInvoke which sounds like 

an annotation overuse (unless it is a door open for vendor extension as I will do below..). I'll be interested in EG 

feedback on that topic, especially in regards of the first limitation.
</li><li>
- interceptor components <i>life cycle</i> is unspecified but stateless. That sounds like a very important and powerfull 

concept of AOP (especially AspectJ) that has been left aside. It is probably an interesting door to provide vendor 

specific extension ie thread safe interceptor, per bean class interceptor, per bean instance interceptor, per 

application interceptor etc (but then interceptor component may not be stateless anymore.)
</li><li>
- (3.5) an interceptor intercepts all business method (or MessageListener methods for MDB). This means that every 

interceptor will be poluted with a code snip like "if (invocationContext.getMethod().getName().equals("doSomething")) 

..." ie ones will have to write sort of a pointcut in a very loosy way while AOP allow us to write that in a neat way 

(and further, a way that tools can easy understand to spot which method is intercepted by what).
</li><li>
- javax.ejb.InvocationContext is tied to EJB. What will happen when interceptors will end up somewhere else ?
</li></ul>
</p>

<p>
Fortunately, the implementation exposed in this article addresses those issues nicely from a vendor specific extension 

perspective.
</p>
</small>

<small>
<p>
Note: These are my own thoughts and not of my employer ..
</p>
</small>

]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-04-14T16:50:08+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000993_bea_joins_eclipse.html">
<title>BEA joins Eclipse</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000993_bea_joins_eclipse.html</link>
<description><![CDATA[<p>That's an exciting time for BEA.</p>

<p>We now have announced we are joining <a href="http://eclipse.org">Eclipse</a> with a number of interesting things in the pipe, ranging from <b>AOP</b> with the AspectWerkz/AspectJ effort leading to <a href="http://eclipse.org/aspectj">AspectJ 5</a>, to the <b>IDE part</b> that will shape up BEA WorkShop, and leading positions in the <b>Web Tools Platform</b>, and in the <b>JDT compiler</b> area.</p>

<p>Things were a bit odd when we shipped an <a href="http://blogs.codehaus.org/people/avasseur/archives/000923_aspectwerkz_aop_eclipse_plugin.html">AspectWerkz Eclispe plugin</a> some month ago, since everyone out there was thinking that there was a death match between <a href="http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/workshop">BEA WorkShop</a> and Eclipse... Didn't you thought that way ?</p>

<p>And don't say we have started to sneak in randomly just to catch up. Things are now ranging from the JVM with AOP work going on within <a href="http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/jrockit">JRockit</a> up to the IDE...</p>

<p>Read the news<br />
<a href="http://biz.yahoo.com/prnews/050222/sftu152_1.html">http://biz.yahoo.com/prnews/050222/sftu152_1.html</a></p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-02-23T17:14:23+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000991_junit_test_cases_and_number_of_tests_.html">
<title>JUnit Test cases and number of tests ?</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000991_junit_test_cases_and_number_of_tests_.html</link>
<description><![CDATA[<p>Last time I was reading about a project, folks were arguing they had many many tests.</p>

<p>But what is exactly this measurement ? Do we have to count the number of classes that extend <code>JUnit TestCase</code>, or the number of <code>test*(..)</code> methods, or the number of calls to JUnit <code>assert*(..)</code> ?</p>

<p>The current figures for AspectWerkz are pretty much those one:<br />
- 92 extends TestCase<br />
- 544 test*() methods<br />
- 1380 calls to assert*(..)</p>

<p>Off course, what would matter would be the coverage (that has several definitions as well), but still, the number of test in an interesting thing to define.</p>

<p>So how many tests do I have ?</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-02-22T15:26:33+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000986_writting_idea_plugins.html">
<title>Writting IDEA plugins</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000986_writting_idea_plugins.html</link>
<description><![CDATA[<p>Today Jonas and I shipped <a href="http://backport175.codehaus.org">Backport175</a>, a back port of the JSR-175, the Java 5 Annotations spec.</p>

<p>This project comes with an Eclipse plugin and an IDEA plugin, so its time to say something about <a href="http://www.jetbrains.com/idea/">IDEA</a>...</p>

<p>I just like the architecture of the IDEA plugins. There is <b>very few docs</b> on the topic, some very bad javadoc, and some samples around but no books yet etc.<br />
Anyway, you can find some help on the <a href="http://www.intellij.net/forums/index.jsp?cat=8">IDEA forums</a>, and guys like the <a href="http://groovy.codehaus.org/IDEA's+OpenAPI+tips">Groovy</a> ones have written plugins as well, so you can find a bunch of code around.</p>

<p>The nice thing in IDEA plugins is that it s just code, a rather clear API, and a bit of IOC (IDEA is using <a href="http://www.picocontainer.org/">PicoContainer</a>). A plugin as just one XML descriptor.<br />
For an Eclipse plugin, you need a lot of XML, find what are the extension point, and dig in the docs and books, and get familiar with the Eclipse plugin wizardry. The game is very different, while for IDEA, it s just an API that you have to get familiar with.</p>

<p>What is missing the most in IDEA v4 is a <b>good plugin project wizard</b>, but if you have the chance to give a try to IDEA IRIDA, the <a href="http://intellij.net/auth.jsp">EAP</a> of the upcoming v5, then you have it, and it's as easy to debug your plugin as it is for a regular app.<br />
The great thing with IDEA is that you can write a very small Ant script to build the plugin. I would not even try to go there for Eclipse (perhaps I am wrong ...).</p>

<p>You can probably learn some in that space by comparing both Backport175 plugins. It will leads you thru<br />
- how to have a menu of your own to add / remove the feature to a given project (nature / actions and menu)<br />
- how to hook in in the build system (builder / compilation listener) <br />
- how to deal with markers</p>

<p>Off course, it is probably not the correct design neither for Eclipse nor for IDEA (I am far from beeing efficient in that plugin area) but it seems to do the job.</p>

<p><a href="http://cvs.backport175.codehaus.org/viewrep/backport175/intellij">IDEA plugin CVS</a><br />
<a href="http://cvs.backport175.codehaus.org/viewrep/backport175/eclipse">Eclipse plugin CVS</a></p>

<p>Thanks to JetBrains to allow free use of IDEA for OSS projects !</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2005-02-15T18:02:15+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000727_see_you_at_eworld.html">
<title>See you at eWorld</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000727_see_you_at_eworld.html</link>
<description><![CDATA[<p>I am moving to San Francisco for <a href="http://www.bea.com/eworld/index.htm">BEA eWorld</a>.</p>

<p>Jonas and I will give several sessions / demos about AOP in BEA JRockit and the BEA WebLogic Platform, including WebLogic Server and WebLogic WorkShop.</p>

<p>In case you are in the area but do not attend to eWorld, just join the <a href="http://dev2dev.bea.com/community/usergroups/sv.jsp">Silicon Valley BEA User Group</a> since we will be there on wedsnesday as well.</p>

<p>We have been under the radar since AOSD, so be ready for something disruptive !<br />
I will post a viewlet of some parts of the demo in some weeks.</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2004-05-20T13:56:45+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000607_its_life.html">
<title>It&apos;s life</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000607_its_life.html</link>
<description><![CDATA[<p>Most of my blog' fans (do I have blog fans ?) might think I am hacking AOP constructs and weaving architecture all the day.</p>

<p>Well I have to admit that this is not exactly true, thought almost true ;-).</p>

<p>These days I had to hack a small app that gather data from a WebLogic Server farm (more than 60 servers) by querying runtime JMX mbean so that we can then generate some graph to feed a NOC intranet.<br />
Rather simple to play with JMX, have a fault tolerant client that does not crash when one instance is downed, and be able to handle at least 10 Go log daily.</p>

<p>For now the logs are parsed and consolidated as regular file. I would have liked to use a MySQL or HSQL database instead of parsing Go of files... but well, it is a customer driven story.</p>

<p>Here is a pretty cool graph that I got using <a href="http://www.jfree.org/jfreechart/index.html">JFreeChart</a> that shows some http session data history grabbed from a subset of the farm.<br />
Fun ?</p>

<p><a href="http://blogs.codehaus.org/people/avasseur/downloads/20040217_graph_session.html" onclick="window.open('http://blogs.codehaus.org/people/avasseur/downloads/20040217_graph_session.html','popup','width=1600,height=1170,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img alt="Click to enlarge" src="http://blogs.codehaus.org/people/avasseur/downloads/20040217_graph_session_small.jpg" width="400" height="292" border="0" /><br />
</a></p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2004-02-17T13:02:46+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000235_threadlocal_and_memory_leaks.html">
<title>ThreadLocal and memory leaks</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000235_threadlocal_and_memory_leaks.html</link>
<description><![CDATA[<p>Last day I realized that using <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/ThreadLocal.html">ThreadLocal</a> can be very dangerous when it comes to long running applications and garbage collections.</p>

<p>When you read the documentation of the ThreadLocal, you read that the object put in a ThreadLocal context is associated to the thread, and will be garbaged once the thread is dead.</p>

<p><i><br />
Each thread holds an implicit reference to its copy of a ThreadLocal as long as the thread is alive and the ThreadLocal object is accessible; after a thread goes away, all of its copies of ThreadLocal variables are subject to garbage collection (unless other references to these copies exist).<br />
</i></p>

<p>So if you use ThreadLocal to store some object instance there is a high risk to have the object stored in the thread local never garbaged when your app runs inside an app server like WebLogic Server, which manage a pool of working thread - even when the class that created this ThreadLocal instance is garbage collected.</p>

<p>To solve this issue, you will probably have to check for it first with a memory profiler tool like <a href="http://www.ej-technologies.com/products/jprofiler/overview.html">JProfiler</a>, and then wrap the value put in the ThreadLocal in a <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/ref/WeakReference.html">WeakReference</a>.</p>

<p>That did not appears to be obvious while reading the javadoc. Isn't it ?</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2003-11-03T12:14:39+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000107_besee_donated_to_aspectwerkz.html">
<title>beSee donated to AspectWerkz</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000107_besee_donated_to_aspectwerkz.html</link>
<description><![CDATA[<p>Past 6 month I have founded and developped the <a href="http://sourceforge.net/projects/besee">beSee </a>project. This project is now closed, but I am definitely happy since <b>the core architecture is now part of AspectWerkz</b>, founded by Jonas Boner, for which I am commiter.</p>

<p>AspectWerkz power will be unleashed in the next weeks, and let me explain why.</p>

<p>It all started with <a href="http://besee.sourceforge.net/besee-1-x/">beSee-1-x</a>. This project aimed to provide a runtime bytecode instrumentation solution for <b>BEA WebLogic Server</b> (v7), based on Javassist for bytecode instrumentation and BEA ClassPreProcessor feature, which allow to modify bytecode of <b>deployed</b> applications when they are loaded in the app server.<br />
beSee-1-x allowed easy instrumentation, based on a property file, and provided JMX management feature for hot configuration. It was easy to instrument on the fly some classes and run a load test on my app.</p>

<p>But there was something missing: BEA ClassPreProcessor does not allow instrumentation of core server classes or jvm wide component, like a JDBC driver, so I was unable to instrument enough my CMPs to track down SQL query being executed.</p>

<p>I started <a href="http://besee.sourceforge.net/">beSee-2-x</a> architecture. It provides a JVM wide PreProcessor hook, allowing to extend what BEA provided for deployed application to the whole JVM, and thus to any product running java (!).<br />
I knew JMangler add this kind of feature, but after some testing it appeared to be heavy and not that much stable as regards app server integration (let me know and I will send you some test case for it, and read more, you'll learn why).</p>

<p>So the main features of beSee-2-x I implemented are:<br />
- plugable JVM wide ClassPreProcessor mechanism for on the fly instrumentation<br />
- bytecode kit independancy (BCEL and Javassist provided, any other supported)<br />
- offline compiler (the AspectJ way)<br />
- performance wise:<br />
    - beSee-2-x does not requires JVM to run in debug mode (JMangler does)<br />
    - beSee-2-x is java 1.3 compatible (JMangler is not)<br />
    - beSee-2-x auto adapts behavior for java 1.3 and 1.4 (process forking or hotswapping)<br />
    - beSee-2-x allow to disable dual process, thus a standard java ... command to launch the target application to instrument on the fly is enough - no need for a wrapper script and stream piping in background (required when hotswap or process forking is used).</p>

<p>beSee-2-x allowed me to unleash the power of beSee-1-x to the whole weblogic, not just the deployed app.<br />
<b>And crucial point, its open architecture was ready to unleash power and capabilities of next generation AOP framework - and AspectWerkz is the one !</b></p>

<p>So stay tune. All those features are right now in AspectWerkz CVS, and in some weeks, you won't feel the pain to plug AOP in your whole architecture, on the fly or offline, and with its full power - no debug mode required, java 1.3 supported, optional process forking (choose between tuning and easy set-up), not tight to any app server but certified app server ready.</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2003-07-23T18:38:20+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000106_bcel_patch_submitted.html">
<title>BCEL patch submitted</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000106_bcel_patch_submitted.html</link>
<description><![CDATA[<p>I have submitted a patch for the BCEL thread safe issue I described (<a href="http://blogs.codehaus.org/people/avasseur/archives/000101.html">read</a>).</p>

<p>You'll find it on the BCEL dev mailing list archive. I am waiting for BCEL guy to put the patch in their CVS HEAD. For now you can whether incorporate the patch in the BCEL source and rebuild your own BCEL, or build a jar with only the two files I patched and put it in your classpath <b>before</b> the bcel.jar.</p>

<p>(<a href="http://www.mail-archive.com/bcel-dev@jakarta.apache.org/msg00218.html">read the post on the list archive</a>)</p>

<p>(<a href="http://www.mail-archive.com/bcel-dev@jakarta.apache.org/msg00218/patch-HEAD-threadsafe.zip">dowload the patch for BCEL 5.1</a>)</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2003-07-23T17:43:18+01:00</dc:date>
</item>
<item rdf:about="http://blogs.codehaus.org/people/avasseur/archives/000101_bcel_internal.html">
<title>BCEL internal</title>
<link>http://blogs.codehaus.org/people/avasseur/archives/000101_bcel_internal.html</link>
<description><![CDATA[<p>Using <a href="http://jakarta.apache.org/bcel/">BCEL</a> to do bytecode modification on a simple application I have, I encountered <b>problems with thread safety</b>. As soon as I got 2 threads instrumenting in parallel, the java Verifier begins to complains about generated method signatures.</p>

<p>I struggled half a day to find it out. Thread safety problem is not that easy to isolate. After some googling I found the following post on <a href="http://www.mail-archive.com/bcel-dev@jakarta.apache.org/msg00201.html">BCEL mailing lists</a></p>

<p>It appears that some of BCEL static class (org.apache.bcel.generic.Type and org.apache.bcel.classfile.Utiity at least), which should provides static method to compute human understandable signature from bytecode and vice-versa are miscoded.</p>

<p>If I understand that doing a thread safe application can be difficult, I am really thinking BCEL guy were lazy this time with a snip like</p>

<pre>
// sample purpose - pseudo code
package org.apache.bcel.classfile;

<p>public abstract class Utility {</p>

<p>    public static int consumed_chars;</p>

<p>    public static String[] methodSignatureArgumentTypes(String) {<br />
        loop {<br />
             // read and set consumed_chars field<br />
             consumed_chars++;<br />
        }<br />
    }</p>

<p>    public static String methodSignatureToString(String) {<br />
        loop {<br />
            // read and set consumed_chars field<br />
            consumed_chars++;<br />
        }<br />
    }</p>

<p>}<br />
</pre></p>

<p>As we can see its obvious it is non thread safe because its bad designed: two static methods are using the same static field as a temporary storage to perform string operations.</p>

<p>I had to wrap the <i>consumed_chars</i> in a <i>ThreadLocal</i> and replace all calls. It works fine, but I cannot be sure I covered all the bad design BCEL put in.</p>

<p>Guy, ok to say BCEL is not designed for thread safety in the FAQ. But please try to avoid such ugly coding.</p>

<p>Another option for me could be to add some <i>synchronized</i> in my instrumentation application - but it would be a hell from a performance point of view.<br />
Considering BCEL is used in app server modules (npulse, willy technology), it should be thread safe. In app server there is lots of classloading ocuring concurenlty (stub / skel generation, CMP impl at deployment time ...)</p>]]></description>
<dc:subject>Technology</dc:subject>
<dc:creator>avasseur</dc:creator>
<dc:date>2003-07-19T12:00:44+01:00</dc:date>
</item>


</rdf:RDF>
