Remove dynamic exceptions
[anna.git] / source / comm / Communicator.cpp
index 171405c..eb115a1 100644 (file)
@@ -89,7 +89,7 @@ Communicator::~Communicator() {
 }
 
 void Communicator::setRecoveryTime(const Millisecond &recoveryTime)
-throw(RuntimeException) {
+noexcept(false) {
   if(recoveryTime < MinRecoveryTime || recoveryTime > MaxRecoveryTime) {
     string msg("comm::Communicator::setRecoveryTime | ");
     msg += functions::asString("RecoveryTime (%d ms) must be between %d ms and %d ms", recoveryTime.getValue(), MinRecoveryTime.getValue(), MaxRecoveryTime.getValue());
@@ -100,7 +100,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::setTryingConnectionTime(const Millisecond &tryingConnectionTime)
-throw(RuntimeException) {
+noexcept(false) {
   if(tryingConnectionTime < MinTryingConnectionTime || tryingConnectionTime > MaxTryingConnectionTime) {
     string msg("comm::Communicator::setTryingConnectionTime | ");
     msg += functions::asString("TryingConnectionTime (%d ms) must be between %d ms and %d ms", tryingConnectionTime.getValue(), MinTryingConnectionTime.getValue(), MaxTryingConnectionTime.getValue());
@@ -112,7 +112,7 @@ throw(RuntimeException) {
 
 //static
 void Communicator::setReceivingChunkSize(const int receivingChunkSize)
-throw(RuntimeException) {
+noexcept(false) {
   if(receivingChunkSize < MinReceivingChunkSize || receivingChunkSize > MaxReceivingChunkSize) {
     string msg("comm::Communicator::setReceivingChunkSize | ");
     msg += functions::asString("ReceivingChunkSize (%d bytes) must be between %d bytes and %d bytes", receivingChunkSize, MinReceivingChunkSize, MaxReceivingChunkSize);
@@ -124,7 +124,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::setLevelOfDenialService(const int levelOfDenialService)
-throw(RuntimeException) {
+noexcept(false) {
   const int min(comm::CongestionController::MaxLevel - 2);
   const int max(comm::CongestionController::MaxLevel);
 
@@ -138,7 +138,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(ServerSocket* serverSocket)
-throw(RuntimeException) {
+noexcept(false) {
   if(serverSocket == NULL)
     throw RuntimeException("Cannot attach a NULL comm::ServerSocket", ANNA_FILE_LOCATION);
 
@@ -156,7 +156,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(BinderSocket* binderSocket)
-throw(RuntimeException) {
+noexcept(false) {
   if(binderSocket == NULL)
     throw RuntimeException("Cannot attach a NULL comm::BinderSocket", ANNA_FILE_LOCATION);
 
@@ -176,7 +176,7 @@ throw(RuntimeException) {
  * Se invoca desde  comm::handler::ServerSocket::accept [Tx] -> <null>
  */
 void Communicator::attach(LocalConnection* localConnection)
-throw(RuntimeException) {
+noexcept(false) {
   if(localConnection == NULL)
     throw RuntimeException("Cannot attach a NULL comm::LocalConnection", ANNA_FILE_LOCATION);
 
@@ -230,7 +230,7 @@ throw(RuntimeException) {
  * los métodos Communicator::attach.
  */
 void Communicator::attach(RemoteConnection* remoteConnection)
-throw(RuntimeException) {
+noexcept(false) {
   if(remoteConnection == NULL)
     throw RuntimeException("Cannot attach a NULL comm::RemoteConnection", ANNA_FILE_LOCATION);
 
@@ -245,7 +245,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(ClientSocket* socket)
-throw(RuntimeException) {
+noexcept(false) {
   if(socket == NULL)
     throw RuntimeException("Cannot attach a NULL comm::ClientSocket", ANNA_FILE_LOCATION);
 
@@ -260,7 +260,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(DatagramSocket* socket)
-throw(RuntimeException) {
+noexcept(false) {
   if(socket == NULL)
     throw RuntimeException("Cannot attach a NULL comm::DatagramSocket", ANNA_FILE_LOCATION);
 
@@ -275,7 +275,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(Handler* handler)
-throw(RuntimeException) {
+noexcept(false) {
   if(handler == NULL)
     throw RuntimeException("Cannot attach a NULL comm::Handler", ANNA_FILE_LOCATION);
 
@@ -292,7 +292,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::attach(Service* service)
-throw(RuntimeException) {
+noexcept(false) {
   if(service == NULL)
     throw RuntimeException("Cannot attach a NULL comm::Service", ANNA_FILE_LOCATION);
 
@@ -312,7 +312,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::insert(Handler* handler)
-throw(RuntimeException) {
+noexcept(false) {
   handler->initialize();
 
   if(handler->getfd() < 0) {
@@ -345,7 +345,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::detach(ServerSocket* serverSocket)
-throw() {
+{
   if(serverSocket == NULL)
     return;
 
@@ -357,7 +357,7 @@ throw() {
 }
 
 void Communicator::detach(ClientSocket* clientSocket)
-throw() {
+{
   if(clientSocket == NULL)
     return;
 
@@ -365,7 +365,7 @@ throw() {
 }
 
 void Communicator::detach(BinderSocket* binderSocket)
-throw() {
+{
   if(binderSocket == NULL)
     return;
 
@@ -377,7 +377,7 @@ throw() {
  * (1) Si se cierra la conexion con el cliente que al que atencia este proceso clonado => debe terminar la ejecucion.
  */
 void Communicator::detach(Handler* handler)
-throw() {
+{
   if(handler == NULL)
     return;
 
@@ -412,7 +412,7 @@ throw() {
 }
 
 const Handler* Communicator::getHandler(const ClientSocket& clientSocket)
-throw(RuntimeException) {
+noexcept(false) {
   Guard guard(this, "comm::Communicator::getHandler");
   Handler* result = find(clientSocket.getfd());
 
@@ -438,7 +438,7 @@ throw(RuntimeException) {
 // streams pero la forma de recorrer el bucle nos blinda (un poco) de anomalias.
 //----------------------------------------------------------------------------------------------
 void Communicator::accept()
-throw(RuntimeException) {
+noexcept(false) {
   LOGMETHOD(TraceMethod traceMethod("comm::Communicator", "accept", ANNA_FILE_LOCATION));
 
   if(isServing() == true)
@@ -465,7 +465,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::singlethreadedAccept()
-throw(RuntimeException) {
+noexcept(false) {
   LOGMETHOD(TraceMethod traceMethod(Logger::Local7, "comm::Communicator", "singlethreadedAccept", ANNA_FILE_LOCATION));
   Handler* handler;
   Microsecond maxTime;
@@ -540,7 +540,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::multithreadedAccept()
-throw(RuntimeException) {
+noexcept(false) {
   LOGMETHOD(TraceMethod traceMethod(Logger::Local7, "comm::Communicator", "multithreadedAccept", ANNA_FILE_LOCATION));
   {
     Guard guard(this, "comm::Communicator::multithreadedAccept");
@@ -575,7 +575,7 @@ throw(RuntimeException) {
 }
 
 void Communicator::requestStop()
-throw() {
+{
   if(a_requestedStop == true)
     return;
 
@@ -601,7 +601,7 @@ throw() {
 }
 
 bool Communicator::isUsable(const ClientSocket* clientSocket)
-throw() {
+{
   if(clientSocket == NULL)
     return false;
 
@@ -616,7 +616,7 @@ throw() {
 }
 
 void Communicator::setStatus(const Status& status)
-throw() {
+{
   Guard guard(this, "comm::Communicator::setStatus");
 
   if(a_status != status)
@@ -630,7 +630,7 @@ throw() {
 }
 
 void Communicator::eventBreakAddress(const in_addr_t& address)
-throw() {
+{
   Device* device = Network::instantiate().find(address);
 
   if(device->getStatus() == Device::Status::Down)
@@ -674,7 +674,7 @@ throw() {
 }
 
 void Communicator::eventRecoverAddress(const in_addr_t& address)
-throw() {
+{
   Device* device = Network::instantiate().find(address);
 
   if(device->getStatus() == Device::Status::Up)
@@ -694,7 +694,7 @@ throw() {
 }
 
 bool Communicator::eventAcceptConnection(const ClientSocket& clientSocket)
-throw(RuntimeException) {
+noexcept(false) {
   LOGMETHOD(TraceMethod traceMethod(Logger::Local7, "comm::Communicator", "eventAcceptConnection", ANNA_FILE_LOCATION));
 
   if(a_requestedStop == true) {
@@ -731,7 +731,7 @@ throw(RuntimeException) {
 // (3) Solo si todos los servicios "Criticos" estan disponibles pasara a estar "Activo".
 //--------------------------------------------------------------------------------------------------------
 void Communicator::eventCreateConnection(const Server* server)
-throw() {
+{
   if(server == NULL)
     return;
 
@@ -778,7 +778,7 @@ throw() {
 }
 
 void Communicator::eventCreateConnection(const Service* service)
-throw() {
+{
   if(service == NULL)
     return;
 
@@ -793,7 +793,7 @@ throw() {
  * Se invoca desde handler::RemoteConnection:[Tx] -> Communicator
  */
 void Communicator::eventBreakConnection(const Server* server)
-throw() {
+{
   if(server == NULL)
     return;
 
@@ -823,7 +823,7 @@ throw() {
 }
 
 void Communicator::eventBreakConnection(const Service* service)
-throw() {
+{
   if(service == NULL)
     return;
 
@@ -836,7 +836,7 @@ throw() {
 }
 
 void Communicator::eventShutdown()
-throw() {
+{
   LOGWARNING(
     string msg("comm::Communicator::eventShutdown | ");
     msg += asString();
@@ -861,7 +861,7 @@ throw() {
 }
 
 std::string Communicator::asString() const
-throw() {
+{
   string result("comm::Communicator { ");
   result += Component::asString();
   result += " | RequestedStop: ";
@@ -874,7 +874,7 @@ throw() {
 }
 
 xml::Node* Communicator::asXML(xml::Node* parent) const
-throw() {
+{
   parent = app::Component::asXML(parent);
   xml::Node* result = parent->createChild("comm.Communicator");
   result->createAttribute("RequestedStop", anna::functions::asString(a_requestedStop));
@@ -917,7 +917,7 @@ throw() {
  * el proceso hijo y sigue atendiendo peticiones de conexion.
  */
 void Communicator::do_cloneParent()
-throw(RuntimeException) {
+noexcept(false) {
   LOGMETHOD(TraceMethod traceMethod("comm::Communicator", "do_cloneParent", ANNA_FILE_LOCATION));
   Handler* handler;
   Handler::Type::_v type;
@@ -955,7 +955,7 @@ throw(RuntimeException) {
  *     con ese handler => el programa terminara la ejecucion.
  */
 void Communicator::do_cloneChild()
-throw() {
+{
   LOGMETHOD(TraceMethod traceMethod("comm::Communicator", "do_cloneChild", ANNA_FILE_LOCATION));
   LOGINFORMATION(
     string msg("comm::Communicator::do_cloneChild | MainHandler: ");
@@ -1005,7 +1005,7 @@ throw() {
 }
 
 int Communicator::SortByFileDescriptor::value(const Handler* handler)
-throw() {
+{
   return handler->getfd();
 }