[jboss-user] [JBossCache] - Re: Reading threads are blocked
do-not-reply at jboss.com
Thu Jul 12 07:47:41 EDT 2007
| It seems that in the parallel scenario, most threads are blocked by the initLock in UnversionedNode. The lock is lazily initiated in case we don't need locking, but on the other hand you then force a synchronized upon every threads that wants to get the lock reference. The synchronization is only to check if the lock has been initialized and when it has it really serves no purpose, so arguably this could be solved without having to synchronize on every getLock() call. However, using non-lazy initialization and removing the sync block did not result in any significantly higher concurrency since the next mutex is in the tryLock on the lock that we pass back.
Hmm, ok, ideally we should be testing for the lock not being null before going into the sync block:
| public IdentityLock getLock()
| if (lock_ == null) initLock();
| return lock_;
This is a minor optimisation though since like you said the next mutex is in actually trying to obtain the lock. Still, a valid optimisation.
Thanks for running these tests!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063436#4063436
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063436
More information about the jboss-user