[infinispan-dev] OwnableReentrantLock.currentRequestor

Christian Vest Hansen karmazilla at gmail.com
Wed May 13 04:47:09 EDT 2009


On Wed, May 13, 2009 at 10:38 AM, Jason T. Greene
<jason.greene at redhat.com> wrote:
> Mircea Markus wrote:
>>
>> Hi,
>>
>> this method obtains the lock requestor  associated with the current
>> thread,  which  ultimately performs an ThreadLocal.get(key).
>> Can't we pass the lock owner to the lock before acquiring locks to avoid
>> this lookup map lookup? This would mean some code changes, but  I think
>>  we'll  gain some performance.
>
> You mean like setting a field? This would be a race condition. This really
> should be a parameter, but that would require reimplementing AQS, and not
> adhering to the lock interface. Ultimately though, i think the map lookup
> pales in comparison to the lock operation :)

If we're talking about java.lang.ThreadLocal, then I think* hotspot
has intrinsics that makes them as fast to access as ordinary fields.

*although I can't present any handy reference to, or proof of, this behaviour.

>
>
> _______________________________________________
> infinispan-dev mailing list
> infinispan-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/infinispan-dev
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.




More information about the infinispan-dev mailing list