dev@glassfish.java.net

Re: CCC Request: end support for lookup name "UserTransaction"

From: Jerome Dochez <jerome.dochez_at_oracle.com>
Date: Mon, 13 Sep 2010 13:58:12 -0700

We talked about this at CCC today and we were not particularly in favor of getting rid of a feature just because it solves a coding issue.

Can you elaborate the cyclic dependency you are having that cannot be resolved ?

jerome

On Sep 7, 2010, at 8:10 PM, Cheng Fang wrote:

> I'd like to explore the possibility of ending the support for GlassFish-specific lookup name "UserTransaction" in 3.1. The usage of this lookup name: initialContext.lookup("UserTransaction");
>
> This lookup name might have been documented in previous versions. However, it does not appear in either v2.1 GlassFish dev guide, or admin guide. It's currently documented in both guides to use @Resource injection or the portable lookup name "java:comp/UserTransaction". So chances are this name is already defunct.
>
> The direct reason for this request is issue 13108 (Cycle in our component chain involving GlassFishNamingManager and TransactionNamingProxy) [1]. One part of the circular dependency is TransactionNamingProxy injecting GlassFishNamingManager, just to publish UserTransaction by the name "UserTransaction". [2]
>
> We can resolve this circular dependency by removing this injection and naming publishing. It seems to be the fix with lowest risk.
>
> After some discussion with Marian and Mahesh, another potential fix for 13108 is to lazily initialize InitialContext in GlassFishNamingManagerImpl. InitialContext field is used extensively in GlassFishNamingManagerImpl, in many frequent code paths like lookup, bind, rebind, publish, etc. So this approach will add some concurrency-related cost (e.g., volatile field, synchronized block). [3]
>
> So IMO, skipping publishing "UserTransaction" seems to be a better fit. Users can still use either @Resource injection (for Java EE 5 or newer), or lookup "java:comp/UserTransaction" (for all versions of Java EE).
>
> Any concerns / comments?
>
> - cheng
>
> [1]
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=13108
> [2]
> https://svn.dev.java.net/svn/glassfish-svn/trunk/v3/transaction/jta/src/main/java/com/sun/enterprise/transaction/TransactionNamingProxy.java
> [3]
> https://svn.dev.java.net/svn/glassfish-svn/trunk/v3/common/glassfish-naming/src/main/java/com/sun/enterprise/naming/impl/GlassfishNamingManagerImpl.java
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>