activemq-cpp-3.9.5
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
22
26
27#include <decaf/lang/Pointer.h>
29
30namespace activemq {
31namespace transport {
32namespace inactivity {
33
35
36 class ReadChecker;
37 class WriteChecker;
38 class AsyncSignalReadErrorkTask;
39 class AsyncWriteTask;
40 class InactivityMonitorData;
41
42 class AMQCPP_API InactivityMonitor : public TransportFilter {
43 private:
44
45 // Internal Class used to house the data structures for this object
46 InactivityMonitorData* members;
47
48 friend class ReadChecker;
50 friend class WriteChecker;
51 friend class AsyncWriteTask;
52
53 private:
54
55 InactivityMonitor(const InactivityMonitor&);
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
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
80
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
Pointer< Transport > next
The transport that this filter wraps around.
Definition TransportFilter.h:54
friend class AsyncWriteTask
Definition InactivityMonitor.h:51
friend class WriteChecker
Definition InactivityMonitor.h:50
friend class AsyncSignalReadErrorkTask
Definition InactivityMonitor.h:49
virtual void onException(const decaf::lang::Exception &ex)
Event handler for an exception from a command transport.
virtual void onCommand(const Pointer< Command > command)
Event handler for the receipt of a command.
friend class ReadChecker
Definition InactivityMonitor.h:48
virtual void beforeNextIsStopped()
Subclasses can override this method to do their own pre-stop work.
InactivityMonitor(const Pointer< Transport > next, const Pointer< wireformat::WireFormat > wireFormat)
virtual void afterNextIsStarted()
Subclasses can override this method to do their own post startup work.
virtual void doClose()
Subclasses can override this method to do their own close work.
InactivityMonitor(const Pointer< Transport > next, const decaf::util::Properties &properties, const Pointer< wireformat::WireFormat > wireFormat)
virtual void oneway(const Pointer< Command > command)
Sends a one-way command.
Runnable class that is used by the {.
Definition ReadChecker.h:37
Runnable class used by the {.
Definition WriteChecker.h:38
Definition Exception.h:38
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
Java-like properties class for mapping string names to string values.
Definition Properties.h:53
Definition InactivityMonitor.h:32
Definition AbstractTransportFactory.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24