summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp19
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp20
-rw-r--r--cpp/src/Ice/Proxy.cpp54
-rw-r--r--cpp/src/Ice/ThreadPool.cpp15
-rw-r--r--cpp/src/slice2cpp/Gen.cpp35
-rw-r--r--cpp/src/slice2java/Gen.cpp103
6 files changed, 118 insertions, 128 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 775ef98880f..098a4fe7898 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -275,25 +275,6 @@ IceInternal::Instance::clientThreadPool()
if(!_clientThreadPool) // Lazy initialization.
{
-// Not necessary anymore, this is now the default for every thread pool
-/*
- //
- // Make sure that the client thread pool defaults are correctly
- //
- if(_properties->getProperty("Ice.ThreadPool.Client.Size").empty())
- {
- _properties->setProperty("Ice.ThreadPool.Client.Size", "1");
- }
- if(_properties->getProperty("Ice.ThreadPool.Client.SizeMax").empty())
- {
- _properties->setProperty("Ice.ThreadPool.Client.SizeMax", "1");
- }
- if(_properties->getProperty("Ice.ThreadPool.Client.SizeWarn").empty())
- {
- _properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- }
-*/
-
_clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
}
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 7f6ac044561..30e60eb1342 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -20,6 +20,7 @@
#include <Ice/LocalException.h>
#include <Ice/Properties.h>
#include <Ice/LoggerUtil.h>
+#include <Ice/LocatorInfo.h>
using namespace std;
using namespace Ice;
@@ -158,8 +159,25 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is)
}
void
-IceInternal::OutgoingAsync::__finished(const Exception& exc)
+IceInternal::OutgoingAsync::__finished(const LocalException& exc)
{
+ if(_reference->locatorInfo)
+ {
+ _reference->locatorInfo->clearObjectCache(_reference);
+ }
+
+/*
+ ProxyFactoryPtr proxyFactory = _reference->instance->proxyFactory();
+ if(proxyFactory)
+ {
+ proxyFactory->checkRetryAfterException(ex, cnt);
+ }
+ else
+ {
+ ex.ice_throw(); // The communicator is already destroyed, so we cannot retry.
+ }
+*/
+
try
{
ice_exception(exc);
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 5dce0dcd61b..504ab0502f6 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -697,9 +697,13 @@ IceProxy::Ice::Object::__handleException(const LocalException& ex, int& cnt)
void
IceProxy::Ice::Object::__rethrowException(const LocalException& ex)
{
- IceUtil::Mutex::Lock sync(*this);
-
- _delegate = 0;
+ //
+ // Only _delegate needs to be mutex protected here.
+ //
+ {
+ IceUtil::Mutex::Lock sync(*this);
+ _delegate = 0;
+ }
if(_reference->locatorInfo)
{
@@ -812,13 +816,13 @@ IceDelegateM::Ice::Object::ice_isA(const string& __id, const Context& __context)
BasicStream* __is = __out.is();
BasicStream* __os = __out.os();
__os->write(__id);
- if(!__out.invoke())
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__);
- }
bool __ret;
try
{
+ if(!__out.invoke())
+ {
+ __is->throwException();
+ }
__is->read(__ret);
}
catch(const ::Ice::LocalException& __ex)
@@ -833,9 +837,17 @@ IceDelegateM::Ice::Object::ice_ping(const Context& __context)
{
static const string __operation("ice_ping");
Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
- if(!__out.invoke())
+ BasicStream* __is = __out.is();
+ try
{
- throw ::Ice::UnknownUserException(__FILE__, __LINE__);
+ if(!__out.invoke())
+ {
+ __is->throwException();
+ }
+ }
+ catch(const ::Ice::LocalException& __ex)
+ {
+ throw ::IceInternal::NonRepeatable(__ex);
}
}
@@ -845,13 +857,13 @@ IceDelegateM::Ice::Object::ice_ids(const Context& __context)
static const string __operation("ice_ids");
Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
BasicStream* __is = __out.is();
- if(!__out.invoke())
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__);
- }
vector<string> __ret;
try
{
+ if(!__out.invoke())
+ {
+ __is->throwException();
+ }
__is->read(__ret);
}
catch(const ::Ice::LocalException& __ex)
@@ -867,13 +879,13 @@ IceDelegateM::Ice::Object::ice_id(const Context& __context)
static const string __operation("ice_id");
Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
BasicStream* __is = __out.is();
- if(!__out.invoke())
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__);
- }
string __ret;
try
{
+ if(!__out.invoke())
+ {
+ __is->throwException();
+ }
__is->read(__ret);
}
catch(const ::Ice::LocalException& __ex)
@@ -889,13 +901,13 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context)
static const string __operation("ice_facets");
Outgoing __out(__connection.get(), __reference.get(), __operation, ::Ice::Nonmutating, __context);
BasicStream* __is = __out.is();
- if(!__out.invoke())
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__);
- }
FacetPath __ret;
try
{
+ if(!__out.invoke())
+ {
+ __is->throwException();
+ }
__is->read(__ret);
}
catch(const ::Ice::LocalException& __ex)
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index ace4a8aefa9..671799f5e99 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -67,16 +67,17 @@ IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& p
{
size = 1;
}
- const_cast<int&>(_size) = size;
- int sizeMax = _instance->properties()->getPropertyAsIntWithDefault(_prefix + ".SizeMax", _size * 10);
- if(sizeMax < _size)
+ int sizeMax = _instance->properties()->getPropertyAsIntWithDefault(_prefix + ".SizeMax", size);
+ if(sizeMax < size)
{
- sizeMax = _size;
- }
- const_cast<int&>(_sizeMax) = sizeMax;
+ sizeMax = size;
+ }
+
+ int sizeWarn = _instance->properties()->getPropertyAsIntWithDefault(_prefix + ".SizeWarn", sizeMax * 80 / 100);
- int sizeWarn = _instance->properties()->getPropertyAsIntWithDefault(_prefix + ".SizeWarn", _sizeMax * 80 / 100);
+ const_cast<int&>(_size) = size;
+ const_cast<int&>(_sizeMax) = sizeMax;
const_cast<int&>(_sizeWarn) = sizeWarn;
const_cast<int&>(_messageSizeMax) = instance->messageSizeMax();
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index f28ba7ba16f..381ec7f2b4e 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1514,7 +1514,6 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << nl << "static const ::std::string __operation(\"" << p->name() << "\");";
C << nl << "::IceInternal::Outgoing __out(__connection.get(), __reference.get(), __operation, "
<< "static_cast< ::Ice::OperationMode>(" << p->mode() << "), __context);";
- C << nl << "::IceInternal::BasicStream* __is = __out.is();";
if(!inParams.empty())
{
C << nl << "::IceInternal::BasicStream* __os = __out.os();";
@@ -1524,31 +1523,30 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
{
C << nl << "__os->writePendingObjects();";
}
- C << nl << "if(!__out.invoke())";
+ C << nl << "bool __ok = __out.invoke();";
+ C << nl << "try";
+ C << sb;
+ C << nl << "::IceInternal::BasicStream* __is = __out.is();";
+ C << nl << "if(!__ok)";
C << sb;
C << nl << "__is->throwException();";
C << eb;
writeAllocateCode(C, TypeStringList(), ret);
- if(!outParams.empty() || ret)
+ writeUnmarshalCode(C, outParams, ret);
+ if(p->returnsClasses())
{
- C << nl << "try";
- C << sb;
- writeUnmarshalCode(C, outParams, ret);
- if(p->returnsClasses())
- {
- C << nl << "__is->readPendingObjects();";
- }
- C << eb;
- C << nl << "catch(const ::Ice::LocalException& __ex)";
- C << sb;
- C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
- C << eb;
+ C << nl << "__is->readPendingObjects();";
}
if(ret)
{
C << nl << "return __ret;";
}
C << eb;
+ C << nl << "catch(const ::Ice::LocalException& __ex)";
+ C << sb;
+ C << nl << "throw ::IceInternal::NonRepeatable(__ex);";
+ C << eb;
+ C << eb;
}
Slice::Gen::DelegateDVisitor::DelegateDVisitor(Output& h, Output& c, const string& dllExport) :
@@ -3445,11 +3443,16 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
C << nl << "__is->readPendingObjects();";
}
C << eb;
- C << nl << "catch(const ::Ice::Exception& __ex)";
+ C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
C << nl << "__finished(__ex);";
C << nl << "return;";
C << eb;
+ C << nl << "catch(const ::Ice::UserException& __ex)";
+ C << sb;
+ C << nl << "ice_exception(__ex);";
+ C << nl << "return;";
+ C << eb;
C << nl << "ice_response" << spar << args << epar << ';';
C << eb;
}
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 8de02feb5ac..f6ff122b56d 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -3104,10 +3104,6 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << nl << "IceInternal.BasicStream __os = __out.os();";
}
- if(!outParams.empty() || ret || !throws.empty())
- {
- out << nl << "IceInternal.BasicStream __is = __out.is();";
- }
iter = 0;
for(q = inParams.begin(); q != inParams.end(); ++q)
{
@@ -3117,36 +3113,28 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << nl << "__os.writePendingObjects();";
}
- out << nl << "if(!__out.invoke())";
+ out << nl << "boolean __ok = __out.invoke();";
+ out << nl << "try";
+ out << sb;
+ out << nl << "IceInternal.BasicStream __is = __out.is();";
+ out << nl << "if(!__ok)";
out << sb;
- if(!throws.empty())
- {
- //
- // The try/catch block is necessary because throwException()
- // can raise UserException.
- //
- out << nl << "try";
- out << sb;
- out << nl << "__is.throwException();";
- out << eb;
- for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
- {
- out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << eb;
- }
+ out << nl << "try";
+ out << sb;
+ out << nl << "__is.throwException();";
+ out << eb;
+ for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
+ {
+ out << nl << "catch(" << getAbsolute(*t, package) << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
out << nl << "throw new Ice.UnknownUserException();";
+ out << eb;
out << eb;
- if(!outParams.empty() || ret)
- {
- out << nl << "try";
- out << sb;
- }
for(q = outParams.begin(); q != outParams.end(); ++q)
{
writeMarshalUnmarshalCode(out, package, q->first, fixKwd(q->second), false, iter, true);
@@ -3181,14 +3169,11 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return __ret;";
}
}
- if(!outParams.empty() || ret)
- {
- out << eb;
- out << nl << "catch(Ice.LocalException __ex)";
- out << sb;
- out << nl << "throw new IceInternal.NonRepeatable(__ex);";
- out << eb;
- }
+ out << eb;
+ out << nl << "catch(Ice.LocalException __ex)";
+ out << sb;
+ out << nl << "throw new IceInternal.NonRepeatable(__ex);";
+ out << eb;
out << eb;
out << nl << "finally";
out << sb;
@@ -3870,34 +3855,24 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p)
}
out << nl << "try";
out << sb;
- if(ret || !outParams.empty() || !throws.empty())
- {
- out << nl << "IceInternal.BasicStream __is = this.__is();";
- }
+ out << nl << "IceInternal.BasicStream __is = this.__is();";
out << nl << "if(!__ok)";
out << sb;
- if(!throws.empty())
- {
- //
- // The try/catch block is necessary because throwException()
- // can raise UserException.
- //
- out << nl << "try";
- out << sb;
- out << nl << "__is.throwException();";
- out << eb;
- for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
- {
- out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)";
- out << sb;
- out << nl << "throw __ex;";
- out << eb;
- }
- out << nl << "catch(Ice.UserException __ex)";
- out << sb;
- out << eb;
- }
+ out << nl << "try";
+ out << sb;
+ out << nl << "__is.throwException();";
+ out << eb;
+ for(ExceptionList::const_iterator r = throws.begin(); r != throws.end(); ++r)
+ {
+ out << nl << "catch(" << getAbsolute(*r, classPkg) << " __ex)";
+ out << sb;
+ out << nl << "throw __ex;";
+ out << eb;
+ }
+ out << nl << "catch(Ice.UserException __ex)";
+ out << sb;
out << nl << "throw new Ice.UnknownUserException();";
+ out << eb;
out << eb;
for(q = outParams.begin(); q != outParams.end(); ++q)
{