shows a class,
Bank, that contains
inner classes and interfaces for a remote bank client/server example.
In this example, the
interface defines remote methods to open and close accounts, deposit
and withdraw money, check the account balance, and obtain the
transaction history for an account. The
Bank class contains all of the classes and
interfaces required for the example, except for the server class,
which is the class that actually implements the
RemoteBank interface. This server class is
shown in Example
Example 21-1 defines the following inner classes and interfaces:
implemented by the bank server and used by the bank
A trivial class that represents money in this
banking example. It is nothing more than a wrapper around an
int, but it serves to
objects can be passed as arguments to remote methods and
returned by remote methods.
A simple exception subclass that represents banking-related exceptions, such as "Insufficient funds." It demonstrates that remote method implementations on a server can throw exceptions that are transported across the network and thrown in the client program.
This class is a standalone program that serves as
a simple client to the bank server. It uses
Naming.lookup( ) to look up the
RemoteBank object in
the system registry and then invokes various methods of that
RemoteBank object, depending on its ...