import Calculations.*;
import org.omg.CORBA.*;

public class Server 
{
  public static void main(String args[])
  {
    try{
    
      // Create and initialize the ORB
      ORB orb = ORB.init(args, null);
      
      // Create the servant and register it with the ORB
      ComputeImpl compute = new ComputeImpl();
      Compute computeRef = new _ComputeTie(compute);
      orb.connect(computeRef);
      System.out.println("Compute Instance is: "+ orb.object_to_string(computeRef));

      // Create the servant and register it with the ORB
      GreatComputeImpl greatcompute = new GreatComputeImpl();
      GreatCompute greatcomputeRef = new _GreatComputeTie(greatcompute);
      orb.connect(greatcomputeRef);
      System.out.println("GreatCompute Instance is: "+ orb.object_to_string(greatcomputeRef));
      
      // Wait for invocations from clients
      java.lang.Object sync = new java.lang.Object();
      synchronized(sync){
        sync.wait();
      }
      
    } catch(Exception e) {
        System.err.println("ERROR: " + e);
        e.printStackTrace(System.out);
      }  
  }

}
