00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_TCPRECONNECTTASK_H 00009 #define OPENDDS_TCPRECONNECTTASK_H 00010 00011 #include /**/ "ace/pre.h" 00012 00013 #include "dds/DCPS/transport/framework/QueueTaskBase_T.h" 00014 00015 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00016 # pragma once 00017 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00018 00019 namespace OpenDDS { 00020 namespace DCPS { 00021 00022 class TcpConnection; 00023 00024 enum ReconnectOpType { 00025 DO_RECONNECT 00026 }; 00027 00028 /** 00029 * @class TcpReconnectTask 00030 * 00031 * @brief Active Object managing a queue of reconnecting request. 00032 * 00033 * This task handles request to reconnect to the remotes to avoid the 00034 * the caller threads (thread to send or reactor thread) block on reconnecting. 00035 * This reconnect task has lifetime as TcpConnection object. One reconnect 00036 * task just dedicates to a single connection. 00037 */ 00038 class TcpReconnectTask : public QueueTaskBase <ReconnectOpType> { 00039 public: 00040 00041 /// Constructor. 00042 TcpReconnectTask(TcpConnection* con); 00043 00044 /// Virtual Destructor. 00045 virtual ~TcpReconnectTask(); 00046 00047 /// Handle reconnect requests. 00048 virtual void execute(ReconnectOpType& op); 00049 00050 private: 00051 00052 /// The connection that needs be re-established. 00053 TcpConnection* connection_; 00054 }; 00055 00056 } // namespace DCPS 00057 } // namespace OpenDDS 00058 00059 #include /**/ "ace/post.h" 00060 00061 #endif /* OPENDDS_TCPRECONNECTTASK_H */