First of all, I know that Class.forName()
load a specific class to classloader and call it's static initializers. But, not long ago I found a problem in my company's application, we use some Http Client which call every http request Class.forName(...)
, that's cause problems during peaks of load. It locks hundreds of threads in monitor inside forName(...)
.
Here is the picture of my threads, they all waiting monitor!!!
- Is it scan classpath and all jars inside web application? (can it be a long operation?)
- Is it scan every call or if the class already loaded - it doesn't scan classpath?
Aucun commentaire:
Enregistrer un commentaire