diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-09-28 10:40:14 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-09-28 10:40:14 +0200 |
commit | 8527be5894d0e0ba90db306b8ab124c04144ab44 (patch) | |
tree | 5edbe2c2104764f9b3ba8721e573b32fe32f9baf /cpp/src | |
parent | minor fix to build IceGridGUI in OsX (diff) | |
download | ice-8527be5894d0e0ba90db306b8ab124c04144ab44.tar.bz2 ice-8527be5894d0e0ba90db306b8ab124c04144ab44.tar.xz ice-8527be5894d0e0ba90db306b8ab124c04144ab44.zip |
Java & C# port
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/EndpointI.cpp | 7 | ||||
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/InstrumentationI.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Ice/InstrumentationI.h | 7 | ||||
-rw-r--r-- | cpp/src/Ice/MetricsAdminI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/ObserverHelper.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Ice/TcpEndpointI.cpp | 28 | ||||
-rw-r--r-- | cpp/src/IceSSL/EndpointI.cpp | 28 | ||||
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 26 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 31 |
11 files changed, 123 insertions, 53 deletions
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")) |