summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-12-30 18:21:47 +0000
committerMarc Laukien <marc@zeroc.com>2002-12-30 18:21:47 +0000
commit608d89d46a87ad33a89a613effa50b7d469ca5a1 (patch)
tree159450e09853fd06775f1d0a6828b77e32574c4e /cpp/src
parentmore amd work (diff)
downloadice-608d89d46a87ad33a89a613effa50b7d469ca5a1.tar.bz2
ice-608d89d46a87ad33a89a613effa50b7d469ca5a1.tar.xz
ice-608d89d46a87ad33a89a613effa50b7d469ca5a1.zip
fixed shutdown problem with _dispatchCount
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Connection.cpp18
-rw-r--r--cpp/src/Ice/Incoming.cpp6
-rw-r--r--cpp/src/Ice/Object.cpp2
-rw-r--r--cpp/src/slice2java/Gen.cpp95
4 files changed, 63 insertions, 58 deletions
diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp
index ca3446f5e29..5387f1bf8c3 100644
--- a/cpp/src/Ice/Connection.cpp
+++ b/cpp/src/Ice/Connection.cpp
@@ -563,6 +563,11 @@ IceInternal::Connection::sendResponse(BasicStream* os, bool compress)
try
{
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
if(_state == StateClosed)
{
return;
@@ -619,11 +624,6 @@ IceInternal::Connection::sendResponse(BasicStream* os, bool compress)
_transceiver->write(*os, _endpoint->timeout());
}
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
if(_state == StateClosing && _dispatchCount == 0)
{
initiateShutdown();
@@ -642,16 +642,11 @@ IceInternal::Connection::sendNoResponse()
try
{
- if(_state == StateClosed)
- {
- return;
- }
-
if(--_dispatchCount == 0)
{
notifyAll();
}
-
+
if(_state == StateClosing && _dispatchCount == 0)
{
initiateShutdown();
@@ -1237,7 +1232,6 @@ IceInternal::Connection::setState(State state)
registerWithPool();
}
unregisterWithPool();
- _dispatchCount = 0;
break;
}
}
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 0969df7488c..636a2862064 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -204,7 +204,11 @@ IceInternal::Incoming::invoke()
status = _servant->__dispatch(*this, _current);
}
- if(_is.b.empty()) // Asynchronous dispatch?
+ //
+ // In case of an asynchronous dispatch, _is is now empty,
+ // because an IncomingAsync has adopted this Incoming.
+ //
+ if(_is.b.empty())
{
//
// If this was an asynchronous dispatch, we're done
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index ac3448c8b7a..cb73cacd7ae 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -289,7 +289,7 @@ Ice::Object::ice_addFacet(const ObjectPtr& facet, const string& name)
{
IceUtil::Mutex::Lock sync(_activeFacetMapMutex);
- if( (_activeFacetMapHint != _activeFacetMap.end() && _activeFacetMapHint->first == name)
+ if((_activeFacetMapHint != _activeFacetMap.end() && _activeFacetMapHint->first == name)
|| _activeFacetMap.find(name) != _activeFacetMap.end())
{
AlreadyRegisteredException ex(__FILE__, __LINE__);
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index db1c701a3db..b7c8495a898 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -3127,7 +3127,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
string params = getParams(op, scope);
string args = getArgs(op);
- out << sp;
+ out << sp;
out << nl << "public " << retS << nl << opName << '(' << params;
if(!params.empty())
{
@@ -3136,49 +3136,56 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p)
out << "java.util.Map __context)";
writeDelegateThrowsClause(scope, throws);
out << sb;
- list<string> metaData = op->getMetaData();
- out << nl << "Ice.Current __current = new Ice.Current();";
- out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << sliceModeToIceMode(op)
- << ", __context);";
- out << nl << "while(true)";
- out << sb;
- out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
- out << nl << "try";
- out << sb;
- out << nl << name << " __servant = null;";
- out << nl << "try";
- out << sb;
- out << nl << "__servant = (" << name << ")__direct.facetServant();";
- out << eb;
- out << nl << "catch(ClassCastException __ex)";
- out << sb;
- out << nl << "Ice.OperationNotExistException __opEx = new Ice.OperationNotExistException();";
- out << nl << "__opEx.id = __current.id;";
- out << nl << "__opEx.facet = __current.facet;";
- out << nl << "__opEx.operation = __current.operation;";
- out << nl << "throw __opEx;";
- out << eb;
- out << nl;
- if(ret)
- {
- out << "return ";
- }
- out << "__servant." << opName << '(' << args;
- if(!args.empty())
- {
- out << ", ";
- }
- out << "__current);";
- if(!ret)
- {
- out << nl << "return;";
- }
- out << eb;
- out << nl << "finally";
- out << sb;
- out << nl << "__direct.destroy();";
- out << eb;
- out << eb;
+ if(p->hasMetaData("amd") || op->hasMetaData("amd"))
+ {
+ out << nl << "throw new Ice.CollocationOptimizationException();";
+ }
+ else
+ {
+ list<string> metaData = op->getMetaData();
+ out << nl << "Ice.Current __current = new Ice.Current();";
+ out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << sliceModeToIceMode(op)
+ << ", __context);";
+ out << nl << "while(true)";
+ out << sb;
+ out << nl << "IceInternal.Direct __direct = new IceInternal.Direct(__current);";
+ out << nl << "try";
+ out << sb;
+ out << nl << name << " __servant = null;";
+ out << nl << "try";
+ out << sb;
+ out << nl << "__servant = (" << name << ")__direct.facetServant();";
+ out << eb;
+ out << nl << "catch(ClassCastException __ex)";
+ out << sb;
+ out << nl << "Ice.OperationNotExistException __opEx = new Ice.OperationNotExistException();";
+ out << nl << "__opEx.id = __current.id;";
+ out << nl << "__opEx.facet = __current.facet;";
+ out << nl << "__opEx.operation = __current.operation;";
+ out << nl << "throw __opEx;";
+ out << eb;
+ out << nl;
+ if(ret)
+ {
+ out << "return ";
+ }
+ out << "__servant." << opName << '(' << args;
+ if(!args.empty())
+ {
+ out << ", ";
+ }
+ out << "__current);";
+ if(!ret)
+ {
+ out << nl << "return;";
+ }
+ out << eb;
+ out << nl << "finally";
+ out << sb;
+ out << nl << "__direct.destroy();";
+ out << eb;
+ out << eb;
+ }
out << eb;
if(p->hasMetaData("ami") || op->hasMetaData("ami"))