diff options
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; + } } } |