Wiley - Java Enterprise Design Patterns - Patterns in Java V.3 - fly.pdf

(3175 KB) Pobierz
15339469 UNPDF
15339469.002.png
Java Enterprise
Design Patterns
Patterns in Java TM , Volume 3
MARK GRAND
MARK GRAND
John Wiley & Sons, Inc.
New York Chichester Weinheim Brisbane Singapore Toronto
Java Enterprise
Design Patterns
John Wiley & Sons, Inc.
New York Chichester Weinheim Brisbane Singapore Toronto
15339469.003.png 15339469.004.png 15339469.005.png 15339469.001.png
Publisher: Robert Ipsen
Editor: Theresa Hudson
Developmental Editor: Kathryn A. Malm
Managing Editor: Angela Smith
New Media Editor: Brian Snapp
Text Design & Composition:
Designations used by companies to distinguish their products are often claimed as
trademarks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the
product names appear in initial capital or ALL CAPITAL LETTERS. Readers, how-
ever, should contact the appropriate companies for more complete information
regarding trademarks and registration.
This book is printed on acid-free paper.
Copyright © 2002 by Mark Grand. All rights reserved.
Published by John Wiley & Sons, Inc., New York
Published simultaneously in Canada.
No part of this publication may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, electronic, mechanical, photocopying,
recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission
of the Publisher, or authorization through payment of the appropriate per-copy fee
to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978)
750-8400, fax (978) 750-4744. Requests to the Publisher for permission should be
addressed to the Permissions Department, John Wiley & Sons, Inc., 605 Third
Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-6008, E-Mail:
PERMREQ @ WILEY.COM.
This publication is designed to provide accurate and authoritative information in
regard to the subject matter covered. It is sold with the understanding that the
publisher is not engaged in professional services. If professional advice or other
expert assistance is required, the services of a competent professional person
should be sought.
Library of Congress Cataloging-in-Publication Data:
Grand, Mark.
Java Enterprise design patterns / Mark Grand.
p. cm.
ISBN 0-471-33315-8 (pbk.: alk. paper)
1. Java (Computer program language) 2. Web servers. 3. Object-
oriented programming (Computer science) I. Title.
QA76.73.J38 G72 2001
005. 13'3—dc21
2001045611
Printed in the United States of America.
10987654321
 
CONT
ENT
S
Acknowledgments
vii
About the Author
viii
Chapter 1 Introduction to Software Patterns
1
Description of Patterns
2
Pattern Name
3
Synopsis
3
Context
3
Forces
3
Solution
4
Consequences
4
Implementation
4
Known Uses
4
Code Example
4
Related Patterns
4
A Very Brief History of Patterns
5
Organization of This Book
5
 
iv
C ONTENTS
Chapter 2 Overview of UML
7
Class Diagram
8
Collaboration Diagram
18
Statechart Diagram
26
Deployment Diagram
28
Chapter 3 The Software Life Cycle
29
Chapter 4 Transaction Patterns
33
Acid Transaction
37
Composite Transaction
55
Two Phase Commit
65
Audit Trail
75
Chapter 5 Distributed Architecture Patterns
81
Shared Object
83
Object Request Broker
89
Object Replication
99
Redundant Independent Objects
109
Prompt Repair
115
Mobile Agent
119
Demilitarized Zone
129
Process Pairs
133
Chapter 6 Distributed Computing Patterns
137
Object Identifier
139
Registry
149
Protection Proxy
157
Publish-Subscribe
175
Retransmission
187
Mailbox
195
Heavyweight/Lightweight
203
Heartbeat
209
Connection Multiplexing
229
Chapter 7 Concurrency Patterns
275
Session Object
277
Lock File
285
Static Locking Order
291
Optimistic Concurrency
297
Thread Pool
303
Ephemeral Cache Item
325
Transaction State Stack
337
 
Zgłoś jeśli naruszono regulamin