Singleton across JVM or Application instance or Tomcat instance

前端 未结 5 1192
星月不相逢
星月不相逢 2020-11-30 04:17

If I deploy and run 2 instances of same application on a single instance of Tomcat(Or any other server). Then a single object(of a Singleton class) would be created:

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 04:56

    It is possible to create such a singleton by assuring that you always query the same ClassLoader for the singleton. I wrote an extensive explanation in this other answer.

提交回复
热议问题