Date: Thursday, March 1, 2007 @ 16:26:15
Author: marc
Path: /cvsroot/carob/carob
Modified: include/ControllerPool.hpp (1.18 -> 1.19) src/ControllerInfo.cpp
(1.16 -> 1.17) src/ControllerPool.cpp (1.25 -> 1.26)
wrapping of CodecException inside ConnectionException moved from
ControllerInfo::connect() to
ControllerPool::newRegisteredSocket(). Related to CAROB-133
----------------------------+
include/ControllerPool.hpp | 3 +--
src/ControllerInfo.cpp | 10 +---------
src/ControllerPool.cpp | 14 ++++++++++++--
3 files changed, 14 insertions(+), 13 deletions(-)
Index: carob/include/ControllerPool.hpp
diff -u carob/include/ControllerPool.hpp:1.18
carob/include/ControllerPool.hpp:1.19
--- carob/include/ControllerPool.hpp:1.18 Thu Mar 1 16:03:09 2007
+++ carob/include/ControllerPool.hpp Thu Mar 1 16:26:15 2007
@@ -24,7 +24,6 @@
#include "ControllerInfo.hpp"
#include "CarobException.hpp"
#include "CriticalSection.hpp"
-#include "StringCodecs.hpp" // CodecException. TODO: catch and throw a
ConnectionException instead
#include "Common.hpp" // for currentTimeInSeconds()
#include <vector>
#include <map>
@@ -140,7 +139,7 @@
* @return the registered socket
*/
DriverSocket* newRegisteredSocket(const ControllerInfo&
controller)
- throw (CodecException);
+ throw (ConnectionException);
/**
* Unregisters the given socket from the callback so it can no more be killed
Index: carob/src/ControllerInfo.cpp
diff -u carob/src/ControllerInfo.cpp:1.16 carob/src/ControllerInfo.cpp:1.17
--- carob/src/ControllerInfo.cpp:1.16 Thu Mar 1 12:36:03 2007
+++ carob/src/ControllerInfo.cpp Thu Mar 1 16:26:15 2007
@@ -128,16 +128,8 @@
{
const wchar_t fctName[] = L"ControllerInfo::connect()";
- DriverSocket* socketPtr;
- try {
// register the socket to our policy so it can be killed during connection
- socketPtr = pool.newRegisteredSocket(*this);
- } catch (CodecException ce) {
- std::wostringstream woss;
- woss << ce;
- logError(fctName, woss.str() );
- throw ConnectionException(ce.description(), ce.getSQLState(), &ce);
- }
+ DriverSocket *socketPtr = pool.newRegisteredSocket(*this);
// set the correct protocol family
int family = PF_INET;
Index: carob/src/ControllerPool.cpp
diff -u carob/src/ControllerPool.cpp:1.25 carob/src/ControllerPool.cpp:1.26
--- carob/src/ControllerPool.cpp:1.25 Thu Mar 1 15:48:09 2007
+++ carob/src/ControllerPool.cpp Thu Mar 1 16:26:15 2007
@@ -122,10 +122,20 @@
}
DriverSocket *AbstractControllerPool::newRegisteredSocket(const
ControllerInfo& controller)
- throw (CodecException)
+ throw (ConnectionException)
{
LockScope ls(&pool_CS);
- DriverSocket *socket = new DriverSocket(controller);
+
+ DriverSocket *socket;
+ try {
+ socket = new DriverSocket(controller);
+ } catch (CodecException ce) {
+ std::wostringstream woss;
+ woss << ce;
+ logError(L"AbstractControllerPool::newRegisteredSocket", woss.str() );
+ throw ConnectionException(ce.description(), ce.getSQLState(), &ce);
+ }
+
callback_ptr->registerSocket(controller, socket);
return socket;
}
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits