Methods Summary |
---|
private static ActivationDesc | createActivationDesc(java.lang.String owner, Money moneyToStart)
return new ActivationDesc("com.ora.rmibook.chapter18.activation.Account_Impl", "file:/D:/Classes/",
new MarshalledObject(moneyToStart));
|
private static void | createActivationGroup()
ActivationGroupID oldID = ActivationGroup.currentGroupID();
Properties pList = new Properties();
pList.put("sun.rmi.transport.connectionTimeout", "30000");
pList.put("java.security.policy", "d:\\java.policy");
pList.put(USE_MONITORING_SOCKETS_PROPERTY, USE_MONITORING_SOCKETS_VALUE);
ActivationGroupDesc.CommandEnvironment configInfo = null;
ActivationGroupDesc description = new ActivationGroupDesc(pList, configInfo);
ActivationGroupID id = (ActivationGroup.getSystem()).registerGroup(description);
ActivationGroup.createGroup(id, description, 0);
return;
|
private static void | createBankAccount(java.lang.String owner, Money money)
try {
ActivationDesc aD = createActivationDesc(owner, money);
Account account = (Account) Account_Impl.register(aD);
Naming.rebind(owner, account);
} catch (Exception e) {
System.out.println("Failed to create account for " + owner);
e.printStackTrace();
}
|
private static void | createBankAccounts()
createActivationGroup();
createBankAccount("Jim", getRandomMoney());
createBankAccount("Jack", getRandomMoney());
createBankAccount("Julia", getRandomMoney());
|
private static Money | getRandomMoney()
int cents = (int) (Math.random() * 100000);
return new Money(cents);
|
public static void | main(java.lang.String[] args)
try {
createBankAccounts();
} catch (Exception e) {
System.out.println("Launch Failure.");
e.printStackTrace();
}
System.exit(0);
|