2 //=============================================================================
6 * An activity is a process that contains Tasks.
7 * Each Task is composed of certain units of Jobs.
8 * A Job can perform work that is local/remote.
9 * Each Job is identified with a name.
11 * @author Pradeep Gore <pradeep@cs.wustl.edu>
13 //=============================================================================
17 #include "ace/Singleton.h"
18 #include "ace/Sched_Params.h"
19 #include "orbsvcs/CosNamingC.h"
20 #include "tao/RTPortableServer/RTPortableServer.h"
21 #include "tao/RTCORBA/Priority_Mapping_Manager.h"
22 #include "ace/Null_Mutex.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 ACE_END_VERSIONED_NAMESPACE_DECL
35 * @brief Driver class that maintains the orb and collections of objects for
36 * generating activity in this process.
40 friend class ACE_Singleton
<Activity
, ACE_Null_Mutex
>;
47 /// initialize the ORB et. al.
48 int init (int& argc
, ACE_TCHAR
*argv
[]);
51 /// Activate the tasks, jobs, poas.
52 void run (int argc
, ACE_TCHAR
*argv
[]);
54 /// Resolve the naming service.
55 int resolve_naming_service ();
58 CORBA::ORB_ptr
orb ();
59 RTCORBA::Current_ptr
current ();
60 void builder (Builder
* builder
);
62 /// Returns priority if server declared model else -1
63 CORBA::Short
get_server_priority (CORBA::Object_ptr server
);
65 /// Task ended notification
66 void task_ended (Periodic_Task
* ended_task
);
68 /// Job shutdown notification
69 void job_ended (Job_i
* ended_job
);
72 /// = Activation methods.
73 /// Activate the POA's
74 void activate_poa_list ();
76 /// Activate the task list.
77 void activate_schedule ();
79 /// Activate the Job's
80 void activate_job_list ();
82 /// Check if we should process exit
85 /// Create a file whose name is specified in the -Started_Flag <file_name> argument at startup.
86 /// This file flags that the Activity has finished its bootstrapping step.
87 void create_started_flag_file (int argc
, ACE_TCHAR
*argv
[]);
91 /// The Builder object.
94 /// ACE_Barrier to synch. tasks.
95 ACE_Barrier
* barrier_
;
97 /// Mutex to serialize access to our internal state.
98 ACE_Lock
* state_lock_
;
100 /// The ORB that we use.
104 RTCORBA::RTORB_var rt_orb_
;
107 RTCORBA::Current_var current_
;
109 /// Reference to the root poa.
110 PortableServer::POA_var root_poa_
;
112 /// A naming context.
113 CosNaming::NamingContextExt_ptr naming_
;
115 /// The Priority Mapping helper.
116 RTCORBA::PriorityMapping
*priority_mapping_
;
118 /// Count the number of periodic tasks active.
119 int active_task_count_
;
121 /// Count the number of Jobs active
122 int active_job_count_
;
125 typedef ACE_Singleton
<Activity
, ACE_Null_Mutex
> ACTIVITY
;
127 #endif /* ACTIVITY_H */