next up previous
Next: Design of ARC User Up: Application Development Process Previous: Implementation of ARC Object

Originator Application

Below is an example originator code. The originator program invokes a creation request on the factory class available under the generated namespace corresponding to the ARC object interface. After creation, the program sends instance of class Real to an anonymous remote machine and executes a local method in parallel. Finally the program blocks through a call to method sync() till the migrated ARC object retracts.

Note that the HPF value obtained through the HPF service represent a machine on which the ARC object migrates. The remote machine remains anonymous to the originator application program. After executing a predefined task in its trigger specification the object retracts. In the meanwhile the originator performs an activity in parallel.


namespace testHello{
  public class HelloClass{
    public static void Main(){
    // 1. Connect to local HPFServer
       UserInterface_HPFVector.IUser hpfvector; 
       UserInterface_HPFServer.IUser hpfserver =  
            (UserInterface_HPFServer.IUser)Activator.GetObject(
                        typeof(UserInterface_HPFServer.IUser),
                        "tcp://localhost:8105/HPFServerClass" );
   // 2. get HPFVector
       hpfvector = hpfserver.getHPFVector(1);
       int i  = hpfvector.SizeOfHPFVector();
       UserInterface_HPFValue.IUser hpf1=null;
       hpf1 = hpfvector.getHPFValue(0);
   // 3. Instantiate an ARCObject
       NSIMyObject.IContainer arcobject = NSIMyObject.Factory.New();
   // 4. send created object to remote machine
       arcobject.push(hpf1);
   // 5. do any work in parallel 
       Console.WriteLine(``to be executed in parallel'');
   // 6. wait for object to come back
       arcobject.sync();
   // 7. end of program  
       Console.WriteLine(``the end'');
    }
  }
}



R K Joshi 2003-05-08