00001 // -*- C++ -*- 00002 00003 /** 00004 * @file ThreadPool_Task.h 00005 * 00006 * $Id: ThreadPool_Task.h 81422 2008-04-24 12:33:29Z johnnyw $ 00007 * 00008 * @author Pradeep Gore <pradeep@oomworks.com> 00009 */ 00010 00011 #ifndef TAO_Notify_THREADPOOL_TASK_H 00012 #define TAO_Notify_THREADPOOL_TASK_H 00013 00014 #include /**/ "ace/pre.h" 00015 00016 #include "orbsvcs/Notify/notify_serv_export.h" 00017 00018 #include "orbsvcs/Notify/Timer_Queue.h" 00019 #include "orbsvcs/Notify/AdminProperties.h" 00020 #include "orbsvcs/Notify/Worker_Task.h" 00021 00022 #include "ace/Task.h" 00023 #include "ace/Message_Queue.h" 00024 #include "ace/Reactor.h" 00025 #include "ace/Null_Condition.h" 00026 00027 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00028 # pragma once 00029 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00030 00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00032 00033 class TAO_Notify_Buffering_Strategy; 00034 00035 /** 00036 * @class TAO_Notify_ThreadPool_Task 00037 * 00038 * @brief Implements a Thread Pool Worker Task. 00039 * 00040 */ 00041 class TAO_Notify_Serv_Export TAO_Notify_ThreadPool_Task 00042 : public TAO_Notify_Worker_Task 00043 , public ACE_Task<ACE_NULL_SYNCH> 00044 { 00045 friend class TAO_Notify_Method_Request_Shutdown; 00046 00047 public: 00048 /// Constructor 00049 TAO_Notify_ThreadPool_Task (void); 00050 00051 /// Destructor 00052 virtual ~TAO_Notify_ThreadPool_Task (); 00053 00054 /// Call the base class init 00055 virtual int init (int argc, ACE_TCHAR **argv); 00056 00057 /// release reference to my self. 00058 virtual int close (u_long flags); 00059 00060 /// Activate the threadpool 00061 void init (const NotifyExt::ThreadPoolParams& tp_params, const TAO_Notify_AdminProperties::Ptr& admin_properties); 00062 00063 /// Queue the request 00064 virtual void execute (TAO_Notify_Method_Request& method_request); 00065 00066 /// Shutdown task 00067 virtual void shutdown (); 00068 00069 /// Update QoS Properties. 00070 virtual void update_qos_properties (const TAO_Notify_QoSProperties& qos_properties); 00071 00072 /// The object used by clients to register timers. 00073 virtual TAO_Notify_Timer* timer (void); 00074 00075 /// Provide access to the underlying buffering strategy 00076 TAO_Notify_Buffering_Strategy* buffering_strategy (void); 00077 00078 protected: 00079 /// Task svc 00080 virtual int svc (void); 00081 00082 private: 00083 /// Release 00084 virtual void release (void); 00085 00086 /// The buffering strategy to use. 00087 ACE_Auto_Ptr< TAO_Notify_Buffering_Strategy > buffering_strategy_; 00088 00089 /// Shutdown 00090 bool shutdown_; 00091 00092 /// The Queue based timer. 00093 TAO_Notify_Timer_Queue::Ptr timer_; 00094 }; 00095 00096 00097 TAO_END_VERSIONED_NAMESPACE_DECL 00098 00099 #include /**/ "ace/post.h" 00100 00101 #endif /* TAO_Notify_THREADPOOL_TASK_H */