summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/Discovery
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2021-01-14 12:12:47 -0500
committerGitHub <noreply@github.com>2021-01-14 12:12:47 -0500
commit05edde5bcae0e5ee6b31bdb9923a8e5bb80fede1 (patch)
treefae64c8758ed0226c7bc005ce9372c6a511b643c /csharp/src/Ice/Discovery
parentMoved alias test from Slice to Ice test directory. (diff)
downloadice-before_streamline.tar.bz2
ice-before_streamline.tar.xz
ice-before_streamline.zip
Switch to Async skeletons in Ice core (#1240)before_streamline
Diffstat (limited to 'csharp/src/Ice/Discovery')
-rw-r--r--csharp/src/Ice/Discovery/Locator.cs32
-rw-r--r--csharp/src/Ice/Discovery/LocatorRegistry.cs26
2 files changed, 34 insertions, 24 deletions
diff --git a/csharp/src/Ice/Discovery/Locator.cs b/csharp/src/Ice/Discovery/Locator.cs
index 14673bf24da..8e5fea27bdd 100644
--- a/csharp/src/Ice/Discovery/Locator.cs
+++ b/csharp/src/Ice/Discovery/Locator.cs
@@ -307,7 +307,7 @@ namespace ZeroC.Ice.Discovery
// If the timeout was canceled we delay the completion of the request to give a chance to other
// members of this replica group to reply
return await
- replyServant.WaitForReplicaGroupRepliesAsync(start, _latencyMultiplier).ConfigureAwait(false);
+ replyServant.GetReplicaGroupRepliesAsync(start, _latencyMultiplier).ConfigureAwait(false);
}
// else timeout, so we retry until _retryCount
}
@@ -338,9 +338,7 @@ namespace ZeroC.Ice.Discovery
_replyAdapter.Remove(Identity);
}
- internal void SetEmptyResult() => _completionSource.SetResult(_emptyResult);
-
- internal async Task<TResult> WaitForReplicaGroupRepliesAsync(TimeSpan start, int latencyMultiplier)
+ internal async Task<TResult> GetReplicaGroupRepliesAsync(TimeSpan start, int latencyMultiplier)
{
// This method is called by InvokeAsync after the first reply from a replica group to wait for additional
// replies from the replica group.
@@ -355,6 +353,8 @@ namespace ZeroC.Ice.Discovery
return await Task.ConfigureAwait(false);
}
+ internal void SetEmptyResult() => _completionSource.SetResult(_emptyResult);
+
private protected ReplyServant(TResult emptyResult, ObjectAdapter replyAdapter)
{
// Add servant (this) to object adapter with new UUID identity.
@@ -378,12 +378,12 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface FindAdapterByIdReply.</summary>
- internal sealed class FindAdapterByIdReply : ReplyServant<IObjectPrx?>, IFindAdapterByIdReply
+ internal sealed class FindAdapterByIdReply : ReplyServant<IObjectPrx?>, IAsyncFindAdapterByIdReply
{
private readonly object _mutex = new();
private readonly HashSet<IObjectPrx> _proxies = new();
- public void FoundAdapterById(
+ public ValueTask FoundAdapterByIdAsync(
string adapterId,
IObjectPrx proxy,
bool isReplicaGroup,
@@ -407,6 +407,7 @@ namespace ZeroC.Ice.Discovery
{
SetResult(proxy);
}
+ return default;
}
internal FindAdapterByIdReply(ObjectAdapter replyAdapter)
@@ -431,10 +432,13 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface FindObjectByIdReply.</summary>
- internal class FindObjectByIdReply : ReplyServant<IObjectPrx?>, IFindObjectByIdReply
+ internal class FindObjectByIdReply : ReplyServant<IObjectPrx?>, IAsyncFindObjectByIdReply
{
- public void FoundObjectById(Identity id, IObjectPrx proxy, Current current, CancellationToken cancel) =>
+ public ValueTask FoundObjectByIdAsync(Identity id, IObjectPrx proxy, Current current, CancellationToken cancel)
+ {
SetResult(proxy);
+ return default;
+ }
internal FindObjectByIdReply(ObjectAdapter replyAdapter)
: base(emptyResult: null, replyAdapter)
@@ -443,12 +447,12 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface ResolveAdapterIdReply.</summary>
- internal sealed class ResolveAdapterIdReply : ReplyServant<IReadOnlyList<EndpointData>>, IResolveAdapterIdReply
+ internal sealed class ResolveAdapterIdReply : ReplyServant<IReadOnlyList<EndpointData>>, IAsyncResolveAdapterIdReply
{
private readonly object _mutex = new();
private readonly HashSet<EndpointData> _endpointDataSet = new();
- public void FoundAdapterId(
+ public ValueTask FoundAdapterIdAsync(
EndpointData[] endpoints,
bool isReplicaGroup,
Current current,
@@ -471,6 +475,7 @@ namespace ZeroC.Ice.Discovery
{
SetResult(endpoints);
}
+ return default;
}
internal ResolveAdapterIdReply(ObjectAdapter replyAdapter)
@@ -489,10 +494,13 @@ namespace ZeroC.Ice.Discovery
}
/// <summary>Servant class that implements the Slice interface ResolveWellKnownProxyReply.</summary>
- internal class ResolveWellKnownProxyReply : ReplyServant<string>, IResolveWellKnownProxyReply
+ internal class ResolveWellKnownProxyReply : ReplyServant<string>, IAsyncResolveWellKnownProxyReply
{
- public void FoundWellKnownProxy(string adapterId, Current current, CancellationToken cancel) =>
+ public ValueTask FoundWellKnownProxyAsync(string adapterId, Current current, CancellationToken cancel)
+ {
SetResult(adapterId);
+ return default;
+ }
internal ResolveWellKnownProxyReply(ObjectAdapter replyAdapter)
: base(emptyResult: "", replyAdapter)
diff --git a/csharp/src/Ice/Discovery/LocatorRegistry.cs b/csharp/src/Ice/Discovery/LocatorRegistry.cs
index d2985909a72..c4055743591 100644
--- a/csharp/src/Ice/Discovery/LocatorRegistry.cs
+++ b/csharp/src/Ice/Discovery/LocatorRegistry.cs
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace ZeroC.Ice.Discovery
{
/// <summary>Servant class that implements the Slice interface Ice::LocatorRegistry.</summary>
- internal class LocatorRegistry : ILocatorRegistry
+ internal class LocatorRegistry : IAsyncLocatorRegistry
{
private readonly IObjectPrx _dummyIce1Proxy;
private readonly IObjectPrx _dummyIce2Proxy;
@@ -22,7 +22,7 @@ namespace ZeroC.Ice.Discovery
private readonly Dictionary<(string AdapterId, Protocol Protocol), HashSet<string>> _replicaGroups = new();
- public void RegisterAdapterEndpoints(
+ public ValueTask RegisterAdapterEndpointsAsync(
string adapterId,
string replicaGroupId,
EndpointData[] endpoints,
@@ -35,16 +35,17 @@ namespace ZeroC.Ice.Discovery
}
RegisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice2, endpoints, _ice2Adapters);
+ return default;
}
- public void SetAdapterDirectProxy(
+ public ValueTask SetAdapterDirectProxyAsync(
string adapterId,
IObjectPrx? proxy,
Current current,
CancellationToken cancel) =>
- SetReplicatedAdapterDirectProxy(adapterId, "", proxy, current, cancel);
+ SetReplicatedAdapterDirectProxyAsync(adapterId, "", proxy, current, cancel);
- public void SetReplicatedAdapterDirectProxy(
+ public ValueTask SetReplicatedAdapterDirectProxyAsync(
string adapterId,
string replicaGroupId,
IObjectPrx? proxy,
@@ -59,23 +60,24 @@ namespace ZeroC.Ice.Discovery
{
UnregisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice1, _ice1Adapters);
}
+ return default;
}
- public void SetServerProcessProxy(
+ public ValueTask SetServerProcessProxyAsync(
string serverId,
IProcessPrx process,
Current current,
- CancellationToken cancel)
- {
- // Ignored
- }
+ CancellationToken cancel) => default; // Ignored
- public void UnregisterAdapterEndpoints(
+ public ValueTask UnregisterAdapterEndpointsAsync(
string adapterId,
string replicaGroupId,
Current current,
- CancellationToken cancel) =>
+ CancellationToken cancel)
+ {
UnregisterAdapterEndpoints(adapterId, replicaGroupId, Protocol.Ice2, _ice2Adapters);
+ return default;
+ }
internal LocatorRegistry(Communicator communicator)
{