Subject Re: [Firebird-Architect] Re: External procedures: implementation proposal.
Author David Jencks
On Jul 26, 2005, at 9:47 AM, Roman Rokytskyy wrote:

>> Opinions differ on this :-). I think thread locals are a dreadful
>> hack and should be eliminated wherever possible. They are normally
>> a way to tell component C about the context available in A without
>> telling B, the guy in the middle.
>
> Not only in this case. How did you implement the following code in
> Geronimo?
>
> InitialContext ctx = new InitialContext();
> UserTransaction tx = ctx.lookup("UserTransaction");
>
> I doubt that there are no TLS here. Same approach I consider for the
> callbacks. What is wrong with it?

The j2ee specs effectively require you to use thread locals in several
places, and indeed I haven't found any way to implement JTA
transactions without a thread local. It doesn't mean it's a good idea:
for JTA the requirements basically come from C programming circa 1990
(maybe earlier). Jim has argued against thread locals repeatedly and
to the extent I understand what he is talking about I completely agree
with him.

Here, I don't see why you would even think of thread locals. You have
some method that may need a resource, why not just give it the resource
to start with rather than forcing it to look it up? Even EJB 3 is
moving towards some dependency injection/IOC concepts.

thanks
david jencks

>
> Roman
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>