Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Query about using Local Interfaces in EJB  RSS feed

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Can anybody please tell me when should we use Local Interfaces in EJB ??


and what is the point of using Local interface concept ??

Thanks in advance .

 
Devaka Cooray
Marshal
Posts: 5562
709
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Local interfaces can be used in order to access an EJB instance within the same JVM. It just invoke the bean by pass by reference. You can also use Remote interfaces even in the same JVM, but there will be an unnecessary performance hit with that usage, because it uses RMI which is not required within the same JVM.

Devaka
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats very good explanation Devaka .

But can you please tell me when there will such a requirement as "Local interfaces can be used in order to access an EJB instance within the same JVM. "
 
Devaka Cooray
Marshal
Posts: 5562
709
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is when you are running on the same container on a non-distributed environment.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
somehow i am not clear as on where to use Local Interfaces .
Can you please tell me any scenario of where to use Local Interfaces .
 
Manuel Alberto Quero
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the great explanation of Devaka, you could think about a scenario like follows:
-1 server machine
-1 Application Server (e.g. JBoss)

Supponse that you need to implement a three layer application:
-Presentation layer: (for instance) JSF
-Business layer: EJB
-Persistence layer: (for instance) JPA (EJB 3.0)

The presentation layer needs to communicate with business layer. If the presentation layer and business layer lived in different application servers (different JVM, multi tier application), it would be necessary to use remote interfaces to be able to invoke EJBs living in the other application server (RMI).
But in our scenario, the presentation layer and the business layer live in the same application server (same process, same JVM) so we can (and should for performance issues) use local interfaces (no RMI, call by reference).

Hope it helps,

Manuel
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really you made it look simple

In my previous organization i worked on EJB2.1 . we used only a single weblogic server . Now i am wondering why my Architect used Remote Communication .

(It was a simple Application with a Servlet calling a SessionBean and it in turn calls the EntityBean )

There we did not used any Local things .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!