Home
 

The Clients

The Clients

The clients start all similar. First, we initialize the ORB. Then we read the factory reference from the file ObjFactory.ref and create an object reference. Then we get references to objects in the server, namely Barrier (which is used to synchronize clients) and Round Trip Time test objects (see the section called The Server Objects). After that, we read the test parameters from the command line, perform the test and print the used time. Details for the tests are shown in the corresponding sections.

package Perf;

public class xxxClient
{
    public static void main(String argv[])
    {
        // set ORBACUS as ORB
        java.util.Properties props = System.getProperties();
        props.put("org.omg.CORBA.ORBClass", "com.ooc.CORBA.ORB");
        props.put("org.omg.CORBA.ORBSingletonClass",
                  "com.ooc.CORBA.ORBSingleton");
        System.setProperties(props);

        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(argv, props);

        // load factory reference from file
        String ref = null;
        try {
            String refFile = "ObjFactory.ref";
            java.io.BufferedReader in = new java.io.BufferedReader(
                new java.io.FileReader(refFile));
            ref = in.readLine();
        }
        catch (java.io.IOException e) {
            System.err.println("error: " + e.getMessage());
            System.exit(1);
        }

        org.omg.CORBA.Object obj = orb.string_to_object(ref);
        ObjFactory factory = ObjFactoryHelper.narrow(obj);

        Barrier b = null;
        while (b == null) {
            try {
                b = factory.getBarrier();
            }
            catch (Exception e) {}
        }

        // read parameters from commandline

        // run tests

        // print required RTT
    }
}

Figure 3-2. xxxClient.java