did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9781930110953

Bitter Ejb

by
  • ISBN13:

    9781930110953

  • ISBN10:

    1930110952

  • Format: Paperback
  • Copyright: 2003-06-01
  • Publisher: Manning Pubns Co
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.95

Summary

Bitter EJB defines EJB traps, called antipatterns, and provides effective solutions. It covers messaging, transactions, persistence (with JDO and OR mapping), performance tuning and builds. Bitter EJB, covers antipatterns, or common traps, surrounding EJB. The book spreads across many different aspects of EJB, from transactions to persistence to messaging, including other important topics like performance and testing. Topics covered include: EJB persistence strategies; Entity bean alternatives; EJB message driven beans; stateful session beans; XDoclet, Ant and Junit; and automating performance tuning.

Author Biography

Bruce Tate is an Internet architect who developed the bitter Java concept after seeing a set of customer problems repeated, collecting their stories, and publishing the solutions. He is the author of Bitter Java. He lives in Austin, Texas. Mike Clark is president of Clarkware Consulting, Inc. He first encountered EJB pitfalls in 1998 while developing a custom EJB container, prior to the emergence of commercial J2EE servers. He has significantly contributed to the successful delivery of a popular J2EE performance management product and has also created several open source tools including JUnitPerf for automated performance testing. He lives in Parker, Colorado. Bob Lee is an OCI consultant with expertise in AOP, Jini, and web security. He developed an open source AOP framework that utilizes runtime bytecode engineering to intercept method invocations on POJOs and forms the foundation of JBoss AOP. He lives in St. Louis, Missouri. Patrick Linskey is the vice president of engineering for SolarMetric, a company that offers Java persistence alternatives to the Java community. His experience spans EJB application development and product development, and he is a teacher and speaker on the Java conference circuit. He lives in Washington, D.C.

Table of Contents

