Merge pull request #2317 from jwillemsen/jwi-deleteop
[ACE_TAO.git] / ACE / examples / C++NPv2 / Logging_Event_Handler_Ex.h
blob3826c9a231534e06b6ce58b3021f85fa8099f5cc
1 /*
2 ** Copyright 2002 Addison Wesley. All Rights Reserved.
3 */
5 #ifndef _LOGGING_EVENT_HANDLER_EX_H
6 #define _LOGGING_EVENT_HANDLER_EX_H
8 #include "ace/Reactor.h"
9 #include "ace/Time_Value.h"
10 #include "ace/Recursive_Thread_Mutex.h"
12 #include "Logging_Event_Handler.h"
14 class Logging_Event_Handler_Ex : public Logging_Event_Handler
16 private:
17 // Time when a client last sent a log record.
18 ACE_Time_Value time_of_last_log_record_;
20 // Maximum time to wait for a client log record.
21 const ACE_Time_Value max_client_timeout_;
23 public:
24 typedef Logging_Event_Handler PARENT;
26 // 3600 seconds == one hour.
27 enum { MAX_CLIENT_TIMEOUT = 3600 };
29 Logging_Event_Handler_Ex
30 (ACE_Reactor *reactor,
31 const ACE_Time_Value &max_client_timeout
32 = ACE_Time_Value (MAX_CLIENT_TIMEOUT))
33 : Logging_Event_Handler (reactor),
34 time_of_last_log_record_ (0),
35 max_client_timeout_ (max_client_timeout) {}
37 virtual ~Logging_Event_Handler_Ex () {}
39 virtual int open (); // Activate the event handler.
41 // Called by a reactor when logging events arrive.
42 virtual int handle_input (ACE_HANDLE);
44 // Called when a timeout expires to check if the client has
45 // been idle for an excessive amount of time.
46 virtual int handle_timeout (const ACE_Time_Value &tv,
47 const void *act);
49 // Called when this object is destroyed, e.g., when it's
50 // removed from a reactor.
51 virtual int handle_close (ACE_HANDLE = ACE_INVALID_HANDLE,
52 ACE_Reactor_Mask = 0);
55 #endif /* _LOGGING_EVENT_HANDLER_EX_H */