How Tomcat Classloader separates different Webapps object scope in same JVM?

前端 未结 7 700
庸人自扰
庸人自扰 2020-12-05 03:35

Since Tomcat can load more than one webapp at once, and those webapps can work separately, and do not disturb each other, and they work in same JVM. So I am very confused a

7条回答
  •  心在旅途
    2020-12-05 03:45

    One thing that always gets left out when talking about singletons, is that a singleton can have only one instance per classloader. A ClassLoader limits class visibility, so the same class can exist under several different classloaders in the same VM. This allows you, among other things, to have different versions of jars loaded at the same time.

    This question: Java Class Loaders seems to have some nice links and resources for further studying.

提交回复
热议问题