Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在集群环境中没有找到太多关于 EJB 3.1 Singletons 的信息。规范是否说这些单例将保证每个 JVM 一个实例 - 所以每个集群节点一个实例。不是每个集群一个?
是的,EJB 3.1 规范的第 4.8 节规定“每个应用程序将为每个 JVM 提供一个 Singleton 的 bean 实例”。
单例本身不保证每个集群一个实例。为此,您需要指定一个依赖项。如果您使用的是 jboss,那么它是“jboss.ha:service=HASingletonDeployer,type=Barrier”。