001package headfirst.proxy.gumball;
002
003import java.rmi.Naming;
004
005public class GumballMonitorTestDrive {
006
007        public static void main(String[] args) {
008                String[] location = {"rmi://santafe.mightygumball.com/gumballmachine",
009                                "rmi://boulder.mightygumball.com/gumballmachine",
010                "rmi://seattle.mightygumball.com/gumballmachine"};
011
012                GumballMonitor[] monitor = new GumballMonitor[location.length];
013
014                for (int i=0;i < location.length; i++) {
015                        try {
016                                GumballMachineRemote machine =
017                                                (GumballMachineRemote) Naming.lookup(location[i]);
018                                monitor[i] = new GumballMonitor(machine);
019                                System.out.println(monitor[i]);
020                        } catch (Exception e) {
021                                e.printStackTrace();
022                        }
023                }
024
025                for(int i=0; i < monitor.length; i++) {
026                        monitor[i].report();
027                }
028        }
029}