Get product number
Get product name
Get product price
Figure 8.5 This sequence diagram graphically illustrates the round-tripping problem. We have
a distributed interface between the controller and the EJB objects. The bold lines indicate
places where we have significant looping. The UML sequence diagram is ideal for detecting
have a problem. Bold lines in the sequence diagram indicate looping, and we
have a significant number of them. Ideally, we'd like to group all finds and
gets together in a single distributed call. That way, all of the calls to the acces-
sors will be local, giving us a significant performance boost. That is precisely
the solution that we'll implement with the session facade.
Solution: Group together round-trips with a facade
To batch all of the round-trip calls in a chatty interface into a single collection
and handle all of the work with a single conversation, we'll implement a facade.
With this technique, we're creating a new layer with a formal interface in our
architecture. We can use distributed commands for this purpose, but we can
just as easily use stateless session beans. Figure 8.6 shows the impact of a facade.
What a difference a simple refactoring step can make! We've taken a design
with several round-trips and boiled them down to one. The communication
mechanism doesn't matter too much. We can wrap a variety of different