activemq-cpp-3.8.2
BackupTransportPool.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_FAILOVER_BACKUPTRANSPORTPOOL_H_
19 #define _ACTIVEMQ_TRANSPORT_FAILOVER_BACKUPTRANSPORTPOOL_H_
20 
21 #include <activemq/util/Config.h>
27 
28 #include <decaf/lang/Pointer.h>
29 #include <decaf/io/IOException.h>
30 #include <decaf/util/LinkedList.h>
31 
32 namespace activemq {
33 namespace transport {
34 namespace failover {
35 
39 
40  class BackupTransportPoolImpl;
41  class FailoverTransport;
42 
44  private:
45 
46  friend class BackupTransport;
47 
48  BackupTransportPoolImpl* impl;
49 
50  FailoverTransport* parent;
53  Pointer<URIPool> uriPool;
54  Pointer<URIPool> updates;
55  Pointer<URIPool> priorityUriPool;
56  volatile int backupPoolSize;
57  volatile bool enabled;
58  volatile int maxReconnectDelay;
59 
60  public:
61 
63  const Pointer<CompositeTaskRunner> taskRunner,
64  const Pointer<CloseTransportsTask> closeTask,
65  const Pointer<URIPool> uriPool,
66  const Pointer<URIPool> updates,
67  const Pointer<URIPool> priorityUriPool);
68 
70  int backupPoolSize,
71  const Pointer<CompositeTaskRunner> taskRunner,
72  const Pointer<CloseTransportsTask> closeTask,
73  const Pointer<URIPool> uriPool,
74  const Pointer<URIPool> updates,
75  const Pointer<URIPool> priorityUriPool);
76 
77  virtual ~BackupTransportPool();
78 
82  void close();
83 
87  virtual bool isPending() const;
88 
95  Pointer<BackupTransport> getBackup();
96 
101  virtual bool iterate();
102 
107  int getBackupPoolSize() const {
108  return this->backupPoolSize;
109  }
110 
115  void setBackupPoolSize(int size) {
116  this->backupPoolSize = size;
117  }
118 
125  bool isEnabled() const {
126  return this->enabled;
127  }
128 
135  void setEnabled(bool value);
136 
143  bool isPriorityBackupAvailable() const;
144 
145  private:
146 
147  // The backups report their failure to the pool, the pool removes them
148  // from the list and returns their URIs to the URIPool, and then adds
149  // the internal transport to the close transport's task for cleanup.
150  void onBackupTransportFailure(BackupTransport* failedTransport);
151 
152  Pointer<Transport> createTransport(const decaf::net::URI& location) const;
153 
154  };
155 
156 }}}
157 
158 #endif /*_ACTIVEMQ_TRANSPORT_FAILOVER_BACKUPTRANSPORTPOOL_H_*/
#define AMQCPP_API
Definition: Config.h:30
Definition: BackupTransportPool.h:43
void setBackupPoolSize(int size)
Sets the Max number of Backups this Task will create.
Definition: BackupTransportPool.h:115
bool isEnabled() const
Gets if the backup Transport Pool has been enabled or not, when not enabled no backups are created an...
Definition: BackupTransportPool.h:125
int getBackupPoolSize() const
Gets the Max number of Backups this Task will create.
Definition: BackupTransportPool.h:107
A Task Runner that can contain one or more CompositeTasks that are each checked for pending work and ...
Definition: CompositeTaskRunner.h:40
Represents a single task that can be part of a set of Tasks that are contained in a CompositeTaskRunn...
Definition: CompositeTask.h:33
This class represents an instance of a URI as defined by RFC 2396.
Definition: URI.h:36
Definition: FailoverTransport.h:48
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: BackupTransport.h:37
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
A complete implementation of the List interface using a doubly linked list data structure.
Definition: LinkedList.h:55