1 #include "../Scheduler.h"
2 #include "tao/RTScheduling/RTScheduler_Manager.h"
4 #include "ace/Get_Opt.h"
5 #include "ace/SString.h"
7 ACE_TString ior
= ACE_TEXT("file://test.ior");
13 // Parse command line arguments
14 ACE_Get_Opt
opts (argc
, argv
, ACE_TEXT("f:"));
17 while ((c
= opts ()) != -1)
22 ior
= ACE_TEXT("file://");
23 ior
+= opts
.opt_arg ();
26 ACE_DEBUG ((LM_DEBUG
, "Unknown Option\n"));
33 #if defined (THREAD_CANCELLED)
34 #undef THREAD_CANCELLED
35 #endif /* THREAD_CANCELLED */
38 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
42 RTScheduling::Scheduler_var safe_scheduler
;
49 orb
= CORBA::ORB_init (argc
, argv
);
51 if (parse_args (argc
, argv
) == -1)
54 CORBA::Object_var manager_obj
= orb
->resolve_initial_references ("RTSchedulerManager");
56 TAO_RTScheduler_Manager_var manager
= TAO_RTScheduler_Manager::_narrow (manager_obj
.in ());
58 TAO_Scheduler
* scheduler
= 0;
59 ACE_NEW_RETURN (scheduler
,
60 TAO_Scheduler (orb
.in ()),
62 safe_scheduler
= scheduler
;
64 manager
->rtscheduler (scheduler
);
67 CORBA::Object_var object
=
68 orb
->string_to_object (ior
.c_str ());
70 server
= test::_narrow (object
.in ());
72 if (CORBA::is_nil (server
.in ()))
74 ACE_ERROR_RETURN ((LM_ERROR
,
75 "ERROR: Object reference <%s> is nil\n",
80 CORBA::Object_var current_obj
= orb
->resolve_initial_references ("RTScheduler_Current");
82 RTScheduling::Current_var current
= RTScheduling::Current::_narrow (current_obj
.in ());
84 const char * name
= 0;
85 CORBA::Policy_ptr sched_param
= 0;
86 CORBA::Policy_ptr implicit_sched_param
= 0;
88 current
->begin_scheduling_segment (name
,
90 implicit_sched_param
);
93 "Making a one-way request\n"));
94 server
->one_way (ACE_TEXT_ALWAYS_CHAR(ior
.c_str ()));
97 "Making a two-way request\n"));
98 server
->two_way (ACE_TEXT_ALWAYS_CHAR(ior
.c_str ()));
100 current
->end_scheduling_segment (name
);
103 catch (const CORBA::THREAD_CANCELLED
& )
105 ACE_DEBUG ((LM_DEBUG
,
106 "Distributable Thread Cancelled - Expected Exception\n"));
109 catch (const CORBA::Exception
& ex
)
111 ex
._tao_print_exception ("Caught exception:");
118 catch (const CORBA::Exception
& ex
)
120 ex
._tao_print_exception ("Caught unexpected exception:");