preface xv
acknowledgments xviii
about this book xxii
Part 1 The Basics
1(80)
Bitter choices
3(18)
A storm of controversy
5(1)
A history of EJB antipatterns
6(3)
March 1998: EJB 1.0
7(1)
November 1999: EJB 1.1
7(1)
August 2001: EJB 2.0
8(1)
A case study: Benchmarking PetStore
9(3)
Antipattern: The Golden Hammer
12(7)
Choosing unwisely
13(2)
Solution: Evaluate carefully
15(4)
Summary: Looking ahead
19(1)
Antipatterns in this chapter
20(1)
The bitter cost
21(31)
Sparking controversy
22(8)
The value of EJB
23(1)
EJB-appropriate applications
23(2)
Using a litmus test
25(1)
Passing the test
26(1)
Weighing complexity
27(1)
Evaluating your talent
28(2)
Antipattern: A Sledgehammer for a Fly
30(11)
Adding complexity
32(1)
Solution: Simplify
33(3)
Consider the cost of managing many files
36(3)
Grading the finer points
39(2)
Entity beans are a horse of a different color
41(2)
The black sheep of the bean family
42(1)
Entity beans: Take two
43(2)
Local interfaces
44(1)
Container-managed relationships
45(1)
Entity beans---a closer look
45(5)
Employee management
45(5)
Summary
50(1)
Antipatterns in this chapter
51(1)
Bitter interfaces
52(29)
Building a good interface
53(4)
Breaking down remote invocation performance
54(1)
Passing by reference vs. value
55(2)
Designing the application tier
57(3)
Looking back on entity beans
59(1)
Questioning EJB local interfaces
59(1)
Antipattern: Local & Remote Interfaces Simultaneously
60(6)
Combined interfaces muddle exception management
61(1)
Combined interfaces hurt performance
62(1)
Mini-antipattern: Ubiquitous Distribution
63(1)
Mini-antipattern: Transparent Distribution
63(1)
Solution: Achieving equilibrium
64(1)
Knowing when to distribute
65(1)
Antipattern: Customers in the Kitchen
66(7)
Nudging the diners toward the door
68(2)
Solution: Funnel the customers through a waiter
70(1)
Using Data Transfer Objects
71(2)
Antipattern: Custom DTOs
73(4)
Solution: Refactor to preserve flexibility
75(2)
Summary
77(1)
Antipatterns in this chapter
78(3)
Part 2 Sessions and Messages
81(130)
Bitter sessions
83(43)
Threading and synchronization
85(7)
Antipattern: Tangled Threads
86(1)
Solution: Standardization to the rescue
87(1)
Coping with hung threads
88(2)
Searching for a solution
90(2)
Handling exceptions
92(7)
Mini-antipattern: Logic in Exception Implementations
92(1)
Solution: Refactor logic out of exceptions
93(1)
Antipattern: Swallowing Exceptions
94(1)
Solution: A simple exception handling strategy
95(2)
Antipattern: Killer System Exceptions
97(1)
Solution: Throw the correct exception type
98(1)
Iterating large datasets
99(12)
Antipattern: Database Connection Hog
101(2)
Solution: Manage connections with surgical precision
103(1)
Antipattern: Eager Iterator
103(3)
Solution: Test, test, test
106(1)
Caching results
107(1)
Exporting results
108(1)
Determining the size of a result set
109(1)
Iterating shuffled data
110(1)
Interoperating efficiently
111(9)
Using IIOP
112(1)
Antipattern: Narrow Servlet Bridges
113(1)
Solution: A generic servlet bridge
113(7)
Summary
120(1)
Antipatterns in this chapter
121(5)
Bitter session states
126(36)
Making a case for session state
128(1)
A pivotal antipattern: Conversational Baggage
129(5)
The burden of state
130(1)
Lightening the load
131(1)
Solution 1: Strive for statelessness
132(2)
Solution 2: Leverage session state when beneficial
134(1)
Managing sessions with stateful session beans
134(6)
Shopping using a stateful session bean
135(1)
Looking under the hood
136(4)
Managing sessions with servlets
140(3)
Keeping it simple with HttpSession
140(1)
Shopping using a servlet
141(1)
Scaling up servlet sessions
142(1)
Antipattern: Golden Hammers of Session State
143(8)
Storing sessions on the client
144(1)
Storing sessions on the server using servlets
145(2)
Storing sessions on the server using stateful EJB
147(1)
Storing sessions in a database
148(1)
Revisiting the shopping cart
149(2)
Overall solution: Pick the right tool for the job
151(1)
Mini-antipattern: Stateful Session Beans as Shared Data Caches
151(1)
Antipattern: Session Hodgepodge
152(3)
Solution: Be explicit and conservative
154(1)
Mini-antipattern: Session Thrashing
155(1)
Mini-antipattern: Rotting Session Garbage
155(1)
Summary: Taming the beast
156(1)
Antipatterns in this chapter
157(5)
Bitter messages
162(49)
A brief overview of JMS
163(2)
An early antipattern: Fat Messages
165(4)
One size doesn't fit all
167(1)
Solution 1: Put messages on a diet
167(1)
Solution 2: Use references
168(1)
Mini-antipattern: Skinny Messages
169(2)
Solution: Use state to allow lazy loading
170(1)
Seeds of an order processing system
171(6)
Defining the system
171(1)
Designing messages
172(1)
Choosing messaging models
173(1)
Responding to change
173(2)
Building the OrderRequest producer
175(2)
Antipattern: XML as the Silver Bullet
177(2)
Solution: Use XML messages judiciously
177(2)
Antipattern: Packrat
179(3)
Putting a price on persistence
179(2)
Paying for durable subscriptions
181(1)
Solution: Save only what's important
181(1)
Mini-antipattern: Immediate Reply Requested
182(2)
Using message-driven beans (MDBs)
184(4)
Pooling with MDBs
184(1)
Building the OrderRequest consumer
185(3)
Antipattern: Monolithic Consumer
188(3)
Listening to the test
188(1)
Solution: Delegate to modular components
189(2)
Antipattern: Hot Potato
191(3)
Solution: Acknowledge the message, not its result
193(1)
Antipattern: Slow Eater
194(1)
Solution: Eat faster, if you can
194(1)
Antipattern: Eavesdropping
195(4)
Solution: Use message selectors
196(1)
Declaring message selectors
197(1)
Going beyond message selectors
198(1)
Antipattern: Performance Afterthoughts
199(2)
Solution: Measure early and often
199(2)
Summary: Getting the message
201(1)
Antipatterns in this chapter
202(9)
Part 3 EJB Persistence
211(74)
Bitter entities
213(32)
Understanding entity bean antipatterns
214(1)
Understanding the entity bean antipattern landscape
214(1)
Antipattern: Face Off
215(7)
Network round-tripping chokes applications
216(1)
Losing transactional integrity
217(2)
Solution: A Session Facade
219(1)
Using a facade for transactional integrity
220(1)
Using local interfaces
220(2)
Antipattern: Ham Sandwich; Hold the Ham
222(6)
The choice between BMP and CMP
223(2)
Solution: Choose CMP when possible
225(3)
Antipattern: Application Joins
228(2)
Solution: Delegate joins to the database
228(1)
Common examples of application joins
229(1)
Antipattern: Application Filters
230(3)
Understanding the types of application filters
230(3)
Antipattern: Rusty Keys
233(2)
Solution: shorten your primary key
234(1)
Antipattern: Revolving Doors
235(4)
Solution 1: Refactor to avoid re-entrancy
237(1)
Solution 2: Disable the container's re-entrancy checking
238(1)
Solution 3: Lobby the EJB specification team
238(1)
Summary
239(1)
Antipatterns in this chapter
240(5)
Bitter alternatives
245(40)
Understanding entity bean alternatives
246(3)
Using EJB persistence
249(11)
Implementing CMP
250(3)
Adding the DTO and facade
253(4)
Including deployment details
257(2)
Rolling your own with BMP entity beans
259(1)
Simplify with JDBC
260(7)
Implementing a simple JDBC model
261(2)
Implementing the JDBC Facade
263(2)
Deploying a Session Facade for JDBC
265(2)
Using object persistence frameworks
267(8)
Surveying the object persistence landscape
267(2)
Understanding JDO
269(1)
Implementing a simple model with JDO
270(2)
Implementing the JDO model's facade
272(1)
Deploying the solution
273(1)
Comparing the options
274(1)
Antipattern: Persistent Problems
275(7)
Generic entity bean weaknesses
276(1)
Inheritance and polymorphism
276(3)
Query language flexibility is often critical
279(2)
DTOs require non-EJB solutions for local entities
281(1)
Container-bound persistence
282(1)
Solution: Do not ``inherit'' a persistence architecture---choose it
282(1)
Summary
283(1)
Antipatterns in this chapter
284(1)
Part 4 Broader Topics
285(71)
Bitter tunes
287(37)
Measures of success
289(2)
Response time
289(1)
Throughput
290(1)
Antipattern: Premature Optimization
291(5)
Tuning EJB applications blindfolded
292(1)
Solution 1: Plan, but don't act (yet)
293(1)
Solution 2: Write well-factored, modular code
294(2)
Antipattern: Performance Afterthoughts
296(2)
Solution: Plan early and often
296(2)
Grist for the tuning mill
298(5)
Putting an EJB to the test
299(1)
Passing the test
300(1)
Specifying response time as a measure of success
301(1)
Seeing light at the end of the tuning tunnel
302(1)
Antipattern: Thrash-tuning
303(2)
Solution: Use a performance testing methodology
304(1)
Mini-antipattern: Manual Performance Testing
305(2)
Solution: Automate performance testing
306(1)
Automated performance testing with JUnitPerf
307(8)
JUnitPerf overview
307(1)
Testing response time
308(1)
Tweaking code
309(1)
Specifying scalability as a measure of success
310(1)
Testing response time under load
310(2)
Using a connection pool to increase throughput
312(2)
Testing throughput
314(1)
Modeling performance
315(2)
Mini-antipattern: Stage Fright
317(1)
Solution: Practice on stage
317(1)
Summary: Tuning with confidence
318(1)
Antipatterns in this chapter
319(5)
Bitter builds
324(24)
Wrapping big packages without bows
326(6)
Understanding an example EJB
326(2)
Organizing your directory structure
328(1)
Filling the EJB JAR
329(1)
Loading classes
330(2)
Antipattern: System Loaded Application Classes
332(1)
Solution: Follow the J2EE guidelines
332(1)
Antipattern: EJB Code Duplication
332(5)
Solution: Autogenerate the EJB classes
333(1)
Solution: Autogenerate the manifest
334(2)
Solution: Autogenerate the EAR descriptor
336(1)
Antipattern: Build Guru
337(2)
Solution: Use Ant for heavy lifting
338(1)
Antipattern: Running with Scissors
339(2)
Solution: Test with impunity
339(2)
Antipattern: Integration Hell
341(1)
Solution: Integrate early, often, and automatically
341(1)
Summary
342(1)
Antipatterns in this chapter
343(5)
A bittersweet future
348(8)
Marking our place in history
349(2)
Early mistakes
349(2)
Plotting the next moves
351(4)
Into the future
351(2)
Fix persistence
353(1)
Fix the deployment strategy
354(1)
Putting the economic house in order
354(1)
Antipatterns and next moves
355(1)
A Bitter tales
356(20)
A Java development free fall
357(3)
Antipatterns in life
359(1)
Using design patterns accentuates the positive
360(2)
Design patterns online
361(1)
UML provides a language for patterns
362(1)
Antipatterns teach from the negative
362(4)
Some well-known antipatterns
363(1)
Antipatterns in practice
364(1)
Antipatterns resources
365(1)
Antipattern ideas are not new
366(4)
Learning from the industry
367(1)
Detective work
368(2)
Refactoring antipatterns
370(1)
Why Bitter Java?
370(4)
The Bitter Java approach
371(1)
Bitter Java tools
371(1)
The Bitter Java organization
372(1)
The Bitter Java audience
373(1)
Looking ahead
374(2)
B Bitter basics
376(25)
Developing in the EJB architecture
378(6)
Getting acquainted with the cast, the bean triad
378(3)
Know your host, the EJB container
381(3)
Crafting enterprise beans
384(17)
Defining the client interfaces
385(5)
Implementing the business logic
390(7)
Playing it safe with transactions
397(1)
Configuring the bean
397(2)
Packaging it
399(1)
Invoking your beans from a client
400(1)
bibliography 401(2)
index 403

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program