aspose file tools
The moose likes Threads and Synchronization and the fly likes Exception when ThreadLocal.set() is called. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Exception when ThreadLocal.set() is called." Watch "Exception when ThreadLocal.set() is called." New topic
Author

Exception when ThreadLocal.set() is called.

shahabas shabeer
Ranch Hand

Joined: Feb 23, 2004
Posts: 49
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


The greatest pleasure in life is doing what peoples say you can not do.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24054
    
  13

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?


[Jess in Action][AskingGoodQuestions]
shahabas shabeer
Ranch Hand

Joined: Feb 23, 2004
Posts: 49
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.
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2778
    
    2
That sounds, ummm, suspicious. I suggest posting the complete stack trace, along with the exact JDK version number and OS that you're using.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Exception when ThreadLocal.set() is called.
 
Similar Threads
Need to reduce the CPU usage when thread is running.
Performance Problem with EJB running on WAS
Performance Problem with EJB--Need expert guidence
Bleh...design question about Threads
RandomAccessFile.length() causes problems when multithreading