33 #include <rsc/logging/Logger.h>
35 #include "../../CommException.h"
38 using namespace rsc::logging;
43 SpreadGroup::SpreadGroup(
const string& n) :
44 name(n), logger(Logger::getLogger(
"rsb.spread.SpreadGroup")) {
45 RSCDEBUG(
logger,
"new spread group object, group name: " << n);
49 RSCDEBUG(
logger,
"destructor called for group object: " <<
name);
58 if (!con->isActive()) {
59 throw runtime_error(
"Spread connection is not active");
62 int retCode = SP_join(*con->getMailbox(),
name.c_str());
69 if (!con->isActive()) {
73 int retCode = SP_leave(*con->getMailbox(),
name.c_str());
79 const std::string& actionName) {
82 RSCDEBUG(
logger, actionName <<
" spread group with name " <<
name <<
" successful");
85 msg <<
"Got error while " << actionName <<
" spread group '" <<
name
89 msg <<
"ILLEGAL_GROUP";
92 msg <<
"ILLEGAL_SESSION";
94 case CONNECTION_CLOSED:
95 msg <<
"CONNECTION_CLOSED";
98 msg <<
"Unknown spread error with code " << retCode;
101 RSCERROR(
logger,
"Error " << actionName <<
" spread group: " << msg.str());