private void WriteBlockComplete(BlockId blockId, int fileType) { BlockData data = GetBlockData(blockId, fileType); // Make sure this process is exclusive lock (blockUploadLock) { if (!data.Exists) { throw new ApplicationException("Block data not found"); } data.Complete(); } UpdateBlockState(blockId); }