5 * @author Pradeep Gore <pradeep@oomworks.com>
8 #ifndef TAO_Notify_SUPPLIER_H
9 #define TAO_Notify_SUPPLIER_H
10 #include /**/ "ace/pre.h"
12 #include "ORB_Objects.h"
13 #include "tao/RTCORBA/RTCORBA.h"
14 #include "orbsvcs/CosNotifyChannelAdminS.h"
15 #include "orbsvcs/CosNotifyCommC.h"
16 #include "ace/Condition_Thread_Mutex.h"
18 #define TEST_MAX_CONSUMERS 10
21 * @class TAO_Notify_ThreadPool_Supplier
23 * @brief Implement a Structured Supplier.
25 class TAO_Notify_ThreadPool_Supplier
26 : public POA_CosNotifyComm::StructuredPushSupplier
30 TAO_Notify_ThreadPool_Supplier (TAO_Notify_ORB_Objects
& orb_objects
);
33 void init (CosNotifyChannelAdmin::SupplierAdmin_var
& admin
, int expected_consumer_count
, int max_events
,
34 int proxy_consumer_thread_count
);
40 // = Protected Methods
42 /// Connect the Supplier to the EventChannel.
43 /// Creates a new proxy consumer and connects to it.
46 /// Disconnect the supplier.
53 virtual void send_event (const CosNotification::StructuredEvent
& event
);
56 virtual ~TAO_Notify_ThreadPool_Supplier ();
59 virtual void subscription_change (
60 const CosNotification::EventTypeSeq
& added
,
61 const CosNotification::EventTypeSeq
& removed
);
63 // = StructuredPushSupplier method
64 virtual void disconnect_structured_push_supplier ();
68 TAO_Notify_ORB_Objects orb_objects_
;
70 /// The proxy that we are connected to.
71 CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_
;
73 /// This supplier's id.
74 CosNotifyChannelAdmin::ProxyID proxy_consumer_id_
;
76 /// Number of Consumers expected to connect.
77 int expected_consumer_count_
;
79 // The ORB that we use.
83 CosNotifyChannelAdmin::SupplierAdmin_var admin_
;
85 /// Lock to serialize internal state.
86 TAO_SYNCH_MUTEX lock_
;
88 /// Condition that consumers are connected.
89 TAO_SYNCH_CONDITION consumers_connected_
;
91 /// Number of consumers connected.
94 /// Number of events to send.
97 /// Number of Threads at the ProxyConsumer.
98 int proxy_consumer_thread_count_
;
100 /// Array of events to send.
101 CosNotification::StructuredEvent event_
[TEST_MAX_CONSUMERS
];
104 #include /**/ "ace/post.h"
105 #endif /* TAO_Notify_SUPPLIER_H */