public Object get() {
Thread outThread - Thread.currentThread();
Map map = ourThread.threadLocals;
Object value = map.get(key);
if(value==null && !map.containsKey(key)) {
if(map == Collections.EMPTY_MAP)
map = outThread.threadLocals = new HashMap(INITIAL_CAPACITY);
value = initialValue();
map.put(key, value);
}
return value;
}

So the only real extra expense is Thread.currentThread(), and that is vm dependent. My guess is it is a fairly cheap call.

-dain

On Wednesday, November 27, 2002, at 08:52 AM, David Jencks wrote:

On 2002.12.27 04:58:08 -0500 Hiram Chirino wrote:
David,

Is a ThreadLocal lookup more expensive than a hashmap lookup??
I don't know, I thought I read that it was considerably slower, but I've
never tested.

david

Regards,
Hiram

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of David
Jencks
Sent: Tuesday, November 26, 2002 8:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-dev] 3 Transactions?


On 2002.11.26 22:26:30 -0500 Dain Sundstrom wrote:
OK we have a transaction associated with the thread, each invocation
and the each context has a transaction (very confusing).  Once we get
by the tx interceptor should all of these be the same thing?
yes (at least the thread and invocation, I don't know about the context,
isn't that a UserTx, which is almost completely unrelated?)

If we are
suspending the transaction for the invocation (Not Supported) should
the ctx and invocation tx be null or just a suspended transaction?

Invocation should have null. You shouldn't be able to tell if there was
a
tx associated "upstream".

IMO the invocation is the "master" and the threadlocal is there in case
you
can't get to the invocation (such as in the jca stuff). So the tx
interceptor needs to figure out what the current tx actually is, and make
sure the txManager knows it so it can supply it per thread.

david jencks
-dain



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development


-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to