activemq-cpp-3.8.2
InactivityMonitor.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_TRANSPORT_INACTIVITY_INACTIVITYMONITOR_H_
19 #define _ACTIVEMQ_TRANSPORT_INACTIVITY_INACTIVITYMONITOR_H_
20 
21 #include <activemq/util/Config.h>
22 
26 
27 #include <decaf/lang/Pointer.h>
28 #include <decaf/util/Properties.h>
29 
30 namespace activemq {
31 namespace transport {
32 namespace inactivity {
33 
35 
36  class ReadChecker;
37  class WriteChecker;
38  class AsyncSignalReadErrorkTask;
39  class AsyncWriteTask;
40  class InactivityMonitorData;
41 
43  private:
44 
45  // Internal Class used to house the data structures for this object
46  InactivityMonitorData* members;
47 
48  friend class ReadChecker;
49  friend class AsyncSignalReadErrorkTask;
50  friend class WriteChecker;
51  friend class AsyncWriteTask;
52 
53  private:
54 
56  InactivityMonitor operator=(const InactivityMonitor&);
57 
58  public:
59 
61  const Pointer<wireformat::WireFormat> wireFormat);
62 
64  const decaf::util::Properties& properties,
65  const Pointer<wireformat::WireFormat> wireFormat);
66 
67  virtual ~InactivityMonitor();
68 
69  public: // TransportFilter Methods
70 
71  virtual void onException(const decaf::lang::Exception& ex);
72 
73  virtual void onCommand(const Pointer<Command> command);
74 
75  virtual void oneway(const Pointer<Command> command);
76 
77  public:
78 
79  bool isKeepAliveResponseRequired() const;
80 
81  void setKeepAliveResponseRequired(bool value);
82 
83  long long getReadCheckTime() const;
84 
85  void setReadCheckTime(long long value);
86 
87  long long getWriteCheckTime() const;
88 
89  void setWriteCheckTime(long long value);
90 
91  long long getInitialDelayTime() const;
92 
93  void setInitialDelayTime(long long value) const;
94 
95  protected:
96 
97  virtual void afterNextIsStarted();
98 
99  virtual void beforeNextIsStopped();
100 
101  virtual void doClose();
102 
103  private:
104 
105  // Throttles read checking
106  bool allowReadCheck(long long elapsed);
107 
108  // Performs a Read Check on the current connection, called from a separate Thread.
109  void readCheck();
110 
111  // Perform a Write Check on the current connection, called from a separate Thread.
112  void writeCheck();
113 
114  // Stops all the monitoring Threads, cannot restart once called.
115  void stopMonitorThreads();
116 
117  // Starts the monitoring Threads,
118  void startMonitorThreads();
119 
120  };
121 
122 }}}
123 
124 #endif /* _ACTIVEMQ_TRANSPORT_INACTIVITY_INACTIVITYMONITOR_H_ */
#define AMQCPP_API
Definition: Config.h:30
Definition: InactivityMonitor.h:42
Runnable class that is used by the {.
Definition: ReadChecker.h:37
A filter on the transport layer.
Definition: TransportFilter.h:44
Runnable class used by the {.
Definition: WriteChecker.h:38
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: Exception.h:38
Java-like properties class for mapping string names to string values.
Definition: Properties.h:53
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53