Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / FT_Naming / stress_storable / server.cpp
blob2e3d9e031773814dd6ca168ee3245a5ceed935d9
1 #include "LB_server.h"
2 #include "Basic.h"
4 int
5 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
7 try
9 const char *location1 = "MyLocation 1";
10 const char *location2 = "MyLocation 2";
11 const char *location3 = "MyLocation 3";
12 const char *location4 = "MyLocation 4";
13 const char *location5 = "MyLocation 5";
14 const char *location6 = "MyLocation 6";
16 LB_server lb_server (argc, argv);
18 if (lb_server.start_orb_and_poa () != 0)
19 return 1;
21 if (lb_server.create_object_group () != 0)
22 return 1;
24 CosNaming::Name name (1);
25 name.length (1);
26 name[0].id = CORBA::string_dup ("basic_name");
27 try {
28 (lb_server.name_svc ())->rebind (name, lb_server.object_group ());
30 catch (const CORBA::Exception& ex)
32 ex._tao_print_exception ("Unable to bind object group in name service.\n");
33 return 1;
36 Basic *basic_servant1;
37 Basic *basic_servant2;
38 Basic *basic_servant3;
39 Basic *basic_servant4;
40 Basic *basic_servant5;
41 Basic *basic_servant6;
43 ACE_NEW_RETURN (basic_servant1,
44 Basic (lb_server.object_group (),
45 lb_server.naming_manager (),
46 lb_server.orb (),
47 location1),
48 1);
49 PortableServer::ServantBase_var owner_transfer1(basic_servant1);
51 ACE_NEW_RETURN (basic_servant2,
52 Basic (lb_server.object_group (),
53 lb_server.naming_manager (),
54 lb_server.orb (),
55 location2),
56 1);
57 PortableServer::ServantBase_var owner_transfer2(basic_servant2);
59 ACE_NEW_RETURN (basic_servant3,
60 Basic (lb_server.object_group (),
61 lb_server.naming_manager (),
62 lb_server.orb (),
63 location3),
64 1);
65 PortableServer::ServantBase_var owner_transfer3(basic_servant3);
67 ACE_NEW_RETURN (basic_servant4,
68 Basic (lb_server.object_group (),
69 lb_server.naming_manager (),
70 lb_server.orb (),
71 location4),
72 1);
73 PortableServer::ServantBase_var owner_transfer4(basic_servant4);
75 ACE_NEW_RETURN (basic_servant5,
76 Basic (lb_server.object_group (),
77 lb_server.naming_manager (),
78 lb_server.orb (),
79 location5),
80 1);
81 PortableServer::ServantBase_var owner_transfer5(basic_servant5);
83 ACE_NEW_RETURN (basic_servant6,
84 Basic (lb_server.object_group (),
85 lb_server.naming_manager (),
86 lb_server.orb (),
87 location6),
88 1);
89 PortableServer::ServantBase_var owner_transfer6(basic_servant6);
91 if (lb_server.register_servant (basic_servant1, location1) == -1
92 || lb_server.register_servant (basic_servant2, location2) == -1
93 || lb_server.register_servant (basic_servant3, location3) == -1
94 || lb_server.register_servant (basic_servant4, location4) == -1
95 || lb_server.register_servant (basic_servant5, location5) == -1
96 || lb_server.register_servant (basic_servant6, location6) == -1)
98 (void) lb_server.destroy ();
99 return 1;
102 lb_server.orb ()->run ();
104 ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
106 if (lb_server.destroy () == -1)
107 return 1;
109 catch (const CORBA::Exception& ex)
111 ex._tao_print_exception ("lb_server exception");
112 return 1;
115 return 0;