示例#1
0
 public ValueTask InvokeMethodAsync(GrainReference reference, IInvokable request, InvokeMethodOptions options)
 {
     // TODO: Remove expensive interface type check
     if (filters.Length == 0 && request is not IOutgoingGrainCallFilter)
     {
         SetGrainCancellationTokensTarget(reference, request);
         var responseCompletionSource = ResponseCompletionSourcePool.Get();
         this.RuntimeClient.SendRequest(reference, request, responseCompletionSource, options);
         return(responseCompletionSource.AsVoidValueTask());
     }
     else
     {
         return(InvokeMethodWithFiltersAsync(reference, request, options));
     }
 }
 public async ValueTask <TResult> InvokeMethodAsync <TResult>(GrainReference reference, IInvokable request, InvokeMethodOptions options)
 {
     // TODO: Remove expensive interface type check
     if (this.filters.Length == 0 && request is not IOutgoingGrainCallFilter)
     {
         SetGrainCancellationTokensTarget(reference, request);
         var copy = this.deepCopier.Copy(request);
         var responseCompletionSource = ResponseCompletionSourcePool.Get <TResult>();
         try
         {
             SendRequest(reference, responseCompletionSource, copy, options);
             return(await responseCompletionSource.AsValueTask());
         }
         finally
         {
             ResponseCompletionSourcePool.Return(responseCompletionSource);
         }
     }
     else
     {
         return(await InvokeMethodWithFiltersAsync <TResult>(reference, request, options));
     }
 }