还有,ejb也不能用file类 !
关于线程,网络等等 那都是容器的事 ! ------------------------------------------------------
           我们还年轻牛奶会有的奶牛也会有的 
             可天天在 csdn 混这些会有吗 ??

解决方案 »

  1.   

    那我需要一个listener怎么办?我想实现两台机器通信,a上的程序可以触发b上的ejb函数,能做到吗?暂不考虑jms+mdb。
      

  2.   

    只是规定不要用,又不是不能用,ejb里的bean是java类,java类能做的ejb就能做.不要被应用服务器(也是普通的java程序)吓倒.
      

  3.   

    使用远程调用就可以做到你的要求。
    主要因为EJB本身就是基于网络的分布式系统,在其上使用普通的套接字就有可能产生问题。
    至于线程是因为EJB本身就是运行在多线程环境下的,所以在里面使用多线程程序就可能产生问题。
      

  4.   

    Since EJB servers handle concurrency automatically, a bean's methods do not have to be made thread-safe. In fact, the EJB specification prohibits use of the synchronized keyword. Prohibiting the use of the thread synchronization primitives prevents developers from thinking that they control synchronization and enhances the performance of bean instances at runtime. In addition, EJB explicitly prohibits beans from creating their own threads. In other words, as a bean developer, you cannot create a thread within a bean. The EJB container has to maintain complete control over the bean to properly manage concurrency, transactions, and persistence. Allowing the bean developer to create arbitrary threads would compromise the container's ability to track what the bean is doing and thus would make it impossible for the container to manage the primary services.