private void FetchMetadataInternal(IList <string> names,
                                           Action <MapFetchNearCacheInvalidationMetadataCodec.ResponseParameters> process)
        {
            var dataMembers = _client.ClusterService.DataMemberList;

            foreach (var member in dataMembers)
            {
                var request = MapFetchNearCacheInvalidationMetadataCodec.EncodeRequest(names, member.Uuid);
                try
                {
                    var future = _client.InvocationService.InvokeOnTarget(request, member.Uuid);
                    var task   = future.ToTask();

                    task.ContinueWith(t =>
                    {
                        if (t.IsFaulted)
                        {
                            // ReSharper disable once PossibleNullReferenceException
                            throw t.Exception.Flatten().InnerExceptions.First();
                        }
                        var responseMessage   = ThreadUtil.GetResult(t, AsyncResultWaitTimeoutMillis);
                        var responseParameter =
                            MapFetchNearCacheInvalidationMetadataCodec.DecodeResponse(responseMessage);
                        process(responseParameter);
                    }).IgnoreExceptions();
                }
                catch (Exception e)
                {
                    Logger.Warning($"Cant fetch invalidation meta-data from address:{member.Address} [{e.Message}]");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Fetches metadata for specified caches.
        /// </summary>
        /// <param name="names">The names of the caches.</param>
        private async IAsyncEnumerable <(MemberInfo, MapFetchNearCacheInvalidationMetadataCodec.ResponseParameters)> FetchMetadataAsync(ICollection <string> names)
        {
            foreach (var member in _cluster.Members.LiteMembers)
            {
                var requestMessage  = MapFetchNearCacheInvalidationMetadataCodec.EncodeRequest(names, member.Id);
                var responseMessage = await _cluster.Messaging.SendToMemberAsync(requestMessage, member.Id).CfAwait();

                var response = MapFetchNearCacheInvalidationMetadataCodec.DecodeResponse(responseMessage);

                yield return(member, response);
            }
        }