Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 可靠参与者内的异步调用是否会破坏基于回合的并发性?_C#_Azure_Azure Service Fabric - Fatal编程技术网

C# 可靠参与者内的异步调用是否会破坏基于回合的并发性?

C# 可靠参与者内的异步调用是否会破坏基于回合的并发性?,c#,azure,azure-service-fabric,C#,Azure,Azure Service Fabric,我在服务结构可靠参与者中使用以下方法: async Task IRoomActor.ReportUpdateAsync(SensorCacheItem sensorItem, CancellationToken cancellationToken) { try { //get the state of this room RoomState roomState = await GetOrCreateState

我在服务结构可靠参与者中使用以下方法:

async Task IRoomActor.ReportUpdateAsync(SensorCacheItem sensorItem, CancellationToken cancellationToken)
    {
        try
        {
            //get the state of this room
            RoomState roomState = await GetOrCreateState(sensorItem.RoomId, cancellationToken);

            //update state based on the sensor cache item passed in
            var existingItem = roomState.Sensors.FirstOrDefault(s => s.SensorRowId == sensorItem.SensorRowId);
            if (existingItem != null)
            {
                roomState.Sensors.Remove(existingItem);
            }

            roomState.Sensors.Add(sensorItem);               

            //update status based on sensors
            ResolveStatusFromSensors(roomState, sensorItem);

            //save or update the state
            await StateManager.AddOrUpdateStateAsync(ServiceConstants.RoomActorStateName, roomState,
                (key, value) => roomState, cancellationToken);

            await SaveStateAsync();

            //send updates to Floor Actor          
            await PropagateStateToParent(roomState, cancellationToken);
        }
        catch (Exception e)
        {
            ActorEventSource.Current.ActorMessage(this, $"Exception thrown in RoomActor.ReportUpdateAsync(): {e.StackTrace}");
            throw;
        }
    }

此方法中等待的调用是否会破坏可靠参与者基于回合的并发性?

否,这不会影响基于回合的并发性,因为从ReportUpdateSync返回的整个任务(包括其内部等待)必须在允许下一个调用进入之前完成。

太好了!多谢