2 #include "ace/Time_Value.h"
3 #include "ace/Get_Opt.h"
6 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
11 CORBA::ORB_init (argc
, argv
);
13 CORBA::Object_var poa_object
=
14 orb
->resolve_initial_references("RootPOA");
16 PortableServer::POA_var root_poa
=
17 PortableServer::POA::_narrow (poa_object
.in ());
19 if (CORBA::is_nil (root_poa
.in ()))
20 ACE_ERROR_RETURN ((LM_ERROR
,
21 " (%P|%t) Panic: nil RootPOA\n"),
24 PortableServer::POAManager_var poa_manager
=
25 root_poa
->the_POAManager ();
28 ACE_NEW_RETURN (foobar_impl
,
32 PortableServer::ObjectId_var id
=
33 root_poa
->activate_object (foobar_impl
);
35 CORBA::Object_var object
= root_poa
->id_to_reference (id
.in ());
38 Test::Foo::_narrow (object
.in ());
40 poa_manager
->activate ();
42 // Dont unscope it or move it elsewhere.. It is here with a
43 // purpose. If you dont understand this, please re-read the
46 PortableServer::ServantBase_var
owner_transfer (foobar_impl
);
49 ACE_Time_Value
tv (10,
52 // Just run the ORB for a minute..
56 "(%P|%t) server - shutting down the ORB\n"));
61 "(%P|%t) Finished shutting down the ORB\n"));
63 root_poa
->destroy (true, true);
67 catch (const CORBA::Exception
& ex
)
69 ex
._tao_print_exception ("Exception caught:");
74 "(%P|%t) Test successful..\n"));