Why do we need separate Remote and Local interfaces for EJB 3.0 session beans

后端 未结 6 494
忘了有多久
忘了有多久 2020-12-23 13:59

I was wondering why do we need separate Remote and Local intefaces for EJB 3.0 Session beans. I guess most of the time they would both be defining the same contract. Why can

6条回答
  •  一整个雨季
    2020-12-23 14:36

    A good reason is because you access an EJB through its interface. This way you pass parameter by value when using a remote interface and by reference when using a local interface. And do you know why this behavior ? it makes sense: maybe you do want a remote application access your business object and because pass by reference reduces network latency. Remember: remote access involves the process of turning an object into a byte stream - marshaling - and the process of turning a byte stream into an object - unmarshaling. This additional step - Marshaling and unmarshaling - slows down the performance of the application.

提交回复
热议问题