// Sample2/App.java
//##########################################################
// App Class Implementation (Distributed Implementation)
//##########################################################
//
public class App
{
public App()
{
// Using local : uncomment the next block
// #######################################
// A = new Aclass();
// #######################################
//
// Using remote : uncomment the next block
// #######################################
A = new AclassCI();
try
{
A.setVerboseFlag(true);// remove to stop messages ..
A.createServerInstance("127.0.0.1",6789);
}catch(Exception e)
{System.out.println(e.getMessage());}
// #######################################
//
}
public int doCalculation(int D)
{
return A.addTwo(D); // Call an Aclass method
}
//#### DATA MEMBERS ####
// Using local : uncomment the next block
// #######################################
// Aclass A;
// #######################################
//
// Using remote : uncomment the next block
// #######################################
AclassCI A;
// #######################################
//
public static void main(String argv[])
{
App S = new App();
int result = S.doCalculation(5);
System.out.println("The result of the calculation = "
+ result+ " (and should = 7)");
}
}