diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-09-09 11:18:02 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-09-09 11:18:02 +0200 |
commit | 5a57091655dc71d3b5f57c2df2fa835b7047e560 (patch) | |
tree | 97bc10b738d991baf2ba936b15e7fd60feb9e3da /cs/src/Ice/ObjectAdapterFactory.cs | |
parent | More scalable connection reaping (diff) | |
download | ice-5a57091655dc71d3b5f57c2df2fa835b7047e560.tar.bz2 ice-5a57091655dc71d3b5f57c2df2fa835b7047e560.tar.xz ice-5a57091655dc71d3b5f57c2df2fa835b7047e560.zip |
Fixed bug 4249 - waitForHold waits outside the OA sync
Diffstat (limited to 'cs/src/Ice/ObjectAdapterFactory.cs')
-rw-r--r-- | cs/src/Ice/ObjectAdapterFactory.cs | 58 |
1 files changed, 13 insertions, 45 deletions
diff --git a/cs/src/Ice/ObjectAdapterFactory.cs b/cs/src/Ice/ObjectAdapterFactory.cs index 417aa90837e..74675865f79 100644 --- a/cs/src/Ice/ObjectAdapterFactory.cs +++ b/cs/src/Ice/ObjectAdapterFactory.cs @@ -31,7 +31,7 @@ namespace IceInternal return; } - adapters = _adapters; + adapters = new List<Ice.ObjectAdapterI>(_adapters); instance_ = null; _communicator = null; @@ -62,36 +62,15 @@ namespace IceInternal System.Threading.Monitor.Wait(this); } - // - // If some other thread is currently shutting down, we wait - // until this thread is finished. - // - while(_waitForShutdown) - { - System.Threading.Monitor.Wait(this); - } - _waitForShutdown = true; - adapters = _adapters; + adapters = new List<Ice.ObjectAdapterI>(_adapters); } // // Now we wait for deactivation of each object adapter. // - if(adapters != null) + foreach(Ice.ObjectAdapter adapter in adapters) { - foreach(Ice.ObjectAdapter adapter in adapters) - { - adapter.waitForDeactivate(); - } - } - - lock(this) - { - // - // Signal that waiting is complete. - // - _waitForShutdown = false; - System.Threading.Monitor.PulseAll(this); + adapter.waitForDeactivate(); } } @@ -113,21 +92,17 @@ namespace IceInternal List<Ice.ObjectAdapterI> adapters; lock(this) { - adapters = _adapters; + adapters = new List<Ice.ObjectAdapterI>(_adapters); + } - // - // We set _adapters to null because our destructor must not - // invoke methods on member objects. - // - _adapters = null; + foreach(Ice.ObjectAdapter adapter in adapters) + { + adapter.destroy(); } - if(adapters != null) + lock(this) { - foreach(Ice.ObjectAdapter adapter in adapters) - { - adapter.destroy(); - } + _adapters.Clear(); } } @@ -173,7 +148,7 @@ namespace IceInternal return null; } - adapters = _adapters; + adapters = new List<Ice.ObjectAdapterI>(_adapters); } foreach(Ice.ObjectAdapterI adapter in adapters) @@ -213,12 +188,7 @@ namespace IceInternal List<Ice.ObjectAdapterI> adapters; lock(this) { - if(_adapters == null) - { - return; - } - - adapters = _adapters; + adapters = new List<Ice.ObjectAdapterI>(_adapters); } foreach(Ice.ObjectAdapterI adapter in adapters) @@ -236,14 +206,12 @@ namespace IceInternal _communicator = communicator; _adapterNamesInUse = new Set(); _adapters = new List<Ice.ObjectAdapterI>(); - _waitForShutdown = false; } private Instance instance_; private Ice.Communicator _communicator; private Set _adapterNamesInUse; private List<Ice.ObjectAdapterI> _adapters; - private bool _waitForShutdown; } } |