没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Copyright
Table of Contents
Index
Full Description
About the Author
Reviews
Reader reviews
Errata
Java RMI
William Grosso
Publisher: O'Reilly
First Edition October 2001
ISBN: 1-56592-452-5, 572 pages
By GiantDino
With Java RMI, you'll learn tips and tricks for making your RMI code
excel. This book provides strategies for working with serialization,
threading, the RMI registry, sockets and socket factories, activation,
dynamic class downloading, HTTP tunneling, distributed garbage
collection, JNDI, and CORBA. In short, a treasure trove of valuable
RMI knowledge packed into one book.
Java RMI
Dedication
Preface
About This Book
About the Example Code
Conventions Used in This Book
For Further Information
How to Contact Us
Acknowledgments
I: Designing and Building: The Basics of RMI Applications
1. Streams
1.1 The Core Classes
1.2 Viewing a File
1.3 Layering Streams
1.4 Readers and Writers
2. Sockets
2.1 Internet Definitions
2.2 Sockets
2.3 ServerSockets
2.4 Customizing Socket Behavior
2.5 Special-Purpose Sockets
2.6 Using SSL
3. A Socket-Based Printer Server
3.1 A Network-Based Printer
3.2 The Basic Objects
3.3 The Protocol
3.4 The Application Itself
3.5 Evolving the Application
4. The Same Server, Written Using RMI
4.1 The Basic Structure of RMI
4.2 The Architecture Diagram Revisited
4.3 Implementing the Basic Objects
4.4 The Rest of the Server
4.5 The Client Application
4.6 Summary
5. Introducing the Bank Example
5.1 The Bank Example
5.2 Sketching a Rough Architecture
5.3 The Basic Use Case
5.4 Additional Design Decisions
5.5 A Distributed Architecturefor the Bank Example
5.6 Problems That Arise in Distributed Applications
6. Deciding on the Remote Server
6.1 A Little Bit of Bias
6.2 Important Questions WhenThinking About Servers
6.3 Should We Implement Bank or Account?
7. Designing the Remote Interface
7.1 Important Questions When Designing Remote Interfaces
7.2 Building the Data Objects
7.3 Accounting for Partial Failure
8. Implementing the Bank Server
8.1 The Structure of a Server
8.2 Implementing the Server
8.3 Generating Stubs and Skeletons
9. The Rest of the Application
9.1 The Need for Launch Code
9.2 Our Actual Launch Code
9.3 Build Test Applications
9.4 Build the Client Application
9.5 Deploying the Application
II: Drilling Down: Scalability
10. Serialization
10.1 The Need for Serialization
10.2 Using Serialization
10.3 How to Make a Class Serializable
10.4 The Serialization Algorithm
10.5 Versioning Classes
10.6 Performance Issues
10.7 The Externalizable Interface
11. Threads
11.1 More Than One Client
11.2 Basic Terminology
11.3 Threading Concepts
11.4 Support for Threads in Java
11.5 Deadlock
11.6 Threading and RMI
12. Implementing Threading
12.1 The Basic Task
12.2 Guidelines for Threading
12.3 Pools: An Extended Example
12.4 Some Final Words on Threading
13. Testing a Distributed Application
13.1 Testing the Bank Application
14. The RMI Registry
14.1 Why Use a Naming Service?
14.2 The RMI Registry
14.3 The RMI Registry Is an RMI Server
14.4 Examining the Registry
14.5 Limitations of the RMI Registry
14.6 Security Issues
15. Naming Services
15.1 Basic Design, Terminology,and Requirements
15.2 Requirements for Our Naming Service
15.3 Federation and Threading
15.4 The Context Interface
15.5 The Value Objects
15.6 ContextImpl
15.7 Switching Between Naming Services
15.8 The Java Naming and Directory Interface (JNDI)
16. The RMI Runtime
16.1 Reviewing the Mechanics of a Remote Method Call
16.2 Distributed Garbage Collection
16.3 RMI's Logging Facilities
16.4 Other JVM Parameters
17. Factories and the Activation Framework
17.1 Resource Management
17.2 Factories
17.3 Implementing a Generic Factory
17.4 A Better Factory
17.5 Persistence and the Server Lifecycle
17.6 Activation
17.7 A Final Word About Factories
III: Advanced Topics
18. Using Custom Sockets
18.1 Custom Socket Factories
18.2 Incorporating a Custom Socket into an Application
19. Dynamic Classloading
19.1 Deploying Can Be Difficult
19.2 Classloaders
19.3 How Dynamic Classloading Works
19.4 The Class Server
19.5 Using Dynamic Classloadingin an Application
20. Security Policies
20.1 A Different Kind of Security Problem
20.2 Permissions
20.3 Security Managers
20.4 Setting Up a Security Policy
21. Multithreaded Clients
21.1 Different Types of Remote Methods
21.2 Handling Printer-Type Methods
21.3 Handling Report-Type Methods
21.4 Generalizing from These Examples
22. HTTP Tunneling
22.1 Firewalls
22.2 CGI and Dynamic Content
22.3 HTTP Tunneling
22.4 A Servlet Implementationof HTTP Tunneling
22.5 Modifying the Tunneling Mechanism
22.6 The Bank via HTTP Tunneling
22.7 Drawbacks of HTTP Tunneling
22.8 Disabling HTTP Tunneling
23. RMI, CORBA, and RMI/IIOP
23.1 How CORBA Works
23.2 The Bank Example in CORBA
23.3 A Quick Comparison of CORBA and RMI
23.4 RMI on Top of CORBA
23.5 Converting the Bank Example to RMI/IIOP
Colophon
Preface
This book is intended for Java developers who want to build distributed applications. By a
distributed application, I mean a set of programs running in different processes (and quite
possibly on different machines) which form, from the point of view of the end user, a single
application.
[1]
The latest version of the Java platform, Java 2 (and the associated standard
extension libraries), includes extensive support for building distributed applications.
[1]
In this book, program will always refer to Java code executing inside a single Java virtual machine (JVM).
Application, on the other hand, refers to one or more programs executing inside one or more JVMs that, to
the end user, appear to be a single program.
In this book, I will focus on Java's Remote Method Invocation (RMI) framework. RMI is a robust
and effective way to build distributed applications in which all the participating programs are
written in Java. Because the designers of RMI assumed that all the participating programs would
be written in Java, RMI is a surprisingly simple and easy framework to use. Not only is RMI useful
for building distributed applications, it is an ideal environment for Java programmers learning how
to build a distributed application.
I don't assume you know anything about distributed programs or computer networking. We'll start
from the ground up and cover all the concepts, classes, and ideas underlying RMI. I will also
cover some of the more advanced aspects of Java programming; it would be irresponsible to
write a book on RMI without devoting some space to topics such as sockets and threading.
In order to get the most out of this book, you will need a certain amount of experience with the
Java programming language. You should be comfortable programming in Java; you should have
a system with which you can experiment with the code examples (like many things, distributed
programming is best learned by doing); you should be fairly comfortable with the basics of the
JDK 1.1 event model (in particular, many of the code examples are action listeners that have
been added to a button); and you should be willing to make mistakes along the way.
About This Book
This book covers an enormous amount of ground, starting with streams and sockets and working
its way through the basics of building scalable client-server architectures using RMI.
While the order of chapters is a reasonable one, and one that has served me well in introducing
RMI to my students at U.C. Berkeley Extension, it is nonetheless the case that skipping around
can sometimes be beneficial. For example, Chapter 10, which discusses object serialization,
really relies only on streams (from Chapter 1) and can profitably be read immediately after
Chapter 4 (where the first RMI application is introduced).
The book is divided into three sections. Part I starts with an introduction to some of the essential
background material for RMI. After presenting the basics of Java's stream and socket libraries,
we build a simple socket-based distributed application and then rebuild this application using
RMI. At this point, we've actually covered most of the basics of building a simple RMI application.
The rest of Part I (Chapters Chapter 5 through Chapter 9) presents a fairly detailed analysis of
how introducing a network changes the various aspects of application design. These chapters
culminate in a set of principles for partitioning an application into clients and servers and for
designing client-server interaction. Additionally, they introduce an example from banking which is
referred to repeatedly in the remainder of the book. After finishing the first section, you will be
able to design and build simple RMI applications that, while not particularly scalable or robust,
can be used in a variety of situations.
Part II builds on the first by drilling down on the underlying technologies and discussing the
implementation decisions that must be made in order to build scalable and secure distributed
applications. That is, the first section focuses on the design issues associated with the client-
server boundary, and the second section discusses how to make the server scale. As such, this
section is less about RMI, or the network interface, and more about how to use the underlying
Java technologies (e.g., how to use threads). These chapters can be tough sledding™ this is the
technical heart of the book.
Part III consists of a set of independent chapters discussing various advanced features of RMI.
The distinction between the second and third sections is that everything covered in the second
section is essential material for building a sophisticated RMI application (and hence should be at
least partially understood by any programmer involved in the design or implementation of an RMI
剩余466页未读,继续阅读
资源评论
- xwy_1232013-12-18讲解很详细 对初学很有帮助
- xingyang59092012-11-14对RMI的介绍很详细,有助于理解
yiranwuqing
- 粉丝: 8
- 资源: 87
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功