summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PropertiesAdminI.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-08-16 16:37:18 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-08-16 16:37:18 +0200
commit88293201e566c982830482601e878ff4bc643782 (patch)
treeb0ffc2633b8404cde06d4786927b1f6b63024849 /cpp/src/Ice/PropertiesAdminI.cpp
parentFixed ICE-7273 - C# AMI test failure (diff)
downloadice-88293201e566c982830482601e878ff4bc643782.tar.bz2
ice-88293201e566c982830482601e878ff4bc643782.tar.xz
ice-88293201e566c982830482601e878ff4bc643782.zip
C# mapping changes
- user exceptions are no longer checked on the server side (ICE-6980) - support for ["marshaled-result"] metadata - AMD operations now return a Task - improved dispatch interceptors - PropertiesAdminI::setProperties impl. now invokes callbacks synchronously
Diffstat (limited to 'cpp/src/Ice/PropertiesAdminI.cpp')
-rw-r--r--cpp/src/Ice/PropertiesAdminI.cpp73
1 files changed, 30 insertions, 43 deletions
diff --git a/cpp/src/Ice/PropertiesAdminI.cpp b/cpp/src/Ice/PropertiesAdminI.cpp
index 3b5198531dd..f5bf9b3a08e 100644
--- a/cpp/src/Ice/PropertiesAdminI.cpp
+++ b/cpp/src/Ice/PropertiesAdminI.cpp
@@ -8,8 +8,10 @@
// **********************************************************************
#include <Ice/PropertiesAdminI.h>
+#include <Ice/Instance.h>
#include <Ice/Logger.h>
#include <Ice/LoggerUtil.h>
+#include <Ice/ThreadPool.h>
using namespace std;
using namespace Ice;
@@ -36,8 +38,9 @@ NativePropertiesAdmin::~NativePropertiesAdmin()
namespace IceInternal
{
-PropertiesAdminI::PropertiesAdminI(const PropertiesPtr& properties, const LoggerPtr& logger) :
- _properties(properties), _logger(logger)
+PropertiesAdminI::PropertiesAdminI(const InstancePtr& instance) :
+ _properties(instance->initializationData().properties),
+ _logger(instance->initializationData().logger)
{
}
@@ -65,13 +68,9 @@ PropertiesAdminI::getPropertiesForPrefix(const string& prefix, const Current&)
void
#ifdef ICE_CPP11_MAPPING
-PropertiesAdminI::setPropertiesAsync(PropertyDict props,
- function<void()> response,
- function<void(exception_ptr)>,
- const Current&)
+PropertiesAdminI::setProperties(PropertyDict props, const Current&)
#else
-PropertiesAdminI::setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr& cb, const PropertyDict& props,
- const Current&)
+PropertiesAdminI::setProperties(const PropertyDict& props, const Current&)
#endif
{
Lock sync(*this);
@@ -187,61 +186,49 @@ PropertiesAdminI::setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr
_properties->setProperty(p->first, "");
}
- //
- // Send the response now so that we do not block the client during
- // the call to the update callback.
- //
-#ifdef ICE_CPP11_MAPPING
- response();
-#else
- cb->ice_response();
-#endif
-
- //
- // Copy the callbacks to allow callbacks to update the callbacks.
- //
-
-#ifdef ICE_CPP11_MAPPING
- auto callbacks = _updateCallbacks;
-#else
- vector<PropertiesAdminUpdateCallbackPtr> callbacks = _updateCallbacks;
-#endif
-
- if(!callbacks.empty())
+ if(!_updateCallbacks.empty())
{
PropertyDict changes = added;
changes.insert(changed.begin(), changed.end());
changes.insert(removed.begin(), removed.end());
+ // Copy callbacks to allow callbacks to update callbacks
#ifdef ICE_CPP11_MAPPING
- for(const auto& cb: callbacks)
- {
- try
- {
- cb(changes);
- }
- catch(...)
- {
- // Ignore.
- }
- }
+ auto callbacks = _updateCallbacks;
+ for(const auto& cb : callbacks)
#else
+ vector<PropertiesAdminUpdateCallbackPtr> callbacks = _updateCallbacks;
for(vector<PropertiesAdminUpdateCallbackPtr>::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p)
+#endif
{
try
{
+#ifdef ICE_CPP11_MAPPING
+ cb(changes);
+#else
(*p)->updated(changes);
+#endif
+ }
+ catch(const std::exception& ex)
+ {
+ if(_properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ Warning out(_logger);
+ out << "properties admin update callback raised unexpected exception:\n" << ex;
+ }
}
catch(...)
{
- // Ignore.
+ if(_properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ Warning out(_logger);
+ out << "properties admin update callback raised unexpected exception:\nunknown c++ exception";
+ }
}
}
-#endif
}
}
-
#ifdef ICE_CPP11_MAPPING
std::function<void()>