00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Flushing_Strategy.h 00006 * 00007 * $Id: Flushing_Strategy.h 80603 2008-02-11 22:14:39Z johnc $ 00008 * 00009 * @author Carlos O'Ryan <coryan@uci.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_FLUSHING_STRATEGY_H 00014 #define TAO_FLUSHING_STRATEGY_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/orbconf.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00025 class ACE_Time_Value; 00026 ACE_END_VERSIONED_NAMESPACE_DECL 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 class TAO_Transport; 00031 class TAO_Queued_Message; 00032 00033 /** 00034 * @class TAO_Flushing_Strategy 00035 * 00036 * @brief Define the interface for the flushing strategy, i.e. the 00037 * algorithm that controls how does the ORB flush outgoing 00038 * data. 00039 * 00040 * Please read the documentation in the TAO_Transport class to find 00041 * out more about the design of the outgoing data path. 00042 * 00043 * Some applications can block the current thread whenever they are 00044 * sending out data. In those cases they can obtain better 00045 * performance by blocking in calls to write() than by participating 00046 * in the Leader/Followers protocol to shared the ORB Reactor. 00047 * 00048 * This strategy controls how does the ORB schedule and cancel 00049 * reactive I/O, if there is no reactive I/O the strategy is just a 00050 * no-op. 00051 * 00052 */ 00053 class TAO_Flushing_Strategy 00054 { 00055 public: 00056 /// Destructor 00057 virtual ~TAO_Flushing_Strategy (void); 00058 00059 enum SCHEDULE_OUTPUT_RETURN { MUST_FLUSH = -2 }; 00060 00061 /// Schedule the transport argument to be flushed 00062 /// If -2 is returned then the caller must call one of 00063 /// the flush_* methods. 00064 /// If -1 is returned then there was an error. 00065 /// If 0 is returned then the flush was scheduled successfully. 00066 virtual int schedule_output (TAO_Transport *transport) = 0; 00067 00068 /// Cancel all scheduled output for the transport argument 00069 virtual int cancel_output (TAO_Transport *transport) = 0; 00070 00071 /// Wait until msg is sent out. Potentially other messages are 00072 /// flushed too, for example, because there are ahead in the queue. 00073 virtual int flush_message (TAO_Transport *transport, 00074 TAO_Queued_Message *msg, 00075 ACE_Time_Value *max_wait_time) = 0; 00076 00077 /// Wait until the transport has no messages queued. 00078 virtual int flush_transport (TAO_Transport *transport, ACE_Time_Value *max_wait_time) = 0; 00079 }; 00080 00081 TAO_END_VERSIONED_NAMESPACE_DECL 00082 00083 #include /**/ "ace/post.h" 00084 00085 #endif /* TAO_FLUSHING_STRATEGY_H */