diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-02-10 15:48:21 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-02-10 15:48:21 -0500 |
commit | 4b99177fe0b4a7bd8cf3cc05a8cce0149bf41207 (patch) | |
tree | 737adda6375612140c3203086d240a749de1e69d /csharp/src | |
parent | FileTracker cleanup and simplifcations (diff) | |
download | ice-4b99177fe0b4a7bd8cf3cc05a8cce0149bf41207.tar.bz2 ice-4b99177fe0b4a7bd8cf3cc05a8cce0149bf41207.tar.xz ice-4b99177fe0b4a7bd8cf3cc05a8cce0149bf41207.zip |
C# implementation of setPublishedEndpoints
commit e2ec6cd17350f81af4062df53bfd4f828f52540b
Author: Bernard Normier <bernard@zeroc.com>
Date: Fri Feb 10 12:09:45 2017 -0500
New operation setPublishedEndpoints on ObjectAdapter
Diffstat (limited to 'csharp/src')
-rw-r--r-- | csharp/src/Ice/ObjectAdapterI.cs | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/csharp/src/Ice/ObjectAdapterI.cs b/csharp/src/Ice/ObjectAdapterI.cs index 01892c30401..98c1c7bbafc 100644 --- a/csharp/src/Ice/ObjectAdapterI.cs +++ b/csharp/src/Ice/ObjectAdapterI.cs @@ -554,6 +554,19 @@ namespace Ice } } + public Endpoint[] getEndpoints() + { + lock(this) + { + List<Endpoint> endpoints = new List<Endpoint>(); + foreach(IncomingConnectionFactory factory in _incomingConnectionFactories) + { + endpoints.Add(factory.endpoint()); + } + return endpoints.ToArray(); + } + } + public void refreshPublishedEndpoints() { LocatorInfo locatorInfo = null; @@ -588,24 +601,52 @@ namespace Ice } } - public Endpoint[] getEndpoints() + public Endpoint[] getPublishedEndpoints() { lock(this) { - List<Endpoint> endpoints = new List<Endpoint>(); - foreach(IncomingConnectionFactory factory in _incomingConnectionFactories) - { - endpoints.Add(factory.endpoint()); - } - return endpoints.ToArray(); + return _publishedEndpoints.ToArray(); } } - public Endpoint[] getPublishedEndpoints() + public void setPublishedEndpoints(Endpoint[] newEndpoints) { + List<EndpointI> newPublishedEndpoints = new List<EndpointI>(newEndpoints.Length); + + foreach(Endpoint e in newEndpoints) + { + newPublishedEndpoints.Add((EndpointI)e); + } + + LocatorInfo locatorInfo = null; + List<EndpointI> oldPublishedEndpoints; + lock(this) { - return _publishedEndpoints.ToArray(); + checkForDeactivation(); + + oldPublishedEndpoints = _publishedEndpoints; + _publishedEndpoints = newPublishedEndpoints; + + locatorInfo = _locatorInfo; + } + + try + { + Identity dummy = new Identity(); + dummy.name = "dummy"; + updateLocatorRegistry(locatorInfo, createDirectProxy(dummy)); + } + catch(LocalException) + { + lock(this) + { + // + // Restore the old published endpoints. + // + _publishedEndpoints = oldPublishedEndpoints; + throw; + } } } |