• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Local Interface!!!

 
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all:
Since Enterprise JavaBeanTM 2.0 Specification Changes,
there is no Home interface but Local Interface, are these
two the same? Is there any book or website talking the details
about it? Any sample code like Hello World?
Thanks in advance,
Sarah
 
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
in the ejb2.0 specs you can found everything about it: http://java.sun.com/products/ejb/docs.html

(I think its chapters 5,6)now you can choose wich interface to implement according to your design and you are able to avoid remote calls.
regds
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Home interfaces and local interfaces both exists in EJB 2.0 spec.
The difference is that if you use local interfaces you are
confirming that all your beans will run in the same JVM only
i.e. no remote calls, better performance.
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
EJB 2.0 introduced local interfaces to access EJB that are deployed in the same container. This namely reduces the overhead of method invocation. Before EJB 2.0 even if we deployed two EJBs in the same container their communication still had to go over stubs and skeletons and the container had to check security and transaction contexts. Although some containers did optimizations they could not achieve the performance of local method invocations. BTW, performance measurements show approximately 2000 times difference between local and remote method invocations.
Local interfaces in EJB 2.0 enable us to optimize this and use local interfaces to communicate between EJBs deployed in the same container. An EJB can have both, local and remote interface. Basically there is a local home and local component interface (where business methods are declared) and remote home and remote component interface.
However in real world we will probably stick with local or remote and will decide in design time which to use. Local interfaces will enable us to model the interfaces fine grained without performance penalty. Local interfaces are also very suitable for implementing the facade pattern, where facade beans (session or message driven) expose the coarse grained functionality though remote interfaces, but use the local interfaces to communicate with the underlying entity beans.
To learn moor have a look into the Wrox Pro EJB book!
Cheers,
Matjaz

------------------
Matjaz Juric
Author of Professional EJB
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic