<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7974209436265167833</id><updated>2010-08-26T02:01:35.988-07:00</updated><title type='text'>David Blevins' Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.dblevins.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>9</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-3957624728711763354</id><published>2010-07-16T14:18:00.000-07:00</published><updated>2010-07-16T15:21:39.739-07:00</updated><title type='text'>@ApplicationException is evil... sort of</title><content type='html'>&lt;p&gt;
Historically EJB has frowned on RuntimeExceptions.  Throwing them results in your transaction getting rolled back and your bean instance being immediately destroyed.  You're welcome to try your transaction again ... just as long as you weren't keeping your data in your @Stateful session bean, cause, you know, the container just destroyed that... hope you didn't need it to retry your commit.
&lt;/p&gt;
&lt;p&gt;
In EJB 3.0 the @ApplicationException type was added so that beans could throw RuntimeExceptions and not have their beans destroyed and have the choice to rollback any transaction in progress.  Great!  Only... how do you really use this for built-in exception types?  XML you say?  Yuk!
&lt;/p&gt;
&lt;pre&gt;
&amp;lt;ejb-jar&gt;
    &amp;lt;assembly-descriptor&gt;
        &amp;lt;application-exception&gt;java.lang.RuntimeExceptions&amp;lt;/application-exception&gt;
    &amp;lt;/assembly-descriptor&gt;
&amp;lt;/ejb-jar&gt;
&lt;/pre&gt;
&lt;p&gt;
And is the above even a good idea?  Definitely not!  With something like that you're just asking for trouble.  The bad part is that it effectively shuts off transaction exception handling for all beans in the entire application.  Currently, though, this is your only option.
&lt;/p&gt;
&lt;p&gt;
The problem is it is hard to use this annotation responsibly.  It's often too bold and too difficult to take the hard line that a specific exception type is always fine to throw.  It is completely lacking in pragmatism.  There is no ability for developers to make a more refined choice.
&lt;/p&gt;
&lt;p&gt;
Bottom line, it should be possible to specify how you would like a RuntimeException handled for a specific &lt;b&gt;bean&lt;/b&gt; or &lt;b&gt;method&lt;/b&gt;.  Imagine @ApplicationException where modified like so:
&lt;/p&gt;
&lt;pre&gt;
@java.lang.annotation.Target({TYPE, METHOD})
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public static @interface ApplicationException {
    Class value();

    boolean rollback() default false;
}
&lt;/pre&gt;
Now, we can do things a little more refined:
&lt;pre&gt;
@LocalBean
public static class OrangeBean {

    @ApplicationException(RuntimeException.class)
    public void doSomething() {

    }

    public void doSomethingElse() {
        
    }
}
&lt;/pre&gt;
&lt;p&gt;
In the above, the OrangeBean doSomething method would be allowed to throw a RuntimeException without a transaction rollback or the bean instance being destroyed.
&lt;/p&gt;
&lt;p&gt;
As well, the annotation could be placed on the class level.  Say we have an @Stateful bean that wraps an EXTENDED PersistenceContext so that business logic could more easily be done elsewhere, perhaps by an @Stateless bean that uses Bean-Managed Transactions and wishes to batch process several transactions against the EXTENDED persistence context in a loop:
&lt;/p&gt;
&lt;pre&gt;
@Stateful
@ApplicationException(javax.persistence.PersistenceException.class)
@TransactionAttribute(MANDATORY)
public static class EntityManagerWrapper implements EntityManager {

    @PersistenceContext(type = EXTENDED)
    private EntityManager delegate;

    @Override
    public void persist(Object o) {
        delegate.persist(o);
    }

    @Override
    public &lt;T&gt; T merge(T t) {
        return delegate.merge(t);
    }

    @Override
    public void remove(Object o) {
        delegate.remove(o);
    }

    @Override
    public &lt;T&gt; T find(Class&lt;T&gt; tClass, Object o) {
        return delegate.find(tClass, o);
    }

