Commit 8d4b64d6 authored by legoc's avatar legoc
Browse files

Exception when an unmanaged application cannot register.

parent d3bba28e
......@@ -15,6 +15,7 @@ libcameo_la_SOURCES = \
cameo/PortEvent.cpp \
cameo/RemoteException.cpp \
cameo/InvalidArgumentException.cpp \
cameo/UnmanagedApplicationException.cpp \
cameo/ConnectionTimeout.cpp \
cameo/SocketException.cpp \
cameo/PublisherCreationException.cpp \
......@@ -79,6 +80,7 @@ nobase_include_HEADERS = \
cameo/Server.h \
cameo/Services.h \
cameo/InvalidArgumentException.h \
cameo/UnmanagedApplicationException.h \
cameo/SocketException.h \
cameo/StatusEvent.h \
cameo/ResultEvent.h \
......
......@@ -39,7 +39,6 @@
#include "Server.h"
#include "StarterServerException.h"
#include "StatusEvent.h"
#include "StatusEvent.h"
using namespace std;
......@@ -164,6 +163,10 @@ void This::initApplication(int argc, char *argv[]) {
m_managed = false;
m_name = nameId;
m_id = initUnmanagedApplication();
if (m_id == -1) {
throw UnmanagedApplicationException(string("Maximum number of applications ") + m_name + " reached");
}
}
if (tokens.size() >= 7) {
......
......@@ -24,6 +24,7 @@
#include <memory>
#include <stdint.h>
#include "InvalidArgumentException.h"
#include "UnmanagedApplicationException.h"
#include "SocketException.h"
#include "ConnectionTimeout.h"
#include "PublisherCreationException.h"
......
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "UnmanagedApplicationException.h"
namespace cameo {
UnmanagedApplicationException::UnmanagedApplicationException(const std::string& message) :
RemoteException(message) {
}
}
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef CAMEO_UNMANAGEDAPPLICATIONEXCEPTION_H_
#define CAMEO_UNMANAGEDAPPLICATIONEXCEPTION_H_
#include "RemoteException.h"
namespace cameo {
class UnmanagedApplicationException : public RemoteException {
public:
UnmanagedApplicationException(const std::string& message);
};
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment