应该这篇文章对你有帮助:
http://community.csdn.net/Expert/topic/3361/3361069.xml?temp=1.705569E-02

解决方案 »

  1.   

    我想说的是:EJB层的ServiceLocator能否用缓存和单点模式,在EJB设计模式中有一条建议:
    "Using java Singletons isok if they're used correctly" ,在EJB中不能使用带有static和synchronization关键字的变量,但前提是:不是以读写方式使用。
    这样看来EJB层的ServiceLocator不能用缓存和单点模式。
      

  2.   

    为什么要分别为EJB层和WEB客户端设置一个ServiceLocator?
    WEB客户端通过business delegate 去访问EJB层,WEB客户端不需要知道EJB 层的技术细节呀。