Java Reference
In-Depth Information
Bank2Impl[] account =
{new Bank2Impl(111111,"Smith",
"Fred James",112.58),
new Bank2Impl(222222,"Jones","Sally",507.85),
new Bank2Impl(234567,"White",
"Mary Jane",2345.00),
new Bank2Impl(666666,"Satan",
for (int i=0; i<account.length; i++)
int acctNum = account[i].getAcctNum();
Generate each account name (as a concatenation
of 'Account' and the account number) and bind
it to the appropriate object reference in the
Naming.rebind("rmi://" + HOST + "/Account"
+ acctNum, account[i]);
System.out.println("Binding complete…\n");
4. Create the client process.
The client again uses method lookup , this time to obtain references to individual
accounts (held in separate implementation objects):
import java.rmi.*;
public class Bank2Client
private static fi nal String HOST = "localhost";
private static fi nal int[] acctNum =
public static void main(String[] args)
//Simply display all account details…
for (int i=0; i<acctNum.length; i++)
Obtain a reference to the object from the
registry and typecast it into the
appropriate type…
Search WWH ::

Custom Search