summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java
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/src/slice2java
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/src/slice2java')
-rw-r--r--cpp/src/slice2java/Gen.cpp31
1 files changed, 23 insertions, 8 deletions
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"))