Java Reference
In-Depth Information
The Split Cleaner is an antipattern related to connection cleanup. When a
resource is requested and released in different methods, the potential exists for
cleanup-related problems. Connections not properly cleansed can lead to
leaks. Connections cleansed too soon will lead to exceptions. Both are bugs
that we can avoid by placing allocations and frees in close proximity.
Finally, the Hardwired Connection antipattern can make business-to-busi-
ness connections very difficult to maintain. We can use technologies (such as
XML ) and API s (such as Web Services) to decouple systems, and make both
the service and the client much easier to maintain.
7.8
Antipatterns in this chapter
These are the templates for the antipatterns that appear in this chapter. They
provide an excellent summary format and form the basis of the cross-refer-
ences in appendix A.
Connection Thrashing
D ESCRIPTION : When database connections are created from scratch with
each new user connection, the performance can be poor, because database
connection costs are prohibitive. This antipattern can happen for other
connection types as well.
M OST FREQUENT SCALE : Application.
R EFACTORED SOLUTION NAME : Connection Pooling.
R EFACTORED SOLUTION TYPE : Software.
R EFACTORED SOLUTION DESCRIPTION : Design patterns and software
with built-in connection pools are widely available, and Java has a new
connection framework.
R OOT CAUSES : Haste, sloth, ignorance.
A NECDOTAL EVIDENCE : “We'll just add connection pooling later.”
S YMPTOMS , CONSEQUENCES : Since database connections are expensive,
the primary symptom is strain of system resources such as memory or file
handles, causing errors or poor performance. In extreme cases, it is not
unusual for over half of an application's total work effort to go toward
managing connections. Along with Round-tripping and the Cacheless
Cow, this antipattern is the biggest performance drainer in the topic.
Search WWH ::




Custom Search