    //... and so on
}
&lt;/pre&gt;
&lt;p&gt;
The EntityManager API does not throw checked exceptions, only derivatives of javax.persistence.PersistenceException which is itself a RuntimeException.  To wrap an EntityManager the bean also need the ability to throw javax.persistence.PersistenceException without causing its destruction and transaction rollback.  In that vein, the bean is marked @TransactionAttribute(MANDATORY) so it isn't possible to use the bean without already having a transaction in progress, making it clear that transaction management is not it's responsibility.
&lt;/p&gt;
&lt;p&gt;
In another example, say we would like to create a bean that wishes not be destroyed when a RuntimeException is thrown, but it would still like the transactions it starts (via @TransactionAttribute(REQUIRES_NEW)) to be rolled back should a RuntimeException occur.
&lt;/p&gt;
&lt;pre&gt;
@Stateful
@TransactionAttribute(REQUIRES_NEW)
@ApplicationException(value = RuntimeException.class, rollback = true)
public static class YellowBean {

    public void doSomething() {

    }

    public void doSomethingElse() {

    }
}
&lt;/pre&gt;
&lt;p&gt;
Naturally, to make this API work with more than one exception type per method or bean, we would of course need a new @ApplicationExceptions (note the plural) to group several @ApplicationException annotations -- for those that are not annotation-aware, you cannot use the same annotation twice on a type, method, field or any member.
&lt;/p&gt;
&lt;pre&gt;
@java.lang.annotation.Target({TYPE, METHOD})
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public static @interface ApplicationExceptions {
    ApplicationException[] value() default {};
}
&lt;/pre&gt;

With that it would be possible to do all of the above for a few different exception types:
&lt;pre&gt;
@Stateful
public static class RedBean {

    @ApplicationExceptions({
        @ApplicationException(NumberFormatException.class),
        @ApplicationException(ArrayIndexOutOfBoundsException.class),
        @ApplicationException(value = RuntimeException.class, rollback = true)
    })
    public void doSomething() {

    }

    public void doSomethingElse() {

    }
}
&lt;/pre&gt;
&lt;p&gt;
In the above the NumberFormatException and ArrayIndexOutOfBoundsException are considered OK and will not cause instance destruction or transaction rollback, however the '@ApplicationException(value = RuntimeException.class, rollback = true)' acts as a default clause of sorts and says all other RuntimeExceptions do not cause instance destruction, but &lt;b&gt;do&lt;/b&gt; cause transaction rollback.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Conclusion&lt;/b&gt;:  Being able to be more specific with @ApplicationException would be a great improvement.  I definitely plan to propose it in EJB.next.  If you like the idea, please leave a comment as numbers do greatly increase the likelihood of it being added.  Other ideas on how to achieve a similar result more then welcome!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-3957624728711763354?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/3957624728711763354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=3957624728711763354' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/3957624728711763354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/3957624728711763354'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2010/07/applicationexception-is-evil-sort-of.html' title='@ApplicationException is evil... sort of'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-4939276974451321282</id><published>2010-06-18T18:32:00.000-07:00</published><updated>2010-06-18T19:05:56.137-07:00</updated><title type='text'>EJB annotations and Stereotyping</title><content type='html'>Certainly for the EJB-related annotations, I would love to see @Stateless, @Stateful, @Singleton and @MessageDriven be used for stereotyping as well as all the other class level annotations for transactions, security, locking, timeouts and scheduling.
&lt;p/&gt;
Great security example:
&lt;pre&gt;
 @RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
 @Stereotype
 @Target(METHOD)
 @Retention(RUNTIME)
 public @interface Admins {}
&lt;/pre&gt;

In one swoop all the security rolls become controlled in one spot and there's no need to go changing a million usages to modify the roll names.
&lt;p/&gt;
Here's a couple great scheduling examples:
&lt;pre&gt;
 @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfWeek=”*”, year=”*”)
 @Stereotype
 @Target(METHOD)
 @Retention(RUNTIME)
 public @interface Daily {}
&lt;/pre&gt;
&lt;pre&gt;
 @Schedule(second=”0”, minute=”0”, hour=”0”, month=”*”, dayOfMonth=”15,Last”, year=”*”)
 @Stereotype
 @Target(METHOD)
 @Retention(RUNTIME)
 public @interface BiMonthly {}
&lt;/pre&gt;

