1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/* -*- C++ -*- */
// $Id$
//
// ============================================================================
//
// = LIBRARY
// ORBSVCS Notification
//
// = FILENAME
// Notify_Default_EMO_Factory.h
//
// = DESCRIPTION
// Default factory for event manager and its helper objects.
//
// = AUTHOR
// Pradeep Gore <pradeep@cs.wustl.edu>
//
// ============================================================================
#ifndef NOTIFY_DEFAULT_EMO_FACTORY_H
#define NOTIFY_DEFAULT_EMO_FACTORY_H
#include "ace/pre.h"
#include "notify_export.h"
#include "Notify_Event_Manager_Objects_Factory.h"
#include "ace/Service_Config.h"
#include "ace/Singleton.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
// @@ Pradeep: I appretiate the separation of concerns from having
// multiple factories, but consider that some configurations of
// Collection, Locks, and dispatchers don't go well together. The
// purpose of an Abstract Factory is to have a single object that
// returns consistently configured objects....
class TAO_EMO_Options // Options read by service conf.
{
public:
TAO_EMO_Options (void);
// Params read via the svc.conf
CORBA::Boolean mt_dispatching_;
CORBA::Boolean mt_source_eval_;
CORBA::Boolean mt_lookup_;
CORBA::Boolean mt_listener_eval_;
CORBA::Boolean asynch_updates_;
CORBA::Boolean alloc_task_per_proxy_;
int dispatching_threads_;
int source_threads_;
int lookup_threads_;
int listener_threads_;
};
class TAO_Notify_Export TAO_Notify_Default_EMO_Factory : public TAO_Notify_EMO_Factory
{
public:
TAO_Notify_Default_EMO_Factory (void);
~TAO_Notify_Default_EMO_Factory ();
static int init_svc (void);
// Helper function to register the default factory into the service
// configurator.
// = The Service_Object entry points
virtual int init (int argc, char* argv[]);
virtual int fini (void);
virtual TAO_Notify_Event_Manager* create_event_manager (TAO_Notify_EventChannel_i* channel, CORBA::Environment &ACE_TRY_ENV);
// Create an event manager.
virtual TAO_Notify_Event_Map* create_event_map (CORBA::Environment &ACE_TRY_ENV);
// Create the event map.
virtual TAO_Notify_Event_Processor* create_event_processor (TAO_Notify_Event_Manager* event_manager, CORBA::Environment &ACE_TRY_ENV);
// Create event processor.
// = Create processing tasks.
virtual TAO_Notify_Worker_Task* create_source_eval_task (CORBA::Environment &ACE_TRY_ENV);
virtual TAO_Notify_Worker_Task* create_lookup_task (CORBA::Environment &ACE_TRY_ENV);
virtual TAO_Notify_Worker_Task* create_listener_eval_task ( CORBA::Environment &ACE_TRY_ENV);
virtual TAO_Notify_Worker_Task* create_dispatching_task (CORBA::Environment &ACE_TRY_ENV);
virtual TAO_Notify_Worker_Task* create_updates_task (CORBA::Environment &ACE_TRY_ENV);
virtual void destroy_source_eval_task (TAO_Notify_Worker_Task* task);
virtual void destroy_lookup_task (TAO_Notify_Worker_Task* task);
virtual void destroy_listener_eval_task (TAO_Notify_Worker_Task* task);
virtual void destroy_dispatching_task (TAO_Notify_Worker_Task* task);
virtual void destroy_updates_task (TAO_Notify_Worker_Task* task);
virtual void print_values (void);
int init_instance ();
protected:
//= Protected Methods
TAO_Notify_Worker_Task* create_task (int mt, int tp_size,CORBA::Environment &ACE_TRY_ENV);
// Create a worker task, mt => is this a MT task, if so, tp_size is thread pool size.
int preallocate_tasks (void);
//= Data Members
TAO_Notify_Worker_Task* prealloc_source_eval_task_;
TAO_Notify_Worker_Task* prealloc_listener_eval_task_;
TAO_Notify_Worker_Task* prealloc_dispatching_task_;
};
// Typedef an Options Singleton.
typedef ACE_Singleton <TAO_EMO_Options, ACE_Null_Mutex> EMO_OPTIONS;
ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory)
ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_EMO_Factory)
#include "ace/post.h"
#endif /* NOTIFY_DEFAULT_EMO_FACTORY_H */
|