Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
-Ade<br /><a href="http://www.barkah.org" target="_blank" rel="nofollow">www.barkah.org</a>
[OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Originally posted by Jeanne Boyarsky:
I read in an article that local interfaces can't be used if you are clustering the app server. Is this only if you have the web and ejb layer on different machines?
Originally posted by Ade Barkah:
My $0.02,
One should not create extra interfaces on the premise that they "might" be used later. Trying to optimize an application too early by providing both remote and local interfaces is questionable at best.
As a general rule, prefer (coarse-grained) remote interfaces for session facades so you can independently scale different tiers of the application, and to prevent clients from depending on pass-by-reference semantics. Apply best practices such as using 'value objects' to minimize the cost of having remote calls. Only convert those interfaces into local ones as a last resort.
If you do run into performance problems, solve it by doing things like optimizing your database queries, selecting better data structures, caching results, using more efficient algorithms, pooling heavy objects, etc., instead of by wholesale conversion to local interfaces.
Hope that helps,
-Ade Barkah
Originally posted by Ade Barkah:
As a general rule, prefer (coarse-grained) remote interfaces for session facades so you can independently scale different tiers of the application, and to prevent clients from depending on pass-by-reference semantics.
Originally posted by Jeanne Boyarsky:
I read in an article that local interfaces can't be used if you are clustering the app server. Is this only if you have the web and ejb layer on different machines?
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Originally posted by Chris Mathews:
Actually, I think it is best to always err on the side of local interfaces. Make everything a local interface and then make deliberate decisions on what services to provide remotely. This keeps a nice coarse-grain interface to your remote api and can be easily implemented by layering a Remote Facade on top of your local ejbs.
-Ade<br /><a href="http://www.barkah.org" target="_blank" rel="nofollow">www.barkah.org</a>
Originally posted by Ade Barkah:
Instead of having session beans with only local interfaces -- to be invoked from the facades -- then consider just implementing them as plain-old Java classes instead. Why bother, in most cases? Their transactional context, security, object lifecycle, etc., are dependant on the facade layer anyway. Encapsulation is good, but only to a point.
Having layers of session beans on top of other session beans not only slows things down (even if they are local) but may introduce subtle problems (e.g., state-chaining issues if any of the beans are stateful.)
-Ade Barkah
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
-Ade<br /><a href="http://www.barkah.org" target="_blank" rel="nofollow">www.barkah.org</a>
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
|