The list goes on and on.

A much fuller example:

&lt;pre&gt;
@Stereotype
@Singleton
@TransactionManagement(CONTAINER)
@TransactionAttribute(REQUIRED)
@ConcurrencyManagement(CONTAINER)
@Lock(READ)
@RolesAllowed({"SuperUser", "AccountAdmin", "SystemAdmin"})
@Interceptors({LoggingInterceptor.class, StatisticsInterceptor.class})
@Target(TYPE)
@Retention(RUNTIME)
public @interface SuperBean {}
&lt;/pre&gt;

And to use all that, just:

&lt;pre&gt;
@SuperBean
public class MyBean {

    public void doSomething() {
        
    }
}
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-4939276974451321282?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/4939276974451321282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=4939276974451321282' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4939276974451321282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4939276974451321282'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2010/06/ejb-annotations-and-stereotyping.html' title='EJB annotations and Stereotyping'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-561515426694442962</id><published>2010-06-18T15:46:00.000-07:00</published><updated>2010-06-18T15:55:46.296-07:00</updated><title type='text'>Annotation Scanning Standard</title><content type='html'>We (the industry) need to get something in place for Java EE 7 to get scanning under control at a platform level.  The metadata-complete concept of each individual spec is less helpful given the growing number of specifications that can have class-level "discoverable" annotations.
&lt;p/&gt;
The rules we have for scanning for ejbs in a webapp are quite unintuitive.  And how they relate to the scanning of the new Java EE 6 level annotations are unintuitive to the point that how they are handled, I bet, is rather vendor specific:
&lt;p/&gt;
 &lt;li/&gt;@DataSourceDefinition(s)
 &lt;li/&gt;@ManagedBean
&lt;p/&gt;
The cost of scanning a jar is constant in that it doesn't matter how many annotations you might be looking for or what spec they come from.  If each individual spec continues to add spec-specific descriptor support for specifying which jars to scan, we're going to wind up with a rather big mess.
&lt;p/&gt;
We should lock this down with a clean and simple file to control which jars.
&lt;p/&gt;
Something as simple as the following would be a massive improvement.
&lt;p/&gt;
META-INF/scanning.xml
&lt;pre&gt;
&amp;lt;scanning&gt;
  &amp;lt;jars&gt;
    &amp;lt;jar&gt;foo.jar&amp;lt;/jar&gt;
    &amp;lt;jar&gt;bar.jar&amp;lt;/jar&gt;
  &amp;lt;/jars&gt;
  &amp;lt;packages&gt;
    &amp;lt;package&gt;org.foo.widgets&amp;lt;/package&gt;
    &amp;lt;package&gt;com.bar.components&amp;lt;/package&gt;
  &amp;lt;/packages&gt;
&amp;lt;/scanning&gt;
&lt;/pre&gt;

