Line | |
---|
1 | #include "ConnectionRequiredRunnable.h"
|
---|
2 |
|
---|
3 | using namespace apache::thrift::concurrency;
|
---|
4 | using std::string;
|
---|
5 |
|
---|
6 | ConnectionRequiredRunnable::ConnectionRequiredRunnable(boost::shared_ptr<ConnectionStatusMonitor>& connectionMonitor, const string& name)
|
---|
7 | : connectionMonitor_(connectionMonitor),
|
---|
8 | threadName_(name),
|
---|
9 | connectMonitor_(),
|
---|
10 | disconnectMonitor_(),
|
---|
11 | stop_(false)
|
---|
12 | {
|
---|
13 | }
|
---|
14 |
|
---|
15 | void
|
---|
16 | ConnectionRequiredRunnable::connectionLost()
|
---|
17 | {
|
---|
18 | }
|
---|
19 |
|
---|
20 | void
|
---|
21 | ConnectionRequiredRunnable::connectionEstablished()
|
---|
22 | {
|
---|
23 | connectMonitor_.notifyAll();
|
---|
24 | }
|
---|
25 |
|
---|
26 | void
|
---|
27 | ConnectionRequiredRunnable::disconnected()
|
---|
28 | {
|
---|
29 | connectionMonitor_->disconnected(this);
|
---|
30 | disconnectMonitor_.notifyAll();
|
---|
31 | }
|
---|
32 |
|
---|
33 | void
|
---|
34 | ConnectionRequiredRunnable::connectWait()
|
---|
35 | {
|
---|
36 | if (connectionMonitor_->connected()) return;
|
---|
37 | connectMonitor_.waitForever();
|
---|
38 | }
|
---|
39 |
|
---|
40 | void
|
---|
41 | ConnectionRequiredRunnable::disconnectWait()
|
---|
42 | {
|
---|
43 | if (!connectionMonitor_->connected()) return;
|
---|
44 | disconnectMonitor_.waitForever();
|
---|
45 | }
|
---|
46 |
|
---|
47 | void
|
---|
48 | ConnectionRequiredRunnable::stop()
|
---|
49 | {
|
---|
50 | stop_ = true;
|
---|
51 | connectMonitor_.notifyAll();
|
---|
52 | disconnectMonitor_.notifyAll();
|
---|
53 | }
|
---|
54 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.