activemq-cpp-3.6.0
BackupTransport.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 _ACTIVE_TRANSPORT_FAILOVER_BACKUPTRANSPORT_H_
19 #define _ACTIVE_TRANSPORT_FAILOVER_BACKUPTRANSPORT_H_
20 
21 #include <activemq/util/Config.h>
22 
25 #include <decaf/net/URI.h>
26 #include <decaf/lang/Pointer.h>
27 #include <memory>
28 
29 namespace activemq {
30 namespace transport {
31 namespace failover {
32 
34 
35  class BackupTransportPool;
36 
38  private:
39 
40  // The parent of this Backup
41  BackupTransportPool* parent;
42 
43  // The Transport this one is managing.
44  Pointer<Transport> transport;
45 
46  // The URI of this Backup
47  decaf::net::URI uri;
48 
49  // Indicates that the contained transport is not valid any longer.
50  bool closed;
51 
52  // Is this Transport one of the priority backups.
53  bool priority;
54 
55  private:
56 
58  BackupTransport& operator=(const BackupTransport&);
59 
60  public:
61 
63 
64  virtual ~BackupTransport();
65 
71  return this->uri;
72  }
73 
77  void setUri(const decaf::net::URI& uri) {
78  this->uri = uri;
79  }
80 
86  return transport;
87  }
88 
96  void setTransport(const Pointer<Transport> transport) {
97  this->transport = transport;
98 
99  if (this->transport != NULL) {
100  this->transport->setTransportListener(this);
101  }
102  }
103 
113  virtual void onException(const decaf::lang::Exception& ex);
114 
120  bool isClosed() const {
121  return this->closed;
122  }
123 
128  void setClosed(bool value) {
129  this->closed = value;
130  }
131 
135  bool isPriority() const {
136  return this->priority;
137  }
138 
145  void setPriority(bool value) {
146  this->priority = value;
147  }
148  };
149 
150 }}}
151 
152 #endif /* _ACTIVE_TRANSPORT_FAILOVER_BACKUPTRANSPORT_H_ */