I'd love it to have regex support, but even without it there's a big improvement.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-561515426694442962?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/561515426694442962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=561515426694442962' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/561515426694442962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/561515426694442962'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2010/06/annotation-scanning-standard.html' title='Annotation Scanning Standard'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-4474403948899982740</id><published>2010-06-12T18:06:00.000-07:00</published><updated>2010-06-12T18:09:14.126-07:00</updated><title type='text'>If Software is pizza, EJB is the House Special</title><content type='html'>If you can stand terrible food metaphors and have ever been exposed to EJB positively or negatively, keep reading....
&lt;p/&gt;
I don't know about you, but I love the simplicity of a good pepperoni pizza now and then.  Imagine asking for a plain Pepperoni pizza and being told your only option was to get the House Special and to pick off all the onions, black olives, green pepper and whatever else comes on top.  Any person with options would simply go to another pizza shop.  Well, that's EJB.  Something I hope we can change in EJB 4.0.
&lt;p/&gt;
To setup the metaphor a bit more, let's say the dough and cheese is the component itself and the proxy to the component.  The toppings are the various QOSs (qualities of service) such as transaction management, interceptors, concurrency management, cron-like scheduling, asynchronous method calls, and other goodness.  Each bean type such as Stateful, Stateless, Singleton and Message Driven are certain styles of pizza with a fixed set of toppings; say Meat Lovers, Vegetarian, or Hawaiian.  The toppings of each style of pizza have been selected carefully to compliment each other perfectly and guarantee good results.
&lt;p/&gt;
Currently though, if you want to start with a plain pizza and add only the toppings you want or need, you cannot do it with EJB.  If you want pepperoni, you need to pick a style of pizza that has pepperoni as a topping and deal with the other toppings that come with it, wanted or not.  EJB is somewhat flexible and there are usually ways to neutralize some features that amounts to picking off the toppings you don't like, but it's not the same as if they weren't ever there and you are still going to get an odd tasting and odd looking pizza.
&lt;p/&gt;
Say you don't really want the transaction management topping.  You try to pick off the topping by selecting SUPPORTS as your default transaction attribute so if a transaction is there, your bean participates in it, if not, it still does it's work regardless.  All is fine until your bean throws a runtime exception and the container decides to rollback the current transaction on your behalf.  Say you instead choose to try and pick off the transactional topping by making your bean use bean-managed transactions.  Things work fine except now all transactions are suspended by the container so that the bean cannot mess with the state of what was the current transaction.  What you really wanted was your bean to not be transactionally aware in the first place.
&lt;p/&gt;
Unfortunately if you want one of the other toppings like container managed concurrency, cron-like scheduling, or asynchronous method calls, you have to learn to like the transaction management topping, period.
&lt;p/&gt;
There will always be a need for specific pizza styles with pre-selected toppings -- who doesn't love a good Greek pizza or a Hawaiian now and then.  The EJB spec does that well with its perfectly selected bean types, each sprinkled with the select set of QOSs deemed appropriate for that specific bean type.  That said, it really should be possible to start with a plain cheese pizza and just add the toppings you want.
&lt;p/&gt;
Forget the dough and cheese.  EJB should be about the toppings.
&lt;p/&gt;
Ideally, every QOS the EJB spec has to offer would be an option that can be applied to a plain component.  Imagine if there was a "plain cheese pizza" bean type that would by default have no QOSs at all and for all intense purposes be a true POJO.  There's nothing to learn or study to code it or use it. It's just a POJO created by the container.  Then one day you decide you'd like it to be transaction aware.  At that point you annotate it with @TransactionManagement and then go read the self contained "transaction management" section of the spec to see what is now expected of you and the users of the bean.
&lt;p/&gt;
It may be that certain QOSs cannot be combined, which is in fact the case at times.  The concept of a container managed persistence context (i.e. a field like "@PersistenceContext EntityManager myEntityManager") cannot be combined with the new @ConcurrencyManagement annotation because EntityManagers themselves are not guaranteed to be capable of concurrency.  As a result EJB Singletons are not allowed to use container managed persistence contexts.  That may work for some, but maybe you want a Singleton that uses a container managed persistence contexts and do not need concurrency anyway.  Such a thing would be possible if you were able to choose the QOSs for your bean regardless of its lifecycle.
&lt;p/&gt;
It's time to break up the big specs and let people build their own pizzas.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-4474403948899982740?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/4474403948899982740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=4474403948899982740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4474403948899982740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4474403948899982740'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2010/06/if-software-is-pizza-ejb-is-house.html' title='If Software is pizza, EJB is the House Special'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-1979137492270673771</id><published>2010-03-02T15:01:00.001-08:00</published><updated>2010-03-02T15:27:20.337-08:00</updated><title type='text'>Man-page based Bash Completion</title><content type='html'>Hacked up this little function which you can use to get generic bash completion on any command based on the man page.

&lt;script src="http://gist.github.com/320089.js"&gt;&lt;/script&gt;

You just need to source this file.  Here's what it looks like when executed

&lt;pre&gt;mingus:~ 03:16:45 
$ wget --c[TAB]
--ca-certificate=file      --certificate=file         --convert-links
--ca-directory=directory   --connect-timeout=seconds  --cut-dirs=number
--certificate-type=type    --continue                 
&lt;/pre&gt;

Theoretically you could take this a step further and complete the values of the options as well.  Many of the options say "--foo=file",  "--foo file", "--bar host", etc..  You could parse out this "file" or "host" keyword and switch the completion style accordingly.

