Date: Wednesday, January 25, 2006 @ 23:07:40
Author: gilles
Path: /cvsroot/carob/carob
Modified: include/ConnectionParameters.hpp (1.15 -> 1.16)
src/ConnectionParameters.cpp (1.13 -> 1.14)
Added failure number field used by AbstractControllerConnectPolicy to determine
the order in which controllers failed
----------------------------------+
include/ConnectionParameters.hpp | 9 +++++++++
src/ConnectionParameters.cpp | 17 ++++++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
Index: carob/include/ConnectionParameters.hpp
diff -u carob/include/ConnectionParameters.hpp:1.15
carob/include/ConnectionParameters.hpp:1.16
--- carob/include/ConnectionParameters.hpp:1.15 Tue Jan 24 11:06:11 2006
+++ carob/include/ConnectionParameters.hpp Wed Jan 25 23:07:40 2006
@@ -63,11 +63,20 @@
* @return sql query as a string
*/
operator std::wstring () const;
+ /** Sets the failure number */
+ void setFailureNumber(int n) { failure_number = n; }
+ /** Gets the failure number */
+ int getFailureNumber() const { return failure_number; }
private:
/** String representation of the host name, fully qualified or IP address */
std::wstring host_name;
/** Host port */
in_port_t host_port;
+ /**
+ * Failure number (since start of process) associated to the last failure of
+ * this controller (set and used only by AbstractControllerConnectPolicy)
+ */
+ int failure_number;
};
/**
Index: carob/src/ConnectionParameters.cpp
diff -u carob/src/ConnectionParameters.cpp:1.13
carob/src/ConnectionParameters.cpp:1.14
--- carob/src/ConnectionParameters.cpp:1.13 Tue Jan 24 11:06:11 2006
+++ carob/src/ConnectionParameters.cpp Wed Jan 25 23:07:40 2006
@@ -27,12 +27,17 @@
using namespace CarobNS;
-ControllerInfo::ControllerInfo() : host_name(L""), host_port(0)
+ControllerInfo::ControllerInfo() :
+ host_name(L""),
+ host_port(0),
+ failure_number(0)
{
}
ControllerInfo::ControllerInfo(const wstring &name, in_port_t port) :
- host_name(name), host_port(port)
+ host_name(name),
+ host_port(port),
+ failure_number(0)
{
}
@@ -40,17 +45,23 @@
{
host_name = ci.host_name;
host_port = ci.host_port;
+ failure_number = ci.failure_number;
return *this;
}
bool ControllerInfo::operator ==(const ControllerInfo& ci) const
{
+ //don't compare failure #
return ((host_name == ci.host_name) && (host_port == ci.host_port));
}
ControllerInfo::operator std::wstring() const
{
- return (host_name + toWString((int)host_port));
+ std::wostringstream buffer;
+ buffer<<host_name<<L":"<<host_port;
+ if (failure_number>0)
+ buffer<<L" controller failure #"<<failure_number;
+ return buffer.str();
}
ConnectionParameters::ConnectionParameters(
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits