• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Exception when ThreadLocal.set() is called.

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My application throws a java.lang.Exception when it call ThreadLocal.set() method. This happens only during load test with 1000 concurrent virtual users. I never got this error during development and could not reproduce in my development machine. So I guess the issue is with thread management. Should I call this method in a thread safe manner?. What would happen if I did not synchronize the method?. Will the application throw java.lang.Exception if two threads try to update this value at the same time? Any help would be highly appreciated.

Thanks
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there no message associated with the exception? If not, are you sure that your code isn't swallowing and re-throwing a more informative exception?
 
shahabas shabeer
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope.. There is no clear message in the exception. I do have a try-catch block but I am printing the entire exception details using printStackTrace() method.
 
Rancher
Posts: 5087
82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds, ummm, suspicious. I suggest posting the complete stack trace, along with the exact JDK version number and OS that you're using.
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic