diff options
author | Benoit Foucher <benoit@zeroc.com> | 2014-09-25 12:24:57 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2014-09-25 12:24:57 +0200 |
commit | 356e14707a342da8102b731503c8f2628c1cc79b (patch) | |
tree | b15b837cad964f6ab3a66670ac6eb89a1d832677 | |
parent | Fixed compilation problem with Ruby on OS X (diff) | |
download | ice-356e14707a342da8102b731503c8f2628c1cc79b.tar.bz2 ice-356e14707a342da8102b731503c8f2628c1cc79b.tar.xz ice-356e14707a342da8102b731503c8f2628c1cc79b.zip |
Fixed ICE-5687 - adapterDeactivation test warnings
-rw-r--r-- | cpp/src/Ice/ProxyFactory.cpp | 10 | ||||
-rw-r--r-- | cpp/src/Ice/RetryQueue.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Ice/RetryQueue.h | 2 | ||||
-rw-r--r-- | cs/src/Ice/ProxyFactory.cs | 10 | ||||
-rw-r--r-- | cs/src/Ice/RetryQueue.cs | 5 | ||||
-rw-r--r-- | java/src/IceInternal/ProxyFactory.java | 9 | ||||
-rw-r--r-- | java/src/IceInternal/RetryQueue.java | 7 | ||||
-rw-r--r-- | js/src/Ice/ProxyFactory.js | 9 | ||||
-rw-r--r-- | js/src/Ice/RetryQueue.js | 5 |
9 files changed, 60 insertions, 2 deletions
diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index b38e281622a..68ca8b02598 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -211,6 +211,16 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co } // + // Don't retry if the communicator is destroyed or object adapter + // deactivated. + // + if(dynamic_cast<const CommunicatorDestroyedException*>(&ex) || + dynamic_cast<const ObjectAdapterDeactivatedException*>(&ex)) + { + ex.ice_throw(); + } + + // // Don't retry invocation timeouts. // if(dynamic_cast<const InvocationTimeoutException*>(&ex)) diff --git a/cpp/src/Ice/RetryQueue.cpp b/cpp/src/Ice/RetryQueue.cpp index 730b15ba73d..785a650f7f0 100644 --- a/cpp/src/Ice/RetryQueue.cpp +++ b/cpp/src/Ice/RetryQueue.cpp @@ -52,6 +52,10 @@ void IceInternal::RetryQueue::add(const OutgoingAsyncMessageCallbackPtr& out, int interval) { Lock sync(*this); + if(!_instance) + { + throw CommunicatorDestroyedException(__FILE__, __LINE__); + } RetryTaskPtr task = new RetryTask(this, out); try { @@ -68,6 +72,7 @@ void IceInternal::RetryQueue::destroy() { Lock sync(*this); + _instance = 0; for(set<RetryTaskPtr>::const_iterator p = _requests.begin(); p != _requests.end(); ++p) { _instance->timer()->cancel(*p); diff --git a/cpp/src/Ice/RetryQueue.h b/cpp/src/Ice/RetryQueue.h index 4339a7765b2..07307310c8d 100644 --- a/cpp/src/Ice/RetryQueue.h +++ b/cpp/src/Ice/RetryQueue.h @@ -52,7 +52,7 @@ private: bool remove(const RetryTaskPtr&); friend class RetryTask; - const InstancePtr _instance; + InstancePtr _instance; std::set<RetryTaskPtr> _requests; }; diff --git a/cs/src/Ice/ProxyFactory.cs b/cs/src/Ice/ProxyFactory.cs index c8e8f80fd41..5f9995016f7 100644 --- a/cs/src/Ice/ProxyFactory.cs +++ b/cs/src/Ice/ProxyFactory.cs @@ -189,6 +189,16 @@ namespace IceInternal throw ex; } + + // + // Don't retry if the communicator is destroyed or object adapter + // deactivated. + // + if(ex is Ice.CommunicatorDestroyedException || ex is Ice.ObjectAdapterDeactivatedException) + { + throw ex; + } + // // Don't retry invocation timeouts. // diff --git a/cs/src/Ice/RetryQueue.cs b/cs/src/Ice/RetryQueue.cs index f97b7431091..fe7006fe204 100644 --- a/cs/src/Ice/RetryQueue.cs +++ b/cs/src/Ice/RetryQueue.cs @@ -47,6 +47,10 @@ namespace IceInternal { lock(this) { + if(_instance == null) + { + throw new Ice.CommunicatorDestroyedException(); + } RetryTask task = new RetryTask(this, outAsync); _instance.timer().schedule(task, interval); _requests.Add(task, null); @@ -58,6 +62,7 @@ namespace IceInternal { lock(this) { + _instance = null; foreach(RetryTask task in _requests.Keys) { _instance.timer().cancel(task); diff --git a/java/src/IceInternal/ProxyFactory.java b/java/src/IceInternal/ProxyFactory.java index 59fc8028e34..fb664c89b9b 100644 --- a/java/src/IceInternal/ProxyFactory.java +++ b/java/src/IceInternal/ProxyFactory.java @@ -206,6 +206,15 @@ public final class ProxyFactory } // + // Don't retry if the communicator is destroyed or object adapter + // deactivated. + // + if(ex instanceof Ice.CommunicatorDestroyedException || ex instanceof Ice.ObjectAdapterDeactivatedException) + { + throw ex; + } + + // // Don't retry invocation timeouts. // if(ex instanceof Ice.InvocationTimeoutException) diff --git a/java/src/IceInternal/RetryQueue.java b/java/src/IceInternal/RetryQueue.java index 023992f31f9..232ee1568cd 100644 --- a/java/src/IceInternal/RetryQueue.java +++ b/java/src/IceInternal/RetryQueue.java @@ -19,6 +19,10 @@ public class RetryQueue synchronized public void add(OutgoingAsyncMessageCallback outAsync, int interval) { + if(_instance == null) + { + throw new Ice.CommunicatorDestroyedException(); + } RetryTask task = new RetryTask(this, outAsync); task.setFuture(_instance.timer().schedule(task, interval, java.util.concurrent.TimeUnit.MILLISECONDS)); _requests.add(task); @@ -27,6 +31,7 @@ public class RetryQueue synchronized public void destroy() { + _instance = null; for(RetryTask task : _requests) { task.destroy(); @@ -40,6 +45,6 @@ public class RetryQueue return _requests.remove(task); } - final private Instance _instance; + private Instance _instance; final private java.util.HashSet<RetryTask> _requests = new java.util.HashSet<RetryTask>(); } diff --git a/js/src/Ice/ProxyFactory.js b/js/src/Ice/ProxyFactory.js index 15ae4d1aa13..169a70cef7a 100644 --- a/js/src/Ice/ProxyFactory.js +++ b/js/src/Ice/ProxyFactory.js @@ -241,6 +241,15 @@ var ProxyFactory = Ice.Class({ } // + // Don't retry if the communicator is destroyed or object adapter + // deactivated. + // + if(ex instanceof Ice.CommunicatorDestroyedException || ex instanceof Ice.ObjectAdapterDeactivatedException) + { + throw ex; + } + + // // Don't retry invocation timeouts. // if(ex instanceof Ice.InvocationTimeoutException) diff --git a/js/src/Ice/RetryQueue.js b/js/src/Ice/RetryQueue.js index e7e95a3fa4e..f0638519a06 100644 --- a/js/src/Ice/RetryQueue.js +++ b/js/src/Ice/RetryQueue.js @@ -20,6 +20,10 @@ var RetryQueue = Class({ }, add: function(outAsync, interval) { + if(this._instance === null) + { + throw new Ice.CommunicatorDestroyedException(); + } var task = new RetryTask(this, outAsync); this._instance.timer().schedule(function() { @@ -29,6 +33,7 @@ var RetryQueue = Class({ }, destroy: function() { + this._instance = null; for(var i = 0; i < this._requests.length; ++i) { this._requests[i].destroy(); |