activemq-cpp-3.9.5
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
22
25#include <decaf/net/URI.h>
26#include <decaf/lang/Pointer.h>
27#include <memory>
28
29namespace activemq {
30namespace transport {
31namespace failover {
32
34
36
37 class AMQCPP_API BackupTransport : public DefaultTransportListener {
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
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
57 BackupTransport(const BackupTransport&);
58 BackupTransport& operator=(const BackupTransport&);
59
60 public:
61
63
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_ */
#define AMQCPP_API
Definition Config.h:30
A Utility class that create empty implementations for the TransportListener interface so that a subcl...
Definition DefaultTransportListener.h:36
bool isClosed() const
Has the Transport been shutdown and no longer usable.
Definition BackupTransport.h:120
virtual void onException(const decaf::lang::Exception &ex)
Event handler for an exception from a command transport.
const Pointer< Transport > & getTransport()
Gets the currently held transport.
Definition BackupTransport.h:85
bool isPriority() const
Definition BackupTransport.h:135
void setTransport(const Pointer< Transport > transport)
Sets the held transport, if not NULL then start to listen for exceptions from the held transport.
Definition BackupTransport.h:96
decaf::net::URI getUri() const
Gets the URI assigned to this Backup.
Definition BackupTransport.h:70
void setClosed(bool value)
Sets the closed flag on this Transport.
Definition BackupTransport.h:128
BackupTransport(BackupTransportPool *failover)
void setPriority(bool value)
Set if this transport is a Priority backup or not.
Definition BackupTransport.h:145
void setUri(const decaf::net::URI &uri)
Sets the URI assigned to this Transport.
Definition BackupTransport.h:77
Definition BackupTransportPool.h:43
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
This class represents an instance of a URI as defined by RFC 2396.
Definition URI.h:37
#define NULL
Definition Config.h:33
Definition BackupTransport.h:31
Definition AbstractTransportFactory.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition CachedConsumer.h:24