If you 'apt-get install bash-completion' you'll get a ton of completion functions which specialize in host, file, and directory completion.  Shouldn't be too hard to wire them in.  If anyone gets the urge to do it, definitely share your results.  The above code is stored in gist.github.com, so fork away!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-1979137492270673771?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/1979137492270673771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=1979137492270673771' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/1979137492270673771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/1979137492270673771'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2010/03/man-page-based-bash-completion.html' title='Man-page based Bash Completion'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-8005178097975059815</id><published>2009-12-28T06:41:00.000-08:00</published><updated>2009-12-28T06:59:39.438-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javaee ejb31 ejb jcp'/><title type='text'>EJB 3.1 goes final</title><content type='html'>&lt;div&gt;&lt;p&gt;&lt;/div&gt;The &lt;a href="http://jcp.org/en/jsr/summary?id=318"&gt;EJB 3.1&lt;/a&gt; and &lt;a href="http://jcp.org/en/jsr/summary?id=316"&gt;Java EE 6&lt;/a&gt; specifications finally closed this month and are up for download.  On a personal level, I'd like to say that EJB 3.1 has been the most productive I've been on a specification, thanks in no small way to the truly amazing group we had.  For many of us it is a labor of love.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
First a major thanks to &lt;a href="http://blogs.sun.com/kensaks"&gt;Ken Saks&lt;/a&gt;.  Ken, for a first-time spec lead you did an outstanding job and handled group input like a pro.  It's difficult when in a position of authority to both have an opinion and collect the opinions of others.  Where one sits in that continuum defines them as a spec lead, sets the tone for the group, and shapes the spec itself.  You struck a balance that was just right.  You started conversations with proposals that weren't too firm, yet were clear in the goal.  As well you actively encouraged the most input from the group without letting conversations drag on too long with no clear conclusion.  Hat's off to you, Ken.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
&lt;/div&gt;As well the deepest appreciation to my fellow Expert Group members. There were many, but a special thanks to &lt;a href="http://www.rahmannet.net/"&gt;Reza Rahman&lt;/a&gt;, &lt;a href="http://www.sybase.com/"&gt;Evan Ireland&lt;/a&gt;, &lt;a href="http://www.ibm.com/"&gt;Soloman Barghouthi&lt;/a&gt;, &lt;a href="http://www.jboss.org/"&gt;Carlo de Wolf&lt;/a&gt;, &lt;a href="http://relation.to/Bloggers/Gavin"&gt;Gavin King&lt;/a&gt;, &lt;a href="http://www.easybeans.net/"&gt;Florent Benoit&lt;/a&gt;, &lt;a href="http://blog.adam-bien.com/"&gt;Adam Bien&lt;/a&gt;, and &lt;a href="http://www.java.net/blog/guruwons"&gt;Kim Wonseok&lt;/a&gt;.  It was an absolute pleasure working with you guys over the last two years.  The specification wouldn't have turned out nearly as well without you.  It truly was a great group.  Let me leave my professionalism aside for a moment and simply say, you all rock.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
&lt;/div&gt;In reference to the specification itself there are areas to which I feel more personally attached.  The EJBs in .wars functionalty and of course the Embedded EJB Container API the highest among them.  If you like them, please let me know.  They have been a labor of love for me for quite some time.  I have high hopes for these in regards to the lightweight EJB front and hope that people find great use in them.  The Embedded EJB Container API in particular I see as just the beginning and I'm excited to see what innovations we can bring in EJB.next once more vendors have had the chance to implement it.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
&lt;/div&gt;Other areas I find particularly exciting are @Schedule, @Singleton and @Asynchronous.  These were a challenge and took a considerable amount of the group's time.  @Schedule for the challenge in creating an API that is expressive yet simple.  @Singleton for the locking and startup ordering.  @Asynchronous for the utter simplicity of it that it was hard to know when to stop.  In all of the above, I hope we found that magical line that gives enough functionality without cutting us off from adding more bits in the future.  Time will tell.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
&lt;/div&gt;Of course thanks to all the people who provided feedback to the group directly or indirectly through their projects.  I know I collected a good amount of spec feedback from the OpenEJB users as did other EG members from their users/customers.  This perhaps the most valuable and least thanked group.  So on behalf of myself and I'm sure all of the other EG members a whole hearted thanks.  You have our deepest gratitude.
&lt;/p&gt;&lt;div&gt;&lt;p&gt;
&lt;/div&gt;With that I raise a glass to EJB 3.1!  I look forward to working with everyone again in EJB.next!  Salud!&lt;/div&gt;&lt;div&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-8005178097975059815?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/8005178097975059815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=8005178097975059815' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/8005178097975059815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/8005178097975059815'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2009/12/ejb-31-goes-final.html' title='EJB 3.1 goes final'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-7382849155081746449</id><published>2009-08-17T13:54:00.000-07:00</published><updated>2010-01-27T03:31:21.516-08:00</updated><title type='text'>Pattern: InvocationContext Propagation</title><content type='html'>&lt;div&gt;Another good name for this pattern might be ThreadLocal Encapsulation.
&lt;/div&gt;&lt;p/&gt;
&lt;div&gt;This pattern is a real ThreadLocal killer as it is a way to track state over several calls without widespread ThreadLocal usage.
&lt;/div&gt;&lt;p/&gt;&lt;div&gt;
&lt;/div&gt;&lt;p/&gt;&lt;div&gt;Internally in OpenEJB we have managed to boil all our ThreadLocal usage down to this sort of "one to rule them all" approach. When attempting to describe it to a user I started using the javax.interceptor.InvocationContext as an example. The result was an ejb3 design pattern that is too cool not to share.
&lt;/div&gt;&lt;p/&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Add the following Interceptor as a global interceptor at the beginning of the interceptor stack.&lt;div&gt;
&lt;script src="http://gist.github.com/287755.js?file=InvocationContextPropagator.java"&gt;&lt;/script&gt;
The Interceptor uses a private ThreadLocal to propagate invocation state by linking the InvocationContext objects together.  The result is that you can do an infinite amount of state tracking as well as write some pretty impressive diagnostic tools.&lt;/div&gt;&lt;p/&gt;&lt;div&gt;Anyone downstream of this interceptor can make a call like this to get access the an infinite amout of state up the stack.&lt;script src="http://gist.github.com/287755.js?file=gistfile2.java"&gt;&lt;/script&gt;
You can move specific state forward for quick access.&lt;script src="http://gist.github.com/287755.js?file=gistfile3.java"&gt;&lt;/script&gt;
You can also look infinitely back the invocation chain for state set in a previous InvocationContext.&lt;script src="http://gist.github.com/287755.js?file=gistfile4.java"&gt;&lt;/script&gt;
Or perhaps more elegantly as a recursive method.&lt;script src="http://gist.github.com/287755.js?file=gistfile5.java"&gt;&lt;/script&gt;
A JavaDoc'ed and ASL licensed version here:  &lt;a href="http://gist.github.com/168153"&gt;http://gist.github.com/168153&lt;/a&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-7382849155081746449?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/7382849155081746449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=7382849155081746449' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/7382849155081746449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/7382849155081746449'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2009/08/pattern-invocationcontext-propagation.html' title='Pattern: InvocationContext Propagation'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-8244519017118642647</id><published>2008-04-15T23:09:00.001-07:00</published><updated>2008-08-04T18:38:19.418-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='EJB 3.1'/><category scheme='http://www.blogger.com/atom/ns#' term='Testing'/><category scheme='http://www.blogger.com/atom/ns#' term='OpenEJB'/><title type='text'>OpenEJB Revival</title><content type='html'>After a year and a half of internal development and six months of  betas, the 3.0 codebase has matured and solidified into the OpenEJB  I've always dreamt of.&lt;p&gt;OpenEJB 3.0 achieves much of the original vision OpenEJB set out to  accomplish eight years ago.  With a Tomcat integration that allows  Tomcat users to still enjoy the Tomcat they know and love yet take  advantage of many Java EE features for both Servlets and EJBs and an  ultra lightweight, embeddable EJB container for simple, plugin-free,  unit testing that's impressively fast, remarkably easy to use and far  more complete than any mock container out there, OpenEJB 3.0 offers a  unique and powerful one-two punch that will be hard to beat.&lt;/p&gt;&lt;p&gt;OpenEJB has always gone in a different direction than the other EJB  implementations, often to it's disadvantage.  The idea of lightweight,  embeddable and testable EJB was not something people were prepared to  accept until recently.  This left the project typically lacking in the  resources required to keep up with the specs and took OpenEJB off the  table for a good number of people.  After the launch of EJB 3.0,  however, people were finally ready to get on board with a lightweight  and embeddable EJB implementation.&lt;/p&gt;&lt;p&gt;We launched our EJB 3.0 effort, OpenEJB 3.0, in early 2006 and went on  a caffeine-charged coding bender for so long and so intensely that  about half way in I had to give up drinking coffee completely.  For  me, it was very personal.  Not just a fight for survival, but a fight
two win.  OpenEJB had always been a project of great promise, but  seemed to never have all the right pieces at the right time.  I had  been working on the project for six years and it was time to go all in  and win or go home.  We achieved Java EE 5 certification as part of  Geronimo in June 2007 and have been applying copious amounts of polish  ever since.  We're still the only open source EJB implementation to be  included in a Java EE 5 certified platform aside from the RI itself.&lt;/p&gt;&lt;p&gt;The coming EJB 3.1 specification promises to be an even bigger boom.    Several OpenEJB-born concepts are major focuses of EJB 3.1  specification such as the Collapsed EAR (ejbs and servlets side-by-side in the same archive and classloader) and embeddable EJB container  for testing and Java SE environments.  Similarly, the EJB 3.1 Lite  profile describes OpenEJB to a tee and the EJB + Servlet profile maps  directly to Tomcat with added OpenEJB.&lt;/p&gt;&lt;p&gt;If you're a Tomcat user, checkout OpenEJB 3.0.  If you'd like an easy  way to test your EJBs regardless of what platform you use, checkout  OpenEJB 3.0; we natively support the full Glassfish descriptors,  Geronimo of course, some of the WebLogic descriptors, and are happy to add more.  If you've looked at OpenEJB in the past, especially OpenEJB  2.x, look again ... you'll be very surprised.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-8244519017118642647?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/8244519017118642647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=8244519017118642647' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/8244519017118642647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/8244519017118642647'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2008/04/openejb-revival.html' title='OpenEJB Revival'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7974209436265167833.post-4944367213238726594</id><published>2008-04-12T21:59:00.000-07:00</published><updated>2008-04-15T23:33:16.946-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OpenEJB'/><title type='text'>OpenEJB 3.0 Final Released</title><content type='html'>After a month of release candidates, fixing TCK issues, and other release polish... OpenEJB 3.0 is finally released!

This release includes several improvements and refinements over the very successful 3.0 beta 2 release. Dependency injection has had a major boost with support for Java Generics and Enums. A dozen new validations makes it even harder to do something "wrong". JPA users will find it nearly impossible to misconfigure the jta-data-source and non-jta-data-source. More robust EJB references allow for circular and lazy references to ejbs in other ears. Deep levels of annotation inheritance are completely respected, allowing for greater design control and less duplicate code.

Release notes: &lt;a href="http://www.apache.org/dist/openejb/3.0/RELEASE-NOTES.txt"&gt;http://www.apache.org/dist/openejb/3.0/RELEASE-NOTES.txt&lt;/a&gt;

Download: &lt;a href="http://openejb.apache.org/openejb-30.html"&gt;http://openejb.apache.org/openejb-30.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7974209436265167833-4944367213238726594?l=blog.dblevins.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.dblevins.com/feeds/4944367213238726594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=7974209436265167833&amp;postID=4944367213238726594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4944367213238726594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7974209436265167833/posts/default/4944367213238726594'/><link rel='alternate' type='text/html' href='http://blog.dblevins.com/2008/04/test-email-post.html' title='OpenEJB 3.0 Final Released'/><author><name>David Blevins</name><uri>http://www.blogger.com/profile/16084891987160395485</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16218576319228531031'/></author><thr:total>0</thr:total></entry></feed>