/* * A Simple Plan */ package edu.ucsb.cs.jicos.examples.computeexception; import edu.ucsb.cs.jicos.services.*; import java.rmi.*; /** * @author Peter Cappello * @version 1.0 */ public class Application { public static void main (String args[]) throws Exception { // get Hsp machine's domain name from the command line. String hspDomainName = args[ 0 ]; // get a reference to a Host Service Provider HspAgent agent = new HspAgent( hspDomainName ); Client2Hsp hsp = agent.getClient2Hsp(); // login Environment environment = new Environment( null, null ); hsp.login( environment ); // compute //Task task = new BadTask(); Task task = new BadFibonacci( 5 ); try { Integer notlikely = (Integer) hsp.compute( task ); } catch( ComputeException exception ) { System.out.println( exception.getMessage() ); exception.printStackTrace(); System.exit( 1 ); } // logout Invoice invoice = hsp.logout(); // not executed System.out.println( invoice ); } }