Pro .NET 1.1 Remoting Reflection and Threading.pdf
(
6543 KB
)
Pobierz
674241320 UNPDF
Pro .NET 1.1 Remoting,
Reflection, and Threading
TOBIN TITUS, SYED FAHAD GILANI, MIKE GILLESPIE, JAMES HART,
BENNY K. MATHEW, ANDY OLSEN, DAVID CURRAN, JON PINNOCK,
ROBIN PARS, FABIO CLAUDIO FERRACCHIATI, SANDRA GOPIKRISHNA,
TEJASWI REDKAR, SRINIVASA SIVAKUMAR
Pro .NET 1.1 Remoting, Reflection, and Threading
Copyright © 2005 by Tobin Titus, Syed Fahad Gilani, Mike Gillespie, James Hart, Benny K. Mathew,
Andy Olsen, David Curran, Jon Pinnock, Robin Pars, Fabio Claudio Ferracchiati, Sandra Gopikrishna,
Tejaswi Redkar, Srinivasa Sivakumar
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN: 1-59059-452-5
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Ewan Buckingham
Technical Reviewers: Rick Delorme, Don Reamey
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, Jason Gilmore,
Jonathan Hassell, Chris Mills, Dominic Shakeshaft, Jim Sumser
Assistant Publisher: Grace Wong
Project Manager: Beckie Stones
Copy Manager: Nicole LeClerc
Copy Editor: Julie McNamee
Production Manager: Kari Brooks-Copony
Production Editor: Kelly Winquist
Compositor: Kinetic Publishing Services, LLC
Proofreader: Patrick Vincent
Indexer: Michael Brinkman
Artist: Kinetic Publishing Services, LLC
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street, 6th
Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergarten-
str. 17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail
orders@springer-ny.com
, or visit
http://www.springer-ny.com
. Outside the United States: fax +49 6221 345229, e-mail
orders@springer.de
,
or visit
http://www.springer.de
.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail
info@apress.com
, or visit
http://www.apress.com
.
The information in this book is distributed on an “as is” basis, without warranty. Although every precau-
tion has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liabil-
ity to any person or entity with respect to any loss or damage caused or alleged to be caused directly or
indirectly by the information contained in this work.
The source code for this book is available to readers at
http://www.apress.com
in the Downloads section.
For my wife, Carol for being a solid rock and support in my career. For my parents, who
continue to teach their sons, no matter how old they get. To my brother, Rick, for showing
me that happiness isn’t achieved, it’s a choice. To my grandparents, for their sacrifices to get
us where we are today, their stories of life in a better time, their bear hugs that seem to get
stronger every year, and baked goods that my mouth waters for at the very thought of them.
My aunts and uncles, cousins, and nieces for always making room in their schedules for me
at a moment’s notice when I come home to visit.
Contents at a Glance
About the Author
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Technical Reviewers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
CHAPTER 1
Introducing .NET Remoting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
CHAPTER 2
Remoting Basics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 3
Custom Remoting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
CHAPTER 4
Configuration and Deployment
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
CHAPTER 5
Asynchronous Remoting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
CHAPTER 6
Debugging and Error Handling
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
CHAPTER 7
Flexible Programming
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
CHAPTER 8
Examining Assemblies, Objects, and Types
. . . . . . . . . . . . . . . . . . . . 223
CHAPTER 9
Using Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
CHAPTER 10
Creating Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
CHAPTER 11
Attributes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
CHAPTER 12
The .NET Component Model
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
CHAPTER 13
Defining Threads
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
CHAPTER 14
Threading in .NET
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
CHAPTER 15
Working with Threads
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
CHAPTER 16
Threading Models
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
CHAPTER 17
Scaling Threaded Applications
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
CHAPTER 18
Debugging and Tracing Threads
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
CHAPTER 19
Networking and Threading
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
INDEX
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619
v
Contents
About the Author
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
About the Technical Reviewers
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Acknowledgments
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
CHAPTER 1
Introducing .NET Remoting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Distributed Systems
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Client-Server Models
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Evolution of Distributed Systems
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Using .NET Remoting
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Remote Object Types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Context
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Managing Remote Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
The Remoting Process
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
CHAPTER 2
Remoting Basics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
.NET Remoting Classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Classes Associated with Marshaling
. . . . . . . . . . . . . . . . . . . . . . . . . . 16
Channel Classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
.NET Remoting Code Example
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Marshaling User-Defined Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Marshaling User-Defined Objects by Value
. . . . . . . . . . . . . . . . . . . . . 22
Marshaling User-Defined Objects by Reference
. . . . . . . . . . . . . . . . . 25
MBR Activation Modes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Server-Activated Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Client-Activated Objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Dynamically Publishing Server-Activated Objects
. . . . . . . . . . . . . . . 31
MBR Lifetime Management
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
A Closer Look at Leased-Based Lifetimes
. . . . . . . . . . . . . . . . . . . . . . 36
Manipulating Leases
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Renewing Leases
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Summary
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
vii
■
■
Plik z chomika:
r41lblast
Inne pliki z tego folderu:
A Tester's Guide to .NET Programming.pdf
(20132 KB)
A Programmer's Introduction to PHP 4.0.pdf
(4311 KB)
Accelerated CSharp 2010.pdf
(7008 KB)
Accelerated CSharp 2008.pdf
(6166 KB)
Adobe Coldfusion Anthology.pdf
(31579 KB)
Inne foldery tego chomika:
Pliki dostępne do 01.06.2025
C#
c# - C sharp
Dokumenty
Galeria
Zgłoś jeśli
naruszono regulamin