Java Reference
In-Depth Information
session state management. (In configurations with multiple web applica-
tion servers, the session state can be problematic. We'll talk more about
session state in the section “Chaotic session management.”) The inter-
action controller may also access other web application services, such as
naming and security services.
JSP pages. Compiled to form servlets, JSP s build the return-trip view for
the client. Additional JSP fragments can be embedded in the original to
form a compound document. JSP s get input from the interaction con-
troller in two ways. First, the interaction controller can embed beans,
called data beans . Second, parameters can be passed through the HTTP
response object; the compiled JSP then returns an output page that is
returned to the client or embedded in another JSP .
Command layer (or facade). The command layer is a thin wrapper
around the model. It presents an interface to the interaction controller
and JSP . It consists of set methods for input parameters, prepare-to-
execute and execute methods to fire the appropriate business logic, and
get methods that provide access to output parameters. Alternatively, a
stateless session bean can be used to provide a remote interface to the
EJB tier. This layer helps decouple the model and view, and also helps
eliminate round-tripping.
Model layer. This layer can consist of legacy code, proprietary Java, or
EJB -centric code. Clarity of design, high performance, and reliability are
the keys here. This layer has been the most prone to poor performance,
and several antipatterns in this topic have targeted it. Problems indepen-
dent of EJB s include a lack of connection pooling, poor or missing cach-
ing strategies, poor algorithms and Java designs, and restrictive locking
schemes. EJB s introduce more problems, including implementing the
wrong EJB types, using full EJB entities for relationships, or choosing to
use EJB s for trivial problems. The model layer tends to be fairly complex,
so it's important to keep external interfaces clean and simple. The only
interface to the rest of the system should be through the command layer.
Homogeneous units in layers often scale well because it's easy to determine
where performance problems originate. Once we identify a problem, we can
apply additional hardware or tuning to proportionally increase the system
workload capacity.
Search WWH ::

Custom Search