How does Class.forName (..) work, in detail?

First of all, I know that it Class.forName()

loads a specific class in the classloader and calls it static initializers. But I recently found a problem in my enterprise application, we are using some Http client that makes every HTTP request Class.forName(...)

which causes problems during peak loads. It blocks hundreds of threads in the monitor inside forName(...)

.

Here is a picture of my streams, they are all waiting for the monitor !!!

enter image description here So here are my questions:

  • Does it check the classpath and all jars inside the web app? (can this be a long-term operation?)
  • Does it check every call or an already loaded class - does it not scan the classpath?
+3


source to share





All Articles