EC_TPC_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_TPC_Dispatching.h
00005  *
00006  *  EC_TPC_Dispatching.h,v 1.6 2006/03/14 06:14:25 jtc Exp
00007  *
00008  *  @author Chris Cleeland <cleeland at ociweb.com>
00009  *
00010  */
00011 
00012 #ifndef TAO_EC_TPC_DISPATCHING_H
00013 #define TAO_EC_TPC_DISPATCHING_H
00014 #include /**/ "ace/pre.h"
00015 
00016 #include "ace/Hash_Map_Manager_T.h"
00017 #include "ace/Null_Mutex.h"
00018 
00019 #include "orbsvcs/Event/EC_Dispatching.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "orbsvcs/Event/EC_TPC_Dispatching_Task.h"
00026 
00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 class TAO_EC_Event_Channel_Base;
00030 
00031 /**
00032  * @class TAO_EC_TPC_Dispatching
00033  *
00034  * @brief Dispatching strategy that isolates deliveries to a consumer from any other.
00035  *
00036  * This strategy uses a thread per consumer, and was specifically designed to
00037  * isolate the effects of an ill-behaved consumer from affecting other consumers.
00038  */
00039 class TAO_RTEvent_Serv_Export TAO_EC_TPC_Dispatching : public TAO_EC_Dispatching
00040 {
00041 public:
00042   TAO_EC_TPC_Dispatching (TAO_EC_Queue_Full_Service_Object* so);
00043   ~TAO_EC_TPC_Dispatching ();
00044 
00045   // = The EC_Dispatching methods.
00046   virtual void activate (void);
00047   virtual void shutdown (void);
00048   virtual void push (TAO_EC_ProxyPushSupplier* proxy,
00049                      RtecEventComm::PushConsumer_ptr consumer,
00050                      const RtecEventComm::EventSet& event,
00051                      TAO_EC_QOS_Info& qos_info
00052                      ACE_ENV_ARG_DECL);
00053   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00054                             RtecEventComm::PushConsumer_ptr consumer,
00055                             RtecEventComm::EventSet& event,
00056                             TAO_EC_QOS_Info& qos_info
00057                             ACE_ENV_ARG_DECL);
00058 
00059   int add_consumer (RtecEventComm::PushConsumer_ptr consumer ACE_ENV_ARG_DECL);
00060   int remove_consumer (RtecEventComm::PushConsumer_ptr consumer ACE_ENV_ARG_DECL);
00061 
00062 private:
00063   // Use our own thread manager
00064   ACE_Thread_Manager thread_manager_;
00065 
00066   typedef ACE_Hash_Map_Manager_Ex<RtecEventComm::PushConsumer_ptr,TAO_EC_Dispatching_Task*,ACE_Pointer_Hash<RtecEventComm::PushConsumer_ptr>,ACE_Equal_To<RtecEventComm::PushConsumer_ptr>,ACE_Null_Mutex> MAPTYPE;
00067 
00068   // Tweak the default size of this map by #defining
00069   //    TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE
00070   MAPTYPE consumer_task_map_;
00071 
00072   // Lock for modifying the map.  It's not enough to have a lock only
00073   // on the map, because we have to hold the map constant while doing
00074   // multiple distinct map manipulations, such as in remove_consumer().
00075   ACE_SYNCH_MUTEX lock_;
00076 
00077   // Service object information
00078   TAO_EC_Queue_Full_Service_Object* queue_full_service_object_;  // @@ who will release?
00079                                 // @@ check to see how the factory gets released...
00080 };
00081 
00082 TAO_END_VERSIONED_NAMESPACE_DECL
00083 
00084 #include /**/ "ace/post.h"
00085 #endif /* TAO_EC_TPC_DISPATCHING_H */

Generated on Thu Nov 9 13:11:09 2006 for TAO_RTEvent by doxygen 1.3.6