The Test Programs
Chapter 3. The Test Programs
- Table of Contents
- The Server
- The Clients
- The Server Objects
For my analysis I had one main server that is used for performing the tests or as a communication point between the clients (e.g. exchange of object references in a mesh). For each test I had a different client, but they all look quite similar. Therefore, I will outline them below and plug in the missing parts in the corresponding sections.
The Server
First, we have to set ORBacus as the used ORB (this is only necessary for JDK >=1.2). We initialize the ORB and set the concurrency model to "thread per request with a thread pool of 512 threads," just like the Ada95/AnnexE implementation Glade does. Then we incarnate a factory object and write its reference to the file ObjFactory.ref. This factory object will be used to create other objects in the server. Finally, we activate the implementation.
package Perf; public class Server { 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); // initialize ORB and BOA org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(argv, props); org.omg.CORBA.BOA boa = ((com.ooc.CORBA.ORB)orb).BOA_init(argv, props); ((com.ooc.CORBA.ORB)orb).conc_model( com.ooc.CORBA.ORB.ConcModel.ConcModelThreaded); ((com.ooc.CORBA.BOA)boa).conc_model( com.ooc.CORBA.BOA.ConcModel.ConcModelThreadPool); ((com.ooc.CORBA.BOA)boa).conc_model_thread_pool(512); // create a factory object ObjFactory_impl factory = new ObjFactory_impl(); // write factory reference to file try { String ref = orb.object_to_string(factory); String refFile = "ObjFactory.ref"; java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileOutputStream(refFile)); out.println(ref); out.flush(); out.close(); } catch (java.io.IOException e) { System.err.println("error: " + e.getMessage()); System.exit(1); } // run server boa.impl_is_ready(null); } } |
Figure 3-1. Server.java