KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > memoryusage > Client


1 package test.memoryusage;
2
3 import org.omg.CosNaming.*;
4
5 public class Client
6 {
7     public static void main(String JavaDoc args[])
8     {
9         int objects = 0;
10
11         try
12         {
13             //Client
14
System.out.println(">testing client...");
15
16             org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init(args,null);
17
18             NamingContextExt nc =
19                 NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
20             SessionFactory df =
21                 SessionFactoryHelper.narrow(nc.resolve(nc.to_name("SessionFactory")));
22             for (objects = 0; objects < 1000000; objects++)
23             {
24                 Session session = df.get_Session("AS", "", "", "");
25                 String JavaDoc sessionID = session.getID();
26                 df.releaseSession(session);
27                 //session._release();
28
// Thread.sleep(1);
29
};
30             System.out.println(">done.");
31     }
32     catch(Exception JavaDoc e)
33     {
34             System.err.println("loops so far: " + objects);
35             System.err.println("ERROR: " + e);
36             e.printStackTrace(System.out);
37         }
38     }
39 }
40
41
42
43
Popular Tags