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
;
48 orb
= CORBA::ORB_init (argc
, argv
);
50 if (parse_args (argc
, argv
) == -1)
53 CORBA::Object_var manager_obj
= orb
->resolve_initial_references ("RTSchedulerManager");
55 TAO_RTScheduler_Manager_var manager
= TAO_RTScheduler_Manager::_narrow (manager_obj
.in ());
57 TAO_Scheduler
* scheduler
= 0;
58 ACE_NEW_RETURN (scheduler
,
59 TAO_Scheduler (orb
.in ()),
61 safe_scheduler
= scheduler
;
63 manager
->rtscheduler (scheduler
);
66 CORBA::Object_var object
=
67 orb
->string_to_object (ior
.c_str ());
69 server
= test::_narrow (object
.in ());
71 if (CORBA::is_nil (server
.in ()))
73 ACE_ERROR_RETURN ((LM_ERROR
,
74 "ERROR: Object reference <%s> is nil\n",
79 CORBA::Object_var current_obj
= orb
->resolve_initial_references ("RTScheduler_Current");
81 RTScheduling::Current_var current
= RTScheduling::Current::_narrow (current_obj
.in ());
83 const char * name
= 0;
84 CORBA::Policy_ptr sched_param
= 0;
85 CORBA::Policy_ptr implicit_sched_param
= 0;
87 current
->begin_scheduling_segment (name
,
89 implicit_sched_param
);
92 "Making a one-way request\n"));
93 server
->one_way (ACE_TEXT_ALWAYS_CHAR(ior
.c_str ()));
96 "Making a two-way request\n"));
97 server
->two_way (ACE_TEXT_ALWAYS_CHAR(ior
.c_str ()));
99 current
->end_scheduling_segment (name
);
101 catch (const CORBA::THREAD_CANCELLED
& )
103 ACE_DEBUG ((LM_DEBUG
,
104 "Distributable Thread Cancelled - Expected Exception\n"));
107 catch (const CORBA::Exception
& ex
)
109 ex
._tao_print_exception ("Caught exception:");
116 catch (const CORBA::Exception
& ex
)
118 ex
._tao_print_exception ("Caught unexpected exception:");