diff options
-rw-r--r-- | cpp/src/Ice/Object.cpp | 3 | ||||
-rw-r--r-- | cpp/test/Ice/interceptor/AMDInterceptorI.cpp | 50 | ||||
-rw-r--r-- | cpp/test/Ice/interceptor/MyObjectI.cpp | 2 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java | 13 | ||||
-rw-r--r-- | java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java | 2 |
5 files changed, 30 insertions, 40 deletions
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 0b4a3295126..f69ffc497a3 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -192,8 +192,9 @@ Ice::Object::ice_dispatch(Request& request, const DispatchInterceptorAsyncCallba #endif try { - return _iceDispatch(in, in.getCurrent()); + bool sync = _iceDispatch(in, in.getCurrent()); in.pop(); + return sync; } catch(...) { diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index cfd3490288c..05fc80709e1 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -30,6 +30,9 @@ AMDInterceptorI::dispatch(Ice::Request& request) class CallbackI : public Ice::DispatchInterceptorAsyncCallback { public: + CallbackI() : _count(0) + { + } virtual bool response() { @@ -38,6 +41,7 @@ AMDInterceptorI::dispatch(Ice::Request& request) virtual bool exception(const std::exception& ex) { + test(_count++ == 0); // Ensure it's only called once test(dynamic_cast<const Test::RetryException*>(&ex) != 0); return false; } @@ -50,8 +54,11 @@ AMDInterceptorI::dispatch(Ice::Request& request) test(false); return false; } + + private: + + int _count; }; - Ice::DispatchInterceptorAsyncCallbackPtr cb = ICE_MAKE_SHARED(CallbackI); #endif Ice::Current& current = const_cast<Ice::Current&>(request.getCurrent()); @@ -61,34 +68,25 @@ AMDInterceptorI::dispatch(Ice::Request& request) { for(int i = 0; i < 10; ++i) { - try - { #ifdef ICE_CPP11_MAPPING - _lastStatus = _servant->ice_dispatch(request, nullptr, [](exception_ptr ex) { - try - { - rethrow_exception(ex); - } - catch(Test::RetryException&) - { - } - catch(...) - { - test(false); - } - return false; - }); + _lastStatus = _servant->ice_dispatch(request, nullptr, [](exception_ptr ex) { + try + { + rethrow_exception(ex); + } + catch(Test::RetryException&) + { + } + catch(...) + { + test(false); + } + return false; + }); #else - _lastStatus = _servant->ice_dispatch(request, cb); + _lastStatus = _servant->ice_dispatch(request, new CallbackI()); #endif - test(_lastStatus); - } - catch(const Test::RetryException&) - { - // - // Expected, retry - // - } + test(!_lastStatus); } current.ctx["retry"] = "no"; diff --git a/cpp/test/Ice/interceptor/MyObjectI.cpp b/cpp/test/Ice/interceptor/MyObjectI.cpp index a452568dbcb..02e009fd51e 100644 --- a/cpp/test/Ice/interceptor/MyObjectI.cpp +++ b/cpp/test/Ice/interceptor/MyObjectI.cpp @@ -258,7 +258,7 @@ MyObjectI::amdAddWithRetry_async(const Test::AMD_MyObject_amdAddWithRetryPtr& cb if(p == current.ctx.end() || p->second != "no") { - throw Test::RetryException(__FILE__, __LINE__); + cb->ice_exception(Test::RetryException(__FILE__, __LINE__)); } } diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java index 01352f04c04..5684ae74c0b 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/AMDInterceptorI.java @@ -50,17 +50,8 @@ class AMDInterceptorI extends InterceptorI implements Ice.DispatchInterceptorAsy } }; - try - { - _lastStatus = _servant.ice_dispatch(request, cb); - test(_lastStatus); - } - catch(RetryException ex) - { - // - // Expected, retry - // - } + _lastStatus = _servant.ice_dispatch(request, cb); + test(!_lastStatus); } request.getCurrent().ctx.put("retry", "no"); diff --git a/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java index 42ed9671a2b..4affa6446da 100644 --- a/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java +++ b/java-compat/test/src/main/java/test/Ice/interceptor/MyObjectI.java @@ -120,7 +120,7 @@ class MyObjectI extends _MyObjectDisp if(val == null || !val.equals("no")) { - throw new RetryException(); + cb.ice_exception(new RetryException()); } } |