5 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
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)
21 if (lb_server
.create_object_group () != 0)
24 CosNaming::Name
name (1);
26 name
[0].id
= CORBA::string_dup ("basic_name");
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");
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 (),
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 (),
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 (),
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 (),
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 (),
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 (),
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 ();
102 lb_server
.orb ()->run ();
104 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) server - event loop finished\n"));
106 if (lb_server
.destroy () == -1)
109 catch (const CORBA::Exception
& ex
)
111 ex
._tao_print_exception ("lb_server exception");