• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

urlyBird testing lock

 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two versions of test script for testing locking.
One version finds the error. Other not.
There is no significant difference between the two.
I like to know why the two programs are showing the difference.


code for version 1



The out put for above code is


The second version of code just have changes as follows


But this is not catching the error
The output follows

Please note code in case0, case1, case2 and execute are identical(cut and paste).
Reason for the failure of lock is in the way I use synchronization.
lock method is having synchronized modifier which is wrong. I should be synchronizing on a common object (like a collection of locks or a non duplicated/cloned single lock) to all threads.

Extremely curious :roll: to know the difference. I am not giving the lock or unlock details which may deviate attention. The lock acquiring event is not logged for the same reason.

Any help is appreciated.
[ April 14, 2005: Message edited by: jiju ka ]
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic