summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-07-25 16:19:49 -0400
committerBernard Normier <bernard@zeroc.com>2016-07-25 16:19:49 -0400
commit2747737921abaf666ec5b8eb2929c94ad0d19e05 (patch)
tree7b665da082342e141eb0547d26ce713fa501bcb2
parentFix ICE-7250 - slice2cpp crash with optionals demo (diff)
downloadice-2747737921abaf666ec5b8eb2929c94ad0d19e05.tar.bz2
ice-2747737921abaf666ec5b8eb2929c94ad0d19e05.tar.xz
ice-2747737921abaf666ec5b8eb2929c94ad0d19e05.zip
Simplified exception-related code
Reduced VS 2015 U3 optimizer disabling
-rw-r--r--cpp/include/IceUtil/Config.h8
-rw-r--r--cpp/msbuild/ice.cpp.props9
-rw-r--r--cpp/src/Glacier2Lib/SessionHelper.cpp2
-rw-r--r--cpp/src/Ice/BatchRequestQueue.cpp4
-rw-r--r--cpp/src/Ice/ConnectRequestHandler.cpp85
-rw-r--r--cpp/src/Ice/ConnectionI.cpp310
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp16
-rw-r--r--cpp/src/Ice/Outgoing.cpp23
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp23
-rw-r--r--cpp/src/Ice/Reference.cpp15
-rw-r--r--cpp/src/Ice/RequestHandler.cpp4
-rw-r--r--cpp/src/IceGrid/msbuild/icegridnode/icegridnode.vcxproj2
-rw-r--r--cpp/src/IceGrid/msbuild/icegridregistry/icegridregistry.vcxproj2
-rw-r--r--cpp/test/Ice/interceptor/AMDInterceptorI.cpp4
-rw-r--r--cpp/test/Ice/metrics/msbuild/collocated/collocated.vcxproj2
-rw-r--r--cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX10
16 files changed, 219 insertions, 300 deletions
diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h
index a53cd04abd1..c3145efe7c6 100644
--- a/cpp/include/IceUtil/Config.h
+++ b/cpp/include/IceUtil/Config.h
@@ -374,9 +374,7 @@ typedef long long Int64;
# define ICE_CLOSE_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)>
# define ICE_HEARTBEAT_CALLBACK ::std::function<void(const ::std::shared_ptr<::Ice::Connection>&)>
# define ICE_IN(...) __VA_ARGS__
-# define ICE_EXCEPTION_ISSET(T) T
-# define ICE_RETHROW_EXCEPTION(T) T->ice_throw()
-# define ICE_RESET_EXCEPTION(T, V) T = V
+# define ICE_SET_EXCEPTION_FROM_CLONE(T, V) T = V
#else // C++98 mapping
# define ICE_HANDLE ::IceUtil::Handle
# define ICE_INTERNAL_HANDLE ::IceInternal::Handle
@@ -394,9 +392,7 @@ typedef long long Int64;
# define ICE_CLOSE_CALLBACK ::Ice::CloseCallbackPtr
# define ICE_HEARTBEAT_CALLBACK ::Ice::HeartbeatCallbackPtr
# define ICE_IN(...) const __VA_ARGS__&
-# define ICE_EXCEPTION_ISSET(T) T
-# define ICE_RETHROW_EXCEPTION(T) T->ice_throw()
-# define ICE_RESET_EXCEPTION(T,V) T.reset(V)
+# define ICE_SET_EXCEPTION_FROM_CLONE(T, V) T.reset(V)
#endif
#endif
diff --git a/cpp/msbuild/ice.cpp.props b/cpp/msbuild/ice.cpp.props
index 07e063006fc..bc7606f0329 100644
--- a/cpp/msbuild/ice.cpp.props
+++ b/cpp/msbuild/ice.cpp.props
@@ -98,15 +98,6 @@
</ItemDefinitionGroup>
<!--
- COMPILERFIX: Disable new C++ optimizer introduced with VS 2015 update 3.
- -->
- <ItemDefinitionGroup Condition="'$(DefaultPlatformToolset)|$(Ice_Configuration)'=='v140|Release'">
- <ClCompile>
- <AdditionalOptions>-d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- </ItemDefinitionGroup>
-
- <!--
GenerateDebugInformation supported values change from v120 to v140,
we set it conditionally to the platform tool set.
-->
diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp
index b5b07f57d6a..e4d4803d8e5 100644
--- a/cpp/src/Glacier2Lib/SessionHelper.cpp
+++ b/cpp/src/Glacier2Lib/SessionHelper.cpp
@@ -519,7 +519,7 @@ public:
_callback(callback),
_session(session)
{
- ICE_RESET_EXCEPTION(_ex, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_ex, ex.ice_clone());
}
virtual void
diff --git a/cpp/src/Ice/BatchRequestQueue.cpp b/cpp/src/Ice/BatchRequestQueue.cpp
index 53f5750836a..5eb2758b00e 100644
--- a/cpp/src/Ice/BatchRequestQueue.cpp
+++ b/cpp/src/Ice/BatchRequestQueue.cpp
@@ -91,9 +91,9 @@ void
BatchRequestQueue::prepareBatchRequest(OutputStream* os)
{
Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
waitStreamInUse(false);
_batchStreamInUse = true;
diff --git a/cpp/src/Ice/ConnectRequestHandler.cpp b/cpp/src/Ice/ConnectRequestHandler.cpp
index dcfd582fde3..dc97d999323 100644
--- a/cpp/src/Ice/ConnectRequestHandler.cpp
+++ b/cpp/src/Ice/ConnectRequestHandler.cpp
@@ -94,7 +94,7 @@ ConnectRequestHandler::requestCanceled(OutgoingBase* out, const Ice::LocalExcept
{
{
Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
return; // The request has been notified of a failure already.
}
@@ -121,7 +121,7 @@ ConnectRequestHandler::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync
{
{
Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
return; // The request has been notified of a failure already.
}
@@ -149,9 +149,9 @@ Ice::ConnectionIPtr
ConnectRequestHandler::getConnection()
{
Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
return 0; // Keep the compiler happy.
}
else
@@ -164,21 +164,21 @@ Ice::ConnectionIPtr
ConnectRequestHandler::waitForConnection()
{
Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- throw RetryException(*_exception.get());
+ throw RetryException(*_exception);
}
//
// Wait for the connection establishment to complete or fail.
//
- while(!_initialized && !ICE_EXCEPTION_ISSET(_exception))
+ while(!_initialized && !_exception)
{
wait();
}
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
return 0; // Keep the compiler happy.
}
else
@@ -192,7 +192,7 @@ ConnectRequestHandler::setConnection(const Ice::ConnectionIPtr& connection, bool
{
{
Lock sync(*this);
- assert(!ICE_EXCEPTION_ISSET(_exception) && !_connection);
+ assert(!_exception && !_connection);
_connection = connection;
_compress = compress;
}
@@ -217,8 +217,8 @@ void
ConnectRequestHandler::setException(const Ice::LocalException& ex)
{
Lock sync(*this);
- assert(!_initialized && !ICE_EXCEPTION_ISSET(_exception));
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ assert(!_initialized && !_exception);
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
_proxies.clear();
_proxy = 0; // Break cyclic reference count.
@@ -238,27 +238,22 @@ ConnectRequestHandler::setException(const Ice::LocalException& ex)
// Ignore
}
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ex)
+
+ for(deque<Request>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
{
- for(deque<Request>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
+ if(p->out)
{
- if(p->out)
- {
- p->out->completed(ex);
- }
- else
+ p->out->completed(ex);
+ }
+ else
+ {
+ if(p->outAsync->exception(ex))
{
- if(p->outAsync->exception(ex))
- {
- p->outAsync->invokeExceptionAsync();
- }
+ p->outAsync->invokeExceptionAsync();
}
}
}
+
_requests.clear();
notifyAll();
}
@@ -285,12 +280,12 @@ ConnectRequestHandler::initialized()
}
else
{
- while(_flushing && !ICE_EXCEPTION_ISSET(_exception))
+ while(_flushing && !_exception)
{
wait();
}
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
if(_connection)
{
@@ -302,7 +297,7 @@ ConnectRequestHandler::initialized()
//
return true;
}
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
return false; // Keep the compiler happy.
}
else
@@ -348,30 +343,23 @@ ConnectRequestHandler::flushRequests()
}
catch(const RetryException& ex)
{
- ICE_RESET_EXCEPTION(exception, ex.get()->ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(exception, ex.get()->ice_clone());
+
+ // Remove the request handler before retrying.
+ _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, shared_from_this());
- try
+ if(req.out)
{
- ICE_RETHROW_EXCEPTION(exception);
+ req.out->retryException(*exception);
}
- catch(const Ice::LocalException& ee)
+ else
{
- // Remove the request handler before retrying.
- _reference->getInstance()->requestHandlerFactory()->removeRequestHandler(_reference, shared_from_this());
-
- if(req.out)
- {
- req.out->retryException(ee);
- }
- else
- {
- req.outAsync->retryException(ee);
- }
+ req.outAsync->retryException(*exception);
}
}
catch(const Ice::LocalException& ex)
{
- ICE_RESET_EXCEPTION(exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(exception, ex.ice_clone());
if(req.out)
{
req.out->completed(ex);
@@ -390,7 +378,7 @@ ConnectRequestHandler::flushRequests()
// request handler to use the more efficient connection request
// handler.
//
- if(_reference->getCacheConnection() && !ICE_EXCEPTION_ISSET(exception))
+ if(_reference->getCacheConnection() && !exception)
{
_requestHandler = ICE_MAKE_SHARED(ConnectionRequestHandler, _reference, _connection, _compress);
for(set<Ice::ObjectPrxPtr>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
@@ -407,7 +395,7 @@ ConnectRequestHandler::flushRequests()
#else
_exception.swap(exception);
#endif
- _initialized = !ICE_EXCEPTION_ISSET(_exception);
+ _initialized = !_exception;
_flushing = false;
//
@@ -421,4 +409,3 @@ ConnectRequestHandler::flushRequests()
notifyAll();
}
}
-
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 82e1b48d6aa..97d69ed297e 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -317,8 +317,8 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(_state >= StateClosed) // The connection might already be closed if the communicator was destroyed.
{
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
if(!initialize() || !validate())
@@ -339,8 +339,8 @@ Ice::ConnectionI::start(const StartCallbackPtr& callback)
if(_state >= StateClosing)
{
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
}
@@ -487,10 +487,10 @@ Ice::ConnectionI::throwException() const
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
assert(_state >= StateClosing);
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
}
@@ -622,9 +622,9 @@ Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, i
// to send our request, we always try to send the request
// again.
//
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- throw RetryException(*_exception.get());
+ throw RetryException(*_exception);
}
assert(_state > StateNotValidated);
@@ -684,8 +684,8 @@ Ice::ConnectionI::sendRequest(OutgoingBase* out, bool compress, bool response, i
catch(const LocalException& ex)
{
setState(StateClosed, ex);
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
if(response)
@@ -710,9 +710,9 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
// to send our request, we always try to send the request
// again.
//
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- throw RetryException(*_exception.get());
+ throw RetryException(*_exception);
}
assert(_state > StateNotValidated);
assert(_state < StateClosing);
@@ -772,8 +772,8 @@ Ice::ConnectionI::sendAsyncRequest(const OutgoingAsyncBasePtr& out, bool compres
catch(const LocalException& ex)
{
setState(StateClosed, ex);
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
if(response)
@@ -802,7 +802,7 @@ Ice::ConnectionI::flushBatchRequests()
std::function<void()>
Ice::ConnectionI::flushBatchRequestsAsync(::std::function<void(::std::exception_ptr)> ex,
- ::std::function<void(bool)> sent)
+ ::std::function<void(bool)> sent)
{
class ConnectionFlushBatchLambda : public ConnectionFlushBatchAsync, public LambdaInvoke
{
@@ -1234,8 +1234,8 @@ Ice::ConnectionI::sendResponse(Int, OutputStream* os, Byte compressFlag, bool /*
if(_state >= StateClosed)
{
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
OutgoingMessage message(os, compressFlag > 0);
@@ -1273,8 +1273,8 @@ Ice::ConnectionI::sendNoResponse()
if(_state >= StateClosed)
{
- assert(ICE_EXCEPTION_ISSET(_exception));
- ICE_RETHROW_EXCEPTION(_exception);
+ assert(_exception);
+ _exception->ice_throw();
}
if(_state == StateClosing && _dispatchCount == 0)
@@ -1932,15 +1932,9 @@ Ice::ConnectionI::finish(bool close)
{
string verb = _connector ? "establish" : "accept";
Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::Exception& ex)
- {
- out << "failed to " << verb << " " << _endpoint->protocol() << " connection\n" << toString()
- << "\n" << ex;
- }
+
+ out << "failed to " << verb << " " << _endpoint->protocol() << " connection\n" << toString()
+ << "\n" << *_exception;
}
}
else
@@ -1950,23 +1944,13 @@ Ice::ConnectionI::finish(bool close)
Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat);
out << "closed " << _endpoint->protocol() << " connection\n" << toString();
- //
- // Trace the cause of unexpected connection closures
- //
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ex)
+ if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get())))
{
- if(!(dynamic_cast<const CloseConnectionException*>(&ex) ||
- dynamic_cast<const ForcedCloseConnectionException*>(&ex) ||
- dynamic_cast<const ConnectionTimeoutException*>(&ex) ||
- dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
- dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex)))
- {
- out << "\n" << ex;
- }
+ out << "\n" << *_exception;
}
}
}
@@ -1986,14 +1970,9 @@ Ice::ConnectionI::finish(bool close)
if(_startCallback)
{
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const LocalException& ex)
- {
- _startCallback->connectionStartFailed(shared_from_this(), ex);
- }
+ assert(_exception);
+
+ _startCallback->connectionStartFailed(shared_from_this(), *_exception);
_startCallback = 0;
}
@@ -2033,50 +2012,39 @@ Ice::ConnectionI::finish(bool close)
#endif
}
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ex)
+
+ for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
{
- for(deque<OutgoingMessage>::iterator o = _sendStreams.begin(); o != _sendStreams.end(); ++o)
+ o->completed(*_exception);
+ if(o->requestId) // Make sure finished isn't called twice.
{
- o->completed(ex);
- if(o->requestId) // Make sure finished isn't called twice.
+ if(o->out)
{
- if(o->out)
- {
- _requests.erase(o->requestId);
- }
- else
- {
- _asyncRequests.erase(o->requestId);
- }
+ _requests.erase(o->requestId);
+ }
+ else
+ {
+ _asyncRequests.erase(o->requestId);
}
}
}
+
_sendStreams.clear(); // Must be cleared before _requests because of Outgoing* references in OutgoingMessage
}
- try
+
+ for(map<Int, OutgoingBase*>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ p->second->completed(*_exception);
}
- catch(const Ice::LocalException& ex)
- {
- for(map<Int, OutgoingBase*>::const_iterator p = _requests.begin(); p != _requests.end(); ++p)
- {
- p->second->completed(ex);
- }
- _requests.clear();
+ _requests.clear();
- for(map<Int, OutgoingAsyncBasePtr>::const_iterator q = _asyncRequests.begin(); q != _asyncRequests.end(); ++q)
+ for(map<Int, OutgoingAsyncBasePtr>::const_iterator q = _asyncRequests.begin(); q != _asyncRequests.end(); ++q)
+ {
+ if(q->second->exception(*_exception))
{
- if(q->second->exception(ex))
- {
- q->second->invokeException();
- }
+ q->second->invokeException();
}
}
@@ -2161,7 +2129,7 @@ Ice::ConnectionI::getInfo() const
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(_state >= StateClosed)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
return initConnectionInfo();
}
@@ -2172,7 +2140,7 @@ Ice::ConnectionI::setBufferSize(Ice::Int rcvSize, Ice::Int sndSize)
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(_state >= StateClosed)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
_transceiver->setBufferSize(rcvSize, sndSize);
_info = 0; // Invalidate the cached connection info
@@ -2299,13 +2267,13 @@ Ice::ConnectionI::setState(State state, const LocalException& ex)
return;
}
- if(!ICE_EXCEPTION_ISSET(_exception))
+ if(!_exception)
{
//
// If we are in closed state, an exception must be set.
//
assert(_state != StateClosed);
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
//
// We don't warn if we are not validated.
//
@@ -2364,99 +2332,92 @@ Ice::ConnectionI::setState(State state)
{
switch(state)
{
- case StateNotInitialized:
- {
- assert(false);
- break;
- }
-
- case StateNotValidated:
- {
- if(_state != StateNotInitialized)
+ case StateNotInitialized:
{
- assert(_state == StateClosed);
- return;
+ assert(false);
+ break;
}
- break;
- }
- case StateActive:
- {
- //
- // Can only switch from holding or not validated to
- // active.
- //
- if(_state != StateHolding && _state != StateNotValidated)
+ case StateNotValidated:
{
- return;
+ if(_state != StateNotInitialized)
+ {
+ assert(_state == StateClosed);
+ return;
+ }
+ break;
}
- _threadPool->_register(shared_from_this(), SocketOperationRead);
- break;
- }
- case StateHolding:
- {
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
- return;
- }
- if(_state == StateActive)
+ case StateActive:
{
- _threadPool->unregister(shared_from_this(), SocketOperationRead);
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
+ if(_state != StateHolding && _state != StateNotValidated)
+ {
+ return;
+ }
+ _threadPool->_register(shared_from_this(), SocketOperationRead);
+ break;
}
- break;
- }
- case StateClosing:
- case StateClosingPending:
- {
- //
- // Can't change back from closing pending.
- //
- if(_state >= StateClosingPending)
+ case StateHolding:
{
- return;
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
+ return;
+ }
+ if(_state == StateActive)
+ {
+ _threadPool->unregister(shared_from_this(), SocketOperationRead);
+ }
+ break;
}
- break;
- }
- case StateClosed:
- {
- if(_state == StateFinished)
+ case StateClosing:
+ case StateClosingPending:
{
- return;
+ //
+ // Can't change back from closing pending.
+ //
+ if(_state >= StateClosingPending)
+ {
+ return;
+ }
+ break;
}
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ex)
+ case StateClosed:
{
- _batchRequestQueue->destroy(ex);
+ if(_state == StateFinished)
+ {
+ return;
+ }
+
+ _batchRequestQueue->destroy(*_exception);
+
+ //
+ // Don't need to close now for connections so only close the transceiver
+ // if the selector request it.
+ //
+ if(_threadPool->finish(shared_from_this(), false))
+ {
+ _transceiver->close();
+ }
+ break;
}
- //
- // Don't need to close now for connections so only close the transceiver
- // if the selector request it.
- //
- if(_threadPool->finish(shared_from_this(), false))
+ case StateFinished:
{
- _transceiver->close();
+ assert(_state == StateClosed);
+ _communicator = 0;
+ break;
}
- break;
- }
-
- case StateFinished:
- {
- assert(_state == StateClosed);
- _communicator = 0;
- break;
- }
}
}
catch(const Ice::LocalException& ex)
@@ -2498,23 +2459,16 @@ Ice::ConnectionI::setState(State state)
newState,
_observer.get()));
}
- if(_observer && state == StateClosed && ICE_EXCEPTION_ISSET(_exception))
+ if(_observer && state == StateClosed && _exception)
{
- try
+ if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ConnectionTimeoutException*>(_exception.get()) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
+ (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state >= StateClosing)))
{
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ex)
- {
- if(!(dynamic_cast<const CloseConnectionException*>(&ex) ||
- dynamic_cast<const ForcedCloseConnectionException*>(&ex) ||
- dynamic_cast<const ConnectionTimeoutException*>(&ex) ||
- dynamic_cast<const CommunicatorDestroyedException*>(&ex) ||
- dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex) ||
- (dynamic_cast<const ConnectionLostException*>(&ex) && _state >= StateClosing)))
- {
- _observer->failed(ex.ice_id());
- }
+ _observer->failed(_exception->ice_id());
}
}
}
@@ -2571,7 +2525,7 @@ Ice::ConnectionI::initiateShutdown()
//
// Notify the the transceiver of the graceful connection closure.
//
- SocketOperation op = _transceiver->closing(true, *_exception.get());
+ SocketOperation op = _transceiver->closing(true, *_exception);
if(op)
{
scheduleTimeout(op);
@@ -2607,7 +2561,7 @@ Ice::ConnectionI::heartbeat()
catch(const LocalException& ex)
{
setState(StateClosed, ex);
- assert(ICE_EXCEPTION_ISSET(_exception));
+ assert(_exception);
}
}
}
@@ -2917,7 +2871,7 @@ Ice::ConnectionI::sendNextMessage(vector<OutgoingMessage>& callbacks)
if(_state == StateClosing && _shutdownInitiated)
{
setState(StateClosingPending);
- SocketOperation op = _transceiver->closing(true, *_exception.get());
+ SocketOperation op = _transceiver->closing(true, *_exception);
if(op)
{
return op;
@@ -3298,7 +3252,7 @@ Ice::ConnectionI::parseMessage(InputStream& stream, Int& invokeNum, Int& request
//
// Notify the the transceiver of the graceful connection closure.
//
- SocketOperation op = _transceiver->closing(false, *_exception.get());
+ SocketOperation op = _transceiver->closing(false, *_exception);
if(op)
{
return op;
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index c570cd3702a..1d723029947 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -418,7 +418,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref,
RequestCallbackPtr callback = new RequestCallback(ref, ttl, cb);
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
- if(!_response && !ICE_EXCEPTION_ISSET(_exception))
+ if(!_response && !_exception)
{
_callbacks.push_back(callback);
if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference
@@ -441,8 +441,8 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref,
}
else
{
- assert(ICE_EXCEPTION_ISSET(_exception));
- callback->exception(_locatorInfo, *_exception.get());
+ assert(_exception);
+ callback->exception(_locatorInfo, *_exception);
}
}
@@ -453,7 +453,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref,
bool& cached)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
- if(!_response && !ICE_EXCEPTION_ISSET(_exception))
+ if(!_response && !_exception)
{
if(wellKnownRef) // This request is to resolve the endpoints of a cached well-known object reference
{
@@ -467,15 +467,15 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref,
sync.acquire();
}
- while(!_response && !ICE_EXCEPTION_ISSET(_exception))
+ while(!_response && !_exception)
{
_monitor.wait();
}
}
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- _locatorInfo->getEndpointsException(ref, *_exception.get()); // This throws.
+ _locatorInfo->getEndpointsException(ref, *_exception); // This throws.
}
assert(_response);
@@ -534,7 +534,7 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex)
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
_locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex));
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
_monitor.notifyAll();
}
for(vector<RequestCallbackPtr>::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p)
diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp
index 66965b23332..592a9b2f9d4 100644
--- a/cpp/src/Ice/Outgoing.cpp
+++ b/cpp/src/Ice/Outgoing.cpp
@@ -91,7 +91,7 @@ ProxyOutgoingBase::completed(const Ice::Exception& ex)
_childObserver.detach();
_state = StateFailed;
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
_monitor.notify();
}
@@ -127,7 +127,7 @@ ProxyOutgoingBase::invokeImpl()
}
_state = StateInProgress;
- ICE_RESET_EXCEPTION(_exception, ICE_NULLPTR);
+ _exception.reset();
_sent = false;
_handler = _proxy->__getRequestHandler();
@@ -211,9 +211,9 @@ ProxyOutgoingBase::invokeImpl()
}
}
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
else if(_state == StateRetry)
{
@@ -506,8 +506,7 @@ Outgoing::completed(InputStream& is)
ex->id = ident;
ex->facet = facet;
ex->operation = operation;
- ICE_RESET_EXCEPTION(_exception, ex->ice_clone());
- delete ex;
+ _exception.reset(ex); // adopt
_state = StateLocalException; // The state must be set last, in case there is an exception.
break;
}
@@ -554,7 +553,7 @@ Outgoing::completed(InputStream& is)
}
ex->unknown = unknown;
- ICE_RESET_EXCEPTION(_exception, ex->ice_clone());
+ _exception.reset(ex); // adopt
_state = StateLocalException; // The state must be set last, in case there is an exception.
break;
}
@@ -639,19 +638,19 @@ ConnectionFlushBatch::invoke()
else if(!_connection->sendRequest(this, false, false, batchRequestNum))
{
Monitor<Mutex>::Lock sync(_monitor);
- while(!ICE_EXCEPTION_ISSET(_exception) && !_sent)
+ while(!_exception && !_sent)
{
_monitor.wait();
}
- if(ICE_EXCEPTION_ISSET(_exception))
+ if(_exception)
{
- ICE_RETHROW_EXCEPTION(_exception);
+ _exception->ice_throw();
}
}
}
catch(const RetryException& ex)
{
- ICE_RETHROW_EXCEPTION(ex.get());
+ ex.get()->ice_throw();
}
}
@@ -677,7 +676,7 @@ ConnectionFlushBatch::completed(const Ice::Exception& ex)
Monitor<Mutex>::Lock sync(_monitor);
_childObserver.failed(ex.ice_id());
_childObserver.detach();
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
_monitor.notify();
}
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index 507311ce3f8..e43acc7b521 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -187,14 +187,7 @@ OutgoingAsyncBase::invokeException()
{
try
{
- try
- {
- ICE_RETHROW_EXCEPTION(_ex);
- }
- catch(const Ice::Exception& ex)
- {
- handleInvokeException(ex, this);
- }
+ handleInvokeException(*_ex, this);
}
catch(const std::exception& ex)
{
@@ -211,7 +204,7 @@ OutgoingAsyncBase::invokeException()
void
OutgoingAsyncBase::invokeResponse()
{
- if(ICE_EXCEPTION_ISSET(_ex))
+ if(_ex)
{
invokeException();
return;
@@ -255,15 +248,15 @@ void
OutgoingAsyncBase::cancelable(const CancellationHandlerPtr& handler)
{
Lock sync(_m);
- if(ICE_EXCEPTION_ISSET(_cancellationException))
+ if(_cancellationException)
{
try
{
- ICE_RETHROW_EXCEPTION(_cancellationException);
+ _cancellationException->ice_throw();
}
catch(const Ice::LocalException&)
{
- ICE_RESET_EXCEPTION(_cancellationException, ICE_NULLPTR);
+ _cancellationException.reset();
throw;
}
}
@@ -319,7 +312,7 @@ bool
OutgoingAsyncBase::exceptionImpl(const Exception& ex)
{
Lock sync(_m);
- ICE_RESET_EXCEPTION(_ex, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_ex, ex.ice_clone());
if(_childObserver)
{
_childObserver.failed(ex.ice_id());
@@ -364,7 +357,7 @@ OutgoingAsyncBase::responseImpl(bool ok)
}
catch(const Ice::Exception& ex)
{
- ICE_RESET_EXCEPTION(_ex, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_ex, ex.ice_clone());
invoke = handleException(ex);
}
if(!invoke)
@@ -380,7 +373,7 @@ OutgoingAsyncBase::cancel(const Ice::LocalException& ex)
CancellationHandlerPtr handler;
{
Lock sync(_m);
- ICE_RESET_EXCEPTION(_cancellationException, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_cancellationException, ex.ice_clone());
if(!_cancellationHandler)
{
return;
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 4e28f98dac7..92ca821b3e9 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -1777,22 +1777,15 @@ IceInternal::RoutableReference::createConnection(const vector<EndpointIPtr>& all
virtual void
setException(const Ice::LocalException& ex)
{
- if(!ICE_EXCEPTION_ISSET(_exception))
+ if(!_exception)
{
- ICE_RESET_EXCEPTION(_exception, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone());
}
if(++_i == _endpoints.size())
{
- try
- {
- ICE_RETHROW_EXCEPTION(_exception);
- }
- catch(const Ice::LocalException& ee)
- {
- _callback->setException(ee);
- return;
- }
+ _callback->setException(*_exception);
+ return;
}
const bool more = _i != _endpoints.size() - 1;
diff --git a/cpp/src/Ice/RequestHandler.cpp b/cpp/src/Ice/RequestHandler.cpp
index 35e67a41864..52d391c837d 100644
--- a/cpp/src/Ice/RequestHandler.cpp
+++ b/cpp/src/Ice/RequestHandler.cpp
@@ -21,12 +21,12 @@ IceUtil::Shared* IceInternal::upCast(CancellationHandler* p) { return p; }
RetryException::RetryException(const Ice::LocalException& ex)
{
- ICE_RESET_EXCEPTION(_ex, ex.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_ex, ex.ice_clone());
}
RetryException::RetryException(const RetryException& ex)
{
- ICE_RESET_EXCEPTION(_ex, ex.get()->ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_ex, ex.get()->ice_clone());
}
const Ice::LocalException*
diff --git a/cpp/src/IceGrid/msbuild/icegridnode/icegridnode.vcxproj b/cpp/src/IceGrid/msbuild/icegridnode/icegridnode.vcxproj
index e8838e1e186..dacd9076b8e 100644
--- a/cpp/src/IceGrid/msbuild/icegridnode/icegridnode.vcxproj
+++ b/cpp/src/IceGrid/msbuild/icegridnode/icegridnode.vcxproj
@@ -96,6 +96,7 @@
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(Platform)\$(Configuration)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -104,6 +105,7 @@
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(Platform)\$(Configuration)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/cpp/src/IceGrid/msbuild/icegridregistry/icegridregistry.vcxproj b/cpp/src/IceGrid/msbuild/icegridregistry/icegridregistry.vcxproj
index eadefff96c7..76d03af113b 100644
--- a/cpp/src/IceGrid/msbuild/icegridregistry/icegridregistry.vcxproj
+++ b/cpp/src/IceGrid/msbuild/icegridregistry/icegridregistry.vcxproj
@@ -96,6 +96,7 @@
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(Platform)\$(Configuration)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -104,6 +105,7 @@
</Link>
<ClCompile>
<AdditionalIncludeDirectories>$(Platform)\$(Configuration)\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
index 9ae2a3a83d3..e14f32793a9 100644
--- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
+++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp
@@ -84,7 +84,7 @@ void
AMDInterceptorI::setActualStatus(const IceUtil::Exception& e)
{
IceUtil::Mutex::Lock lock(_mutex);
- ICE_RESET_EXCEPTION(_exception, e.ice_clone());
+ ICE_SET_EXCEPTION_FROM_CLONE(_exception, e.ice_clone());
_actualStatus = Ice::DispatchAsync;
}
@@ -108,7 +108,7 @@ AMDInterceptorI::clear()
InterceptorI::clear();
IceUtil::Mutex::Lock lock(_mutex);
_actualStatus = Ice::DispatchAsync;
- ICE_RESET_EXCEPTION(_exception, ICE_NULLPTR);
+ _exception.reset();
}
diff --git a/cpp/test/Ice/metrics/msbuild/collocated/collocated.vcxproj b/cpp/test/Ice/metrics/msbuild/collocated/collocated.vcxproj
index 7521aa0136b..4baa83c76f4 100644
--- a/cpp/test/Ice/metrics/msbuild/collocated/collocated.vcxproj
+++ b/cpp/test/Ice/metrics/msbuild/collocated/collocated.vcxproj
@@ -125,6 +125,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|Win32'">
@@ -145,6 +146,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalOptions>/bigobj -d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Cpp11-Release|x64'">
diff --git a/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX b/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX
index 674c86e7d6d..043f78ebd09 100644
--- a/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX
+++ b/cpp/test/IceUtil/stacktrace/StackTrace.debug.OSX
@@ -1,11 +1,11 @@
- 0 IceUtil::Exception::Exception(char const*, int) in
- 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) in
- 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in
- 3 IceUtil::NullHandleException::NullHandleException(char const*, int) in
+ 0 IceUtil::Exception::Exception(char const*, int) in libIce.3.7a3.dylib
+ 1 IceUtil::ExceptionHelper<IceUtil::NullHandleException>::ExceptionHelper(char const*, int) in libIce.3.7a3.dylib
+ 2 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7a3.dylib
+ 3 IceUtil::NullHandleException::NullHandleException(char const*, int) in libIce.3.7a3.dylib
4 (anonymous namespace)::Thrower::fifth() in client
5 (anonymous namespace)::Thrower::forth() in client
6 (anonymous namespace)::Thrower::third() in client
7 (anonymous namespace)::Thrower::second() in client
8 (anonymous namespace)::Thrower::first() in client
9 main in client
- 10 start in libdyld.dylib
+ 10 start in libdyld.dylib \ No newline at end of file