summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-09-28 10:40:14 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-09-28 10:40:14 +0200
commit8527be5894d0e0ba90db306b8ab124c04144ab44 (patch)
tree5edbe2c2104764f9b3ba8721e573b32fe32f9baf /cpp
parentminor fix to build IceGridGUI in OsX (diff)
downloadice-8527be5894d0e0ba90db306b8ab124c04144ab44.tar.bz2
ice-8527be5894d0e0ba90db306b8ab124c04144ab44.tar.xz
ice-8527be5894d0e0ba90db306b8ab124c04144ab44.zip
Java & C# port
Diffstat (limited to 'cpp')
-rw-r--r--cpp/demo/IceGrid/simple/application.xml2
-rw-r--r--cpp/demo/IceGrid/simple/config.grid3
-rw-r--r--cpp/include/Ice/MetricsAdminI.h69
-rw-r--r--cpp/include/Ice/MetricsObserverI.h4
-rw-r--r--cpp/include/Ice/ObjectF.h2
-rw-r--r--cpp/include/Ice/Outgoing.h1
-rw-r--r--cpp/include/Ice/OutgoingAsync.h1
-rw-r--r--cpp/src/Ice/EndpointI.cpp7
-rw-r--r--cpp/src/Ice/Instance.cpp2
-rw-r--r--cpp/src/Ice/InstrumentationI.cpp20
-rw-r--r--cpp/src/Ice/InstrumentationI.h7
-rw-r--r--cpp/src/Ice/MetricsAdminI.cpp6
-rw-r--r--cpp/src/Ice/Object.cpp2
-rw-r--r--cpp/src/Ice/ObserverHelper.cpp19
-rw-r--r--cpp/src/Ice/TcpEndpointI.cpp28
-rw-r--r--cpp/src/IceSSL/EndpointI.cpp28
-rw-r--r--cpp/src/slice2cs/Gen.cpp26
-rw-r--r--cpp/src/slice2java/Gen.cpp31
18 files changed, 171 insertions, 87 deletions
diff --git a/cpp/demo/IceGrid/simple/application.xml b/cpp/demo/IceGrid/simple/application.xml
index 23270e231a9..7be5d2b0c2e 100644
--- a/cpp/demo/IceGrid/simple/application.xml
+++ b/cpp/demo/IceGrid/simple/application.xml
@@ -16,7 +16,7 @@
<node name="node1">
<server id="SimpleServer" exe="./server" activation="on-demand">
- <adapter name="Hello" endpoints="tcp">
+ <adapter name="Hello" endpoints="tcp -h localhost">
<object identity="hello" type="::Demo::Hello" property="Identity"/>
</adapter>
<property name="IceMX.Metrics.Debug.GroupBy" value="id"/>
diff --git a/cpp/demo/IceGrid/simple/config.grid b/cpp/demo/IceGrid/simple/config.grid
index 41bf69d06cc..cc271d33fa3 100644
--- a/cpp/demo/IceGrid/simple/config.grid
+++ b/cpp/demo/IceGrid/simple/config.grid
@@ -30,7 +30,7 @@ IceGrid.Registry.AdminSSLPermissionsVerifier=DemoIceGrid/NullSSLPermissionsVerif
# IceGrid node configuration.
#
IceGrid.Node.Name=node1
-IceGrid.Node.Endpoints=default
+IceGrid.Node.Endpoints=default -h localhost
IceGrid.Node.Data=db/node
IceGrid.Node.CollocateRegistry=1
#IceGrid.Node.Output=db
@@ -48,3 +48,4 @@ IceGrid.Node.Trace.Activator=1
#
IceGridAdmin.Username=foo
IceGridAdmin.Password=bar
+
diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h
index 7b390019214..10b272f446d 100644
--- a/cpp/include/Ice/MetricsAdminI.h
+++ b/cpp/include/Ice/MetricsAdminI.h
@@ -62,12 +62,12 @@ public:
{
return !reject;
}
- return match(value, reject);
+ return match(value);
}
private:
- bool match(const std::string&, bool);
+ bool match(const std::string&);
const std::string _attribute;
#ifdef ICE_CPP11_REGEXP
@@ -135,20 +135,23 @@ public:
{
}
- void destroy()
+ void
+ destroy()
{
Lock sync(*this);
_map = 0;
}
- void failed(const std::string& exceptionName)
+ void
+ failed(const std::string& exceptionName)
{
Lock sync(*this);
++_object->failures;
++_failures[exceptionName];
}
- IceMX::MetricsFailures getFailures() const
+ IceMX::MetricsFailures
+ getFailures() const
{
IceMX::MetricsFailures f;
@@ -161,27 +164,31 @@ public:
template<typename MemberMetricsType> typename MetricsMapT<MemberMetricsType>::EntryTPtr
getMatching(const std::string& mapName, const IceMX::MetricsHelperT<MemberMetricsType>& helper)
{
- typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::iterator p =
- _subMaps.find(mapName);
- if(p == _subMaps.end())
+ MetricsMapIPtr m;
{
Lock sync(*this);
- if(_map == 0)
+ typename std::map<std::string, std::pair<MetricsMapIPtr, SubMapMember> >::iterator p =
+ _subMaps.find(mapName);
+ if(p == _subMaps.end())
{
- return 0;
+ if(_map == 0)
+ {
+ return 0;
+ }
+ std::pair<MetricsMapIPtr, SubMapMember> map = _map->createSubMap(mapName);
+ if(map.first)
+ {
+ p = _subMaps.insert(make_pair(mapName, map)).first;
+ }
}
- std::pair<MetricsMapIPtr, SubMapMember> map = _map->createSubMap(mapName);
- if(map.first)
+ if(p == _subMaps.end())
{
- p = _subMaps.insert(make_pair(mapName, map)).first;
+ return 0;
}
+ m = p->second.first;
}
- if(p == _subMaps.end())
- {
- return 0;
- }
-
- MetricsMapT<MemberMetricsType>* map = dynamic_cast<MetricsMapT<MemberMetricsType>*>(p->second.first.get());
+
+ MetricsMapT<MemberMetricsType>* map = dynamic_cast<MetricsMapT<MemberMetricsType>*>(m.get());
assert(map);
return map->getMatching(helper);
}
@@ -214,7 +221,8 @@ public:
}
}
- bool isDetached() const
+ bool
+ isDetached() const
{
Lock sync(*this);
return _object->current == 0;
@@ -561,13 +569,24 @@ public:
template<class MemberMetricsType, class MetricsType> void
registerSubMap(const std::string& map, const std::string& subMap, IceMX::MetricsMap MetricsType::* member)
{
- Lock sync(*this);
-
- std::map<std::string, MetricsMapFactoryPtr>::const_iterator p = _factories.find(map);
- if(p != _factories.end())
+ bool updated;
+ IceUtil::Handle<MetricsMapFactoryT<MetricsType> > factory;
{
- MetricsMapFactoryT<MetricsType>* factory = dynamic_cast<MetricsMapFactoryT<MetricsType>*>(p->second.get());
+ Lock sync(*this);
+
+ std::map<std::string, MetricsMapFactoryPtr>::const_iterator p = _factories.find(map);
+ if(p == _factories.end())
+ {
+ return;
+ }
+ factory = dynamic_cast<MetricsMapFactoryT<MetricsType>*>(p->second.get());
factory->template registerSubMap<MemberMetricsType>(subMap, member);
+ removeMap(map);
+ updated = addOrUpdateMap(map, factory);
+ }
+ if(updated)
+ {
+ factory->update();
}
}
diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h
index 5e18a634ef9..1a64e6cfe5b 100644
--- a/cpp/include/Ice/MetricsObserverI.h
+++ b/cpp/include/Ice/MetricsObserverI.h
@@ -461,8 +461,6 @@ public:
return 0;
}
- std::sort(metricsObjects.begin(), metricsObjects.end());
-
ObserverImplPtrType obsv = new ObserverImplType();
obsv->init(helper, metricsObjects);
return obsv;
@@ -488,8 +486,6 @@ public:
return 0;
}
- std::sort(metricsObjects.begin(), metricsObjects.end());
-
ObserverImplPtrType obsv = ObserverImplPtrType::dynamicCast(observer);
if(!obsv)
{
diff --git a/cpp/include/Ice/ObjectF.h b/cpp/include/Ice/ObjectF.h
index 803d8105333..5946be23dd0 100644
--- a/cpp/include/Ice/ObjectF.h
+++ b/cpp/include/Ice/ObjectF.h
@@ -17,7 +17,7 @@ namespace Ice
{
class Object;
-ICE_API IceUtil::Shared* upCast(Object*);
+ICE_API Object* upCast(Object*);
typedef IceInternal::Handle< Object > ObjectPtr;
ICE_API void __patch(ObjectPtr&, ObjectPtr&);
diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h
index 2e0f9f63ca3..9a99d4b7dea 100644
--- a/cpp/include/Ice/Outgoing.h
+++ b/cpp/include/Ice/Outgoing.h
@@ -12,7 +12,6 @@
#include <IceUtil/Mutex.h>
#include <IceUtil/Monitor.h>
-#include <IceUtil/StopWatch.h>
#include <Ice/RequestHandlerF.h>
#include <Ice/InstanceF.h>
#include <Ice/ConnectionIF.h>
diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h
index c8d93290203..f630305c5e1 100644
--- a/cpp/include/Ice/OutgoingAsync.h
+++ b/cpp/include/Ice/OutgoingAsync.h
@@ -14,7 +14,6 @@
#include <IceUtil/Mutex.h>
#include <IceUtil/Timer.h>
#include <IceUtil/Exception.h>
-#include <IceUtil/StopWatch.h>
#include <Ice/OutgoingAsyncF.h>
#include <Ice/InstanceF.h>
#include <Ice/ReferenceF.h>
diff --git a/cpp/src/Ice/EndpointI.cpp b/cpp/src/Ice/EndpointI.cpp
index 1160ec30ca2..323d50c01a9 100644
--- a/cpp/src/Ice/EndpointI.cpp
+++ b/cpp/src/Ice/EndpointI.cpp
@@ -215,6 +215,7 @@ IceInternal::EndpointHostResolver::resolve(const string& host, int port, const E
catch(const Ice::LocalException& ex)
{
observer.failed(ex.ice_name());
+ throw;
}
return connectors;
}
@@ -337,9 +338,13 @@ IceInternal::EndpointHostResolver::run()
p->observer->failed(ex.ice_name());
p->observer->detach();
}
-
}
_queue.clear();
+
+ if(_observer)
+ {
+ _observer.detach();
+ }
}
void
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 8ab4f392d6a..b389b91f2d8 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -1096,7 +1096,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_adminFacets.insert(FacetMap::value_type("Process", new ProcessI(communicator)));
- IceInternal::MetricsAdminIPtr admin = new IceInternal::MetricsAdminI(_initData.properties, _initData.logger);
+ MetricsAdminIPtr admin = new MetricsAdminI(_initData.properties, _initData.logger);
_adminFacets.insert(FacetMap::value_type("MetricsAdmin", admin));
PropertiesAdminIPtr props = new PropertiesAdminI("Properties", _initData.properties, _initData.logger);
diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp
index b3b94b1e061..e07d378d7cc 100644
--- a/cpp/src/Ice/InstrumentationI.cpp
+++ b/cpp/src/Ice/InstrumentationI.cpp
@@ -837,25 +837,7 @@ CommunicatorObserverI::getThreadObserver(const string& parent,
}
InvocationObserverPtr
-CommunicatorObserverI::getInvocationObserver(const ObjectPrx& proxy, const string& op)
-{
- if(_invocations.isEnabled())
- {
- try
- {
- return _invocations.getObserver(InvocationHelper(proxy, op));
- }
- catch(const exception& ex)
- {
- Error error(_metrics->getLogger());
- error << "unexpected exception trying to obtain observer:\n" << ex;
- }
- }
- return 0;
-}
-
-InvocationObserverPtr
-CommunicatorObserverI::getInvocationObserverWithContext(const ObjectPrx& proxy, const string& op, const Context& ctx)
+CommunicatorObserverI::getInvocationObserver(const ObjectPrx& proxy, const string& op, const Context& ctx)
{
if(_invocations.isEnabled())
{
diff --git a/cpp/src/Ice/InstrumentationI.h b/cpp/src/Ice/InstrumentationI.h
index 45f537bef57..523cf6186fe 100644
--- a/cpp/src/Ice/InstrumentationI.h
+++ b/cpp/src/Ice/InstrumentationI.h
@@ -62,12 +62,9 @@ public:
Ice::Instrumentation::ThreadState,
const Ice::Instrumentation::ThreadObserverPtr&);
- virtual Ice::Instrumentation::InvocationObserverPtr getInvocationObserverWithContext(const Ice::ObjectPrx&,
- const std::string&,
- const Ice::Context&);
-
virtual Ice::Instrumentation::InvocationObserverPtr getInvocationObserver(const Ice::ObjectPrx&,
- const std::string&);
+ const std::string&,
+ const Ice::Context&);
virtual Ice::Instrumentation::ObserverPtr getDispatchObserver(const Ice::Current&);
diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp
index cdf96b721c2..4664eca3425 100644
--- a/cpp/src/Ice/MetricsAdminI.cpp
+++ b/cpp/src/Ice/MetricsAdminI.cpp
@@ -67,10 +67,10 @@ validateProperties(const string& prefix, const PropertiesPtr& properties, const
}
}
- if(!unknownProps.empty())
+ if(!unknownProps.empty() && properties->getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0)
{
Warning out(getProcessLogger());
- out << "found unknown Ice metrics properties for '" << prefix.substr(0, prefix.size() - 1) << "':";
+ out << "found unknown IceMX properties for '" << prefix.substr(0, prefix.size() - 1) << "':";
for(vector<string>::const_iterator p = unknownProps.begin(); p != unknownProps.end(); ++p)
{
out << "\n " << *p;
@@ -120,7 +120,7 @@ MetricsMapI::RegExp::~RegExp()
}
bool
-MetricsMapI::RegExp::match(const string& value, bool reject)
+MetricsMapI::RegExp::match(const string& value)
{
#ifndef ICE_CPP11_REGEXP
return regexec(&_preg, value.c_str(), 0, 0, 0) == 0;
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index d5048326e93..096bf434b5f 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -20,7 +20,7 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
-IceUtil::Shared* Ice::upCast(Object* p) { return p; }
+Object* Ice::upCast(Object* p) { return p; }
void
Ice::__patch(ObjectPtr& obj, ObjectPtr& v)
diff --git a/cpp/src/Ice/ObserverHelper.cpp b/cpp/src/Ice/ObserverHelper.cpp
index 83adf075f53..10253ae8560 100644
--- a/cpp/src/Ice/ObserverHelper.cpp
+++ b/cpp/src/Ice/ObserverHelper.cpp
@@ -16,6 +16,13 @@ using namespace std;
using namespace Ice;
using namespace Ice::Instrumentation;
+namespace
+{
+
+Ice::Context emptyCtx;
+
+}
+
IceInternal::InvocationObserver::InvocationObserver(IceProxy::Ice::Object* proxy, const string& op, const Context* ctx)
{
const CommunicatorObserverPtr& obsv = proxy->__reference()->getInstance()->initializationData().observer;
@@ -26,11 +33,11 @@ IceInternal::InvocationObserver::InvocationObserver(IceProxy::Ice::Object* proxy
if(ctx)
{
- attach(obsv->getInvocationObserverWithContext(proxy, op, *ctx));
+ attach(obsv->getInvocationObserver(proxy, op, *ctx));
}
else
{
- attach(obsv->getInvocationObserver(proxy, op));
+ attach(obsv->getInvocationObserver(proxy, op, emptyCtx));
}
}
@@ -42,7 +49,7 @@ IceInternal::InvocationObserver::InvocationObserver(IceInternal::Instance* insta
return;
}
- attach(obsv->getInvocationObserver(0, op));
+ attach(obsv->getInvocationObserver(0, op, emptyCtx));
}
void
@@ -56,11 +63,11 @@ IceInternal::InvocationObserver::attach(IceProxy::Ice::Object* proxy, const stri
if(ctx)
{
- attach(obsv->getInvocationObserverWithContext(proxy, op, *ctx));
+ attach(obsv->getInvocationObserver(proxy, op, *ctx));
}
else
{
- attach(obsv->getInvocationObserver(proxy, op));
+ attach(obsv->getInvocationObserver(proxy, op, emptyCtx));
}
}
@@ -73,5 +80,5 @@ IceInternal::InvocationObserver::attach(IceInternal::Instance* instance, const s
return;
}
- attach(obsv->getInvocationObserver(0, op));
+ attach(obsv->getInvocationObserver(0, op, emptyCtx));
}
diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp
index 7b47da856cd..311e4edbaa4 100644
--- a/cpp/src/Ice/TcpEndpointI.cpp
+++ b/cpp/src/Ice/TcpEndpointI.cpp
@@ -448,6 +448,16 @@ IceInternal::TcpEndpointI::operator==(const LocalObject& r) const
return true;
}
+ if(_protocol != p->_protocol)
+ {
+ return false;
+ }
+
+ if(_encoding != p->_encoding)
+ {
+ return false;
+ }
+
if(_host != p->_host)
{
return false;
@@ -495,6 +505,24 @@ IceInternal::TcpEndpointI::operator<(const LocalObject& r) const
return false;
}
+ if(_protocol < p->_protocol)
+ {
+ return true;
+ }
+ else if(p->_protocol < _protocol)
+ {
+ return false;
+ }
+
+ if(_encoding < p->_encoding)
+ {
+ return true;
+ }
+ else if(p->_encoding < _encoding)
+ {
+ return false;
+ }
+
if(_host < p->_host)
{
return true;
diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp
index 6e5a8bb7463..ebc0dff0842 100644
--- a/cpp/src/IceSSL/EndpointI.cpp
+++ b/cpp/src/IceSSL/EndpointI.cpp
@@ -445,6 +445,16 @@ IceSSL::EndpointI::operator==(const Ice::LocalObject& r) const
return true;
}
+ if(_protocol != p->_protocol)
+ {
+ return false;
+ }
+
+ if(_encoding != p->_encoding)
+ {
+ return false;
+ }
+
if(_host != p->_host)
{
return false;
@@ -492,6 +502,24 @@ IceSSL::EndpointI::operator<(const Ice::LocalObject& r) const
return false;
}
+ if(_protocol < p->_protocol)
+ {
+ return true;
+ }
+ else if(p->_protocol < _protocol)
+ {
+ return false;
+ }
+
+ if(_encoding < p->_encoding)
+ {
+ return true;
+ }
+ else if(p->_encoding < _encoding)
+ {
+ return false;
+ }
+
if(_host < p->_host)
{
return true;
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 9d1de88c85e..1671d887252 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -4838,6 +4838,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
_out << nl << "context__ = emptyContext_;";
_out << eb;
+ _out << nl << "Ice.Instrumentation.InvocationObserver observer__ = IceInternal.ObserverHelper.get(this, __";
+ _out << op->name() << "_name, context__);";
_out << nl << "int cnt__ = 0;";
_out << nl << "while(true)";
_out << sb;
@@ -4846,7 +4848,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
if(op->returnsData())
{
- _out << nl << "checkTwowayOnly__(\"" << op->name() << "\");";
+ _out << nl << "checkTwowayOnly__(__" << op->name() << "_name);";
}
_out << nl << "delBase__ = getDelegate__(false);";
_out << nl << name << "Del_ del__ = (" << name << "Del_)delBase__;";
@@ -4855,7 +4857,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << "return ";
}
- _out << "del__." << opName << spar << args << "context__" << epar << ';';
+ _out << "del__." << opName << spar << args << "context__" << "observer__" << epar << ';';
if(!ret)
{
_out << nl << "return;";
@@ -4865,16 +4867,16 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
{
- _out << nl << "handleExceptionWrapperRelaxed__(delBase__, ex__, true, ref cnt__);";
+ _out << nl << "handleExceptionWrapperRelaxed__(delBase__, ex__, true, ref cnt__, observer__);";
}
else
{
- _out << nl << "handleExceptionWrapper__(delBase__, ex__);";
+ _out << nl << "handleExceptionWrapper__(delBase__, ex__, observer__);";
}
_out << eb;
_out << nl << "catch(Ice.LocalException ex__)";
_out << sb;
- _out << nl << "handleException__(delBase__, ex__, true, ref cnt__);";
+ _out << nl << "handleException__(delBase__, ex__, true, ref cnt__, observer__);";
_out << eb;
_out << eb;
@@ -5886,7 +5888,9 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
vector<string> params = getParams(op);
_out << sp << nl << retS << ' ' << opName << spar << params
- << "_System.Collections.Generic.Dictionary<string, string> context__" << epar << ';';
+ << "_System.Collections.Generic.Dictionary<string, string> context__"
+ << "Ice.Instrumentation.InvocationObserver observer__"
+ << epar << ';';
}
return true;
@@ -5985,11 +5989,13 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
vector<string> params = getParams(op);
_out << sp << nl << "public " << retS << ' ' << opName << spar << params
- << "_System.Collections.Generic.Dictionary<string, string> context__" << epar;
+ << "_System.Collections.Generic.Dictionary<string, string> context__"
+ << "Ice.Instrumentation.InvocationObserver observer__"
+ << epar;
_out << sb;
_out << nl << "IceInternal.Outgoing og__ = handler__.getOutgoing(\"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode()) << ", context__);";
+ << sliceModeToIceMode(op->sendMode()) << ", context__, observer__);";
_out << nl << "try";
_out << sb;
if(!inParams.empty())
@@ -6207,7 +6213,9 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp;
_out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031\")]";
_out << nl << "public " << retS << ' ' << opName << spar << params
- << "_System.Collections.Generic.Dictionary<string, string> context__" << epar;
+ << "_System.Collections.Generic.Dictionary<string, string> context__"
+ << "Ice.Instrumentation.InvocationObserver observer__"
+ << epar;
_out << sb;
if(containingClass->hasMetaData("amd") || op->hasMetaData("amd"))
{
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 1b049475ffd..b3769e3310d 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4367,7 +4367,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
out << nl << "__ctx = _emptyContext;";
out << eb;
+ out << nl << "final Ice.Instrumentation.InvocationObserver __observer = IceInternal.ObserverHelper.get(this, ";
+ out << "\"" << opName << "\");";
out << nl << "int __cnt = 0;";
+ out << nl << "try";
+ out << sb;
out << nl << "while(true)";
out << sb;
out << nl << "Ice._ObjectDel __delBase = null;";
@@ -4384,7 +4388,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "return ";
}
- out << "__del." << opName << spar << args << "__ctx" << epar << ';';
+ out << "__del." << opName << spar << args << "__ctx" << "__observer" << epar << ';';
if(!ret)
{
out << nl << "return;";
@@ -4394,16 +4398,24 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
if(op->mode() == Operation::Idempotent || op->mode() == Operation::Nonmutating)
{
- out << nl << "__cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, null, __cnt);";
+ out << nl << "__cnt = __handleExceptionWrapperRelaxed(__delBase, __ex, null, __cnt, __observer);";
}
else
{
- out << nl << "__handleExceptionWrapper(__delBase, __ex);";
+ out << nl << "__handleExceptionWrapper(__delBase, __ex, __observer);";
}
out << eb;
out << nl << "catch(Ice.LocalException __ex)";
out << sb;
- out << nl << "__cnt = __handleException(__delBase, __ex, null, __cnt);";
+ out << nl << "__cnt = __handleException(__delBase, __ex, null, __cnt, __observer);";
+ out << eb;
+ out << eb;
+ out << eb;
+ out << nl << "finally";
+ out << sb;
+ out << nl << "if(__observer != null)";
+ out << sb;
+ out << nl << "__observer.detach();";
out << eb;
out << eb;
out << eb;
@@ -5396,6 +5408,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
string contextParam = "java.util.Map<String, String> __ctx";
+ string observerParam = "Ice.Instrumentation.InvocationObserver __obsv";
OperationList ops = p->operations();
@@ -5414,7 +5427,7 @@ Slice::Gen::DelegateVisitor::visitClassDefStart(const ClassDefPtr& p)
throws.unique();
out << sp;
- out << nl << retS << ' ' << opName << spar << params << contextParam << epar;
+ out << nl << retS << ' ' << opName << spar << params << contextParam << observerParam << epar;
writeDelegateThrowsClause(package, throws);
out << ';';
}
@@ -5450,6 +5463,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
string contextParam = "java.util.Map<String, String> __ctx";
+ string observerParam = "Ice.Instrumentation.InvocationObserver __observer";
OperationList ops = p->allOperations();
@@ -5499,12 +5513,12 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
vector<string> params = getParamsProxy(op, package);
out << sp;
- out << nl << "public " << retS << nl << opName << spar << params << contextParam << epar;
+ out << nl << "public " << retS << nl << opName << spar << params << contextParam << observerParam << epar;
writeDelegateThrowsClause(package, throws);
out << sb;
out << nl << "IceInternal.Outgoing __og = __handler.getOutgoing(\"" << op->name() << "\", "
- << sliceModeToIceMode(op->sendMode()) << ", __ctx);";
+ << sliceModeToIceMode(op->sendMode()) << ", __ctx, __observer);";
out << nl << "try";
out << sb;
if(!inParams.empty())
@@ -5626,6 +5640,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
string contextParam = "java.util.Map<String, String> __ctx";
+ string observerParam = "Ice.Instrumentation.InvocationObserver __observer";
OperationList ops = p->allOperations();
@@ -5664,7 +5679,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << nl << "/** @deprecated **/";
}
- out << nl << "public " << retS << nl << opName << spar << params << contextParam << epar;
+ out << nl << "public " << retS << nl << opName << spar << params << contextParam << observerParam << epar;
writeDelegateThrowsClause(package, throws);
out << sb;
if(cl->hasMetaData("amd") || op->hasMetaData("amd"))