• 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

what is a local client in EJB ?

 
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is a local client in EJB ?


is it a client JSP page in the EJB application directory ?

is it a client JSP/ servlet in the same computer but not in the EJB application directory ?
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not about the same computer, it's all about the same JVM. If your client code will run in the same JVM as the EJB container, then you may wish to have only local interfaces. (This can happen if, say, the client is running in a servlet container which is co-located with the EJB container.) It is much more efficient for a client to make local rather than remote calls, but you will not be able to separate out the client and EJB code into different JVMs without quite a bit of reworking of your code.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you hide the local or remote decision in a Business Delegate then the client will never have to know which is being used. You might make your BD smart enough to switch between local and remote by configuration or dynamic load analysis. We use a framework where the BD might use EJB or raw sockets or XML over HTTP with no change in the client.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't thought this through, but I can see the BD needing to obtain and return a business service to the client in order to invoke business methods. This business service will typically be any of the following:

1. A reference to a JavaBean running in the same JVM.
2. A stub to an EJBObject for an EJB application running in a different JVM.
3. A stub to a javax.xml.rpc.Service for a web service endpoint running in a different JVM.

It should be easy enough to do this via some sort of service locator, using a configuration variable read in on server startup.

Also, there is no reason at all for the client to ever receive RemoteException, the BD should catch this sort of exception, wrap and rethrow it as RuntimeException (or some suitable subclass thereof). The client will therefore only receive a system exception and, of course, any application exceptions.
 
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic