users@glassfish.java.net

Re: Just for curiosity and in case needed later

From: <glassfish_at_javadesktop.org>
Date: Thu, 12 Aug 2010 14:45:50 PDT

> So do you have these queues as static fields
> somewhere?
>
> If so, How do you feel about? I am not so keen to use
> static fields to share data across EJBs....

Yeah, just static fields.

There's nothing wrong with static fields working with EJBs. You can even have static fields IN your EJBs.

EJBs don't have THAT much black magic surrounding them. They're "simply" POJOs with a lifecycle, and you need to be aware of that lifecycle. Our queues aren't managed by EJBs, just POJO classes. They have their own lifecycle tied to the applications lifecycle (as best it can given the limitations of JEE 5).

The downside of statics are simply having to be aware of the Classloaders and who sees what etc., but that's just life in a JEE container. Also they're a notorious source of Classloader leaks within App Servers, so need to be careful with them there as well. But that only affects redeployment, not actual execution.

Really not that big of a deal.
[Message sent by forum member 'whartung']

http://forums.java.net/jive/thread.jspa?messageID=480049