An enterprise bean must not use thread
synchronization primitives to
synchronize execution of multiple
instances, except if it is a Singleton
session bean with bean-managed
concurrency.
推理也很有趣:
Synchronization would not work if the
EJB container distributed enterprise
bean’s instances across multiple JVMs.
# 1 楼答案
来自EJB3.1规范,第21.2.2章。编程限制:
推理也很有趣:
# 2 楼答案
从一个线程调用
myMethod1
,从另一个线程调用myMethod2
,将出现死锁