EC_TPC_Dispatching.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_TPC_Dispatching.h
00005  *
00006  *  $Id: EC_TPC_Dispatching.h 80166 2007-12-03 13:53:49Z sowayaa $
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 (int nthreads,
00043                           int thread_creation_flags,
00044                           int thread_priority,
00045                           int force_activate,
00046                           TAO_EC_Queue_Full_Service_Object* so);
00047   ~TAO_EC_TPC_Dispatching ();
00048 
00049   // = The EC_Dispatching methods.
00050   virtual void activate (void);
00051   virtual void shutdown (void);
00052   virtual void push (TAO_EC_ProxyPushSupplier* proxy,
00053                      RtecEventComm::PushConsumer_ptr consumer,
00054                      const RtecEventComm::EventSet& event,
00055                      TAO_EC_QOS_Info& qos_info);
00056   virtual void push_nocopy (TAO_EC_ProxyPushSupplier* proxy,
00057                             RtecEventComm::PushConsumer_ptr consumer,
00058                             RtecEventComm::EventSet& event,
00059                             TAO_EC_QOS_Info& qos_info);
00060 
00061   int add_consumer (RtecEventComm::PushConsumer_ptr consumer);
00062   int remove_consumer (RtecEventComm::PushConsumer_ptr consumer);
00063 
00064 private:
00065   // Use our own thread manager
00066   ACE_Thread_Manager thread_manager_;
00067 
00068   /// The number of active tasks
00069   int nthreads_;
00070 
00071   /// The flags (THR_BOUND, THR_NEW_LWP, etc.) used to create the
00072   /// dispatching threads.
00073   int thread_creation_flags_;
00074 
00075   /// The priority of the dispatching threads.
00076   int thread_priority_;
00077 
00078   /// If activation at the requested priority fails then we fallback on
00079   /// the defaults for thread activation.
00080   int force_activate_;
00081 
00082   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;
00083 
00084   // Tweak the default size of this map by #defining
00085   //    TAO_EC_TPC_DISPATCHING_DEFAULT_MAP_SIZE
00086   MAPTYPE consumer_task_map_;
00087 
00088   // Lock for modifying the map.  It's not enough to have a lock only
00089   // on the map, because we have to hold the map constant while doing
00090   // multiple distinct map manipulations, such as in remove_consumer().
00091   TAO_SYNCH_MUTEX lock_;
00092 
00093   // Service object information
00094   TAO_EC_Queue_Full_Service_Object* queue_full_service_object_;  // @@ who will release?
00095                                 // @@ check to see how the factory gets released...
00096 };
00097 
00098 TAO_END_VERSIONED_NAMESPACE_DECL
00099 
00100 #include /**/ "ace/post.h"
00101 #endif /* TAO_EC_TPC_DISPATCHING_H */

Generated on Tue Feb 2 17:44:06 2010 for TAO_RTEvent by  doxygen 1.4.7