summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/IncomingAsync.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2009-09-21 16:15:07 +0200
committerJose <jose@zeroc.com>2009-09-21 16:15:07 +0200
commit43cbfc83ab7190102d4d893272e443ef774f00dc (patch)
treeb0bf90ab7cc1f1958de4077639cd8920caa4425d /cpp/src/Ice/IncomingAsync.cpp
parentFixed bug 4118 - don't run IceGrid/admin as root (diff)
downloadice-43cbfc83ab7190102d4d893272e443ef774f00dc.tar.bz2
ice-43cbfc83ab7190102d4d893272e443ef774f00dc.tar.xz
ice-43cbfc83ab7190102d4d893272e443ef774f00dc.zip
2214 - Generated code for AMD callbacks.
Diffstat (limited to 'cpp/src/Ice/IncomingAsync.cpp')
-rw-r--r--cpp/src/Ice/IncomingAsync.cpp209
1 files changed, 98 insertions, 111 deletions
diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp
index ee80f85cec7..9815fcb2fe4 100644
--- a/cpp/src/Ice/IncomingAsync.cpp
+++ b/cpp/src/Ice/IncomingAsync.cpp
@@ -85,6 +85,82 @@ IceInternal::IncomingAsync::__deactivate(Incoming& in)
}
void
+IceInternal::IncomingAsync::ice_exception(const ::std::exception& ex)
+{
+ //
+ // Only call __exception if this incoming is not retriable or if
+ // all the interceptors return true and no response has been sent
+ // yet.
+ //
+
+ if(_retriable)
+ {
+ try
+ {
+ for(deque<Ice::DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
+ p != _interceptorAsyncCallbackQueue.end(); ++p)
+ {
+ if((*p)->exception(ex) == false)
+ {
+ return;
+ }
+ }
+ }
+ catch(...)
+ {
+ return;
+ }
+
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
+ if(!_active)
+ {
+ return;
+ }
+ _active = false;
+ }
+
+ __exception(ex);
+}
+
+void
+IceInternal::IncomingAsync::ice_exception()
+{
+ //
+ // Only call __exception if this incoming is not retriable or if
+ // all the interceptors return true and no response has been sent
+ // yet.
+ //
+
+ if(_retriable)
+ {
+ try
+ {
+ for(deque<Ice::DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
+ p != _interceptorAsyncCallbackQueue.end(); ++p)
+ {
+ if((*p)->exception() == false)
+ {
+ return;
+ }
+ }
+ }
+ catch(...)
+ {
+ return;
+ }
+
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
+ if(!_active)
+ {
+ return;
+ }
+ _active = false;
+ }
+
+ __exception();
+}
+
+void
IceInternal::IncomingAsync::__response(bool ok)
{
try
@@ -159,113 +235,41 @@ IceInternal::IncomingAsync::__exception()
bool
IceInternal::IncomingAsync::__validateResponse(bool ok)
{
- if(!_retriable)
- {
- return true;
- }
-
- try
+ //
+ // Only returns true if this incoming is not retriable or if all
+ // the interceptors return true and no response has been sent
+ // yet. Upon getting a true return value, the caller should send
+ // the response.
+ //
+
+ if(_retriable)
{
- for(std::deque<Ice::DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
- p != _interceptorAsyncCallbackQueue.end(); ++p)
+ try
{
- if((*p)->response(ok) == false)
+ for(deque<DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
+ p != _interceptorAsyncCallbackQueue.end(); ++p)
{
- return false;
+ if((*p)->response(ok) == false)
+ {
+ return false;
+ }
}
}
- }
- catch(...)
- {
- return false;
- }
-
- IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
- if(_active)
- {
- _active = false;
- return true;
- }
- else
- {
- return false;
- }
-}
-
-
-bool
-IceInternal::IncomingAsync::__validateException(const std::exception& ex)
-{
- if(!_retriable)
- {
- return true;
- }
-
- try
- {
- for(std::deque<Ice::DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
- p != _interceptorAsyncCallbackQueue.end(); ++p)
+ catch(...)
{
- if((*p)->exception(ex) == false)
- {
- return false;
- }
+ return false;
}
- }
- catch(...)
- {
- return false;
- }
-
- IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
- if(_active)
- {
- _active = false;
- return true;
- }
- else
- {
- return false;
- }
-}
-
-bool
-IceInternal::IncomingAsync::__validateException()
-{
- if(!_retriable)
- {
- return true;
- }
-
- try
- {
- for(std::deque<Ice::DispatchInterceptorAsyncCallbackPtr>::iterator p = _interceptorAsyncCallbackQueue.begin();
- p != _interceptorAsyncCallbackQueue.end(); ++p)
+
+ IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
+ if(!_active)
{
- if((*p)->exception() == false)
- {
- return false;
- }
+ return false;
}
- }
- catch(...)
- {
- return false;
- }
-
- IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(globalMutex);
- if(_active)
- {
_active = false;
- return true;
- }
- else
- {
- return false;
}
+ return true;
}
-
IceAsync::Ice::AMD_Object_ice_invoke::AMD_Object_ice_invoke(Incoming& in) :
IncomingAsync(in)
{
@@ -307,20 +311,3 @@ IceAsync::Ice::AMD_Object_ice_invoke::ice_response(bool ok, const pair<const Byt
}
}
-void
-IceAsync::Ice::AMD_Object_ice_invoke::ice_exception(const std::exception& ex)
-{
- if(__validateException(ex))
- {
- __exception(ex);
- }
-}
-
-void
-IceAsync::Ice::AMD_Object_ice_invoke::ice_exception()
-{
- if(__validateException())
- {
- __exception();
- }
-}