001package edu.pdx.cs410J.rmi;
002
003import java.rmi.NotBoundException;
004import java.rmi.RemoteException;
005import java.rmi.registry.LocateRegistry;
006
007/**
008 * This program shutdowns the remote movie database.
009 */
010public class ShutdownMovieDatabase {
011
012  public static void main(String[] args) {
013    String host = args[0];
014    int port = Integer.parseInt(args[1]);
015
016    try {
017      MovieDatabase db = (MovieDatabase) LocateRegistry.getRegistry(host, port).lookup(MovieDatabase.RMI_OBJECT_NAME);
018      db.shutdown();
019      System.exit(0);
020
021    } catch (RemoteException | NotBoundException ex) {
022      ex.printStackTrace(System.err);
023      System.exit(1);
024    }
025
026  }
027
028}