关闭 x
IT技术网
    技 采 号
    ITJS.cn - 技术改变世界
    • 实用工具
    • 菜鸟教程
    IT采购网 中国存储网 科技号 CIO智库

    IT技术网

    IT采购网
    • 首页
    • 行业资讯
    • 系统运维
      • 操作系统
        • Windows
        • Linux
        • Mac OS
      • 数据库
        • MySQL
        • Oracle
        • SQL Server
      • 网站建设
    • 人工智能
    • 半导体芯片
    • 笔记本电脑
    • 智能手机
    • 智能汽车
    • 编程语言
    IT技术网 - ITJS.CN
    首页 » .NET »ASP.NET MVC同步和异步的使用总结

    ASP.NET MVC同步和异步的使用总结

    2014-12-11 00:00:00 出处:CSDN
    分享

    Action方法的执行具有两种基本的形式,即同步执行和异步执行,而在ASP.NETMVC的整个体系中涉及到很多同步/异步的执行方式,虽然在前面相应的文章中已经对此作了相应的介绍,为了让读者对此有一个整体的了解,我们来做一个总结性的论述。

    一、MvcHandler的同步与异步

    对于ASP.NET MVC应用来说,MvcHandler是最终用于处理请求的HttpHandler,它是通过UrlRoutingModule这个实现了URL路由的HttpModule被动态映射到相应的请求的。MvcHandler借助于ControllerFactory激活并执行目标Controller,并在执行结束后负责对激活的Controller进行释放,相关的内容请参与本书的第3章“Controller的激活”。如下面的代码片断所示,MvcHandler同时实现了IHttpHandler和IHttpAsyncHandler接口,所以它总是调用BeginProcessRequest/EndProcessRequest方法以异步的方式来处理请求。

    public class MvcHandler : IHttpAsyncHandler, IHttpHandler, ...
    {
      //其他成员
      IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData);
      void IHttpAsyncHandler.EndProcessRequest(IAsyncResult result);
      void IHttpHandler.ProcessRequest(HttpContext httpContext);
    }

    二、Controller的同步与异步

    Controller也具有同步与异步两个版本,它们分别实现了具有如下定义的两个接口IController和IAsyncController。当激活的Controller对象在MvcHandler的BeginProcessRequest方法中是按照这样的方式执行的:假如Controller的类型实现了IAsyncController接口,则调用BeginExecute/EndExecute方法以异步的方式执行Controller;否则Controller的执行通过调用Execute方法以同步方式执行。

    public interface IController
    {
      void Execute(RequestContext requestContext);
    }
    public interface IAsyncController : IController
    {
      IAsyncResult BeginExecute(RequestContext requestContext, AsyncCallback callback, object state);
      void EndExecute(IAsyncResult asyncResult);
    }

    默认情况下通过visual Studio的向导创建的Controller类型是抽象类型Controller的子类。如下面的代码片断所示,Controller同时实现了IController和IAsyncController这两个接口,所以当MvcHandler进行请求处理时总是以异步的方式来执行Controller。

    public abstract class Controller : ControllerBase, IController, IAsyncController, ...
    {
      //其他成员
      protected virtual bool DisableAsyncSupport
      {
        get{return false;}
      }
    }

    但是Controller类型具有一个受保护的只读属性DisableAsyncSupport用于表示是否禁用对异步执行的支持。在默认情况下,该属性值为False,所以默认情况下是支持Controller的异步执行的。假如我们通过重写该属性将值设置为True,那么Controller将只能以同步的方式执行。具体的实现逻辑体现在如下的代码片断中:BeginExecute方法在DisableAsyncSupport属性为True的情况下通过调用Execute方法(该方法会调用一个受保护的虚方法ExecuteCore最终对Controller进行同步执行);否则通过调用BeginExecuteCore/EndExecuteCore以异步方式执行Controller。

    public abstract class Controller: ...
     {
       //其他成员
       protected virtual IAsyncResult BeginExecute(RequestContext requestContext,
       AsyncCallback callback, object state)
       {
         if (this.DisableAsyncSupport)
         {
           //通过调用Execute方法同步执行Controller
        }
        else
        {
          //通过调用BeginExecuteCore/EndExecuteCore方法异步执行Controller
        }
    }
      protected override void ExecuteCore();
      protected virtual IAsyncResult BeginExecuteCore(AsyncCallback callback, object state);
      protected virtual void EndExecuteCore(IAsyncResult asyncResult);
    }

    三、 ActionInvoker的同步与异步

    包括Model绑定与验证的整个Action的执行通过一个名为ActionInvoker的组件来完成,而它同样具有同步和异步两个版本,分别实现了接口IActionInvoker和IAsyncActionInvoker。如下面的代码片断所示,这两个接口分别通过InvokeAction和BeginInvokeAction/EndInvokeAction方法以同步和异步的方式执行Action。抽象类Controller中具有一个ActionInvoker属性用于设置和返回用于执行自身Action的ActionInvoker对象,而该对象最终是通过受保护需方法CreateActionInvoker创建的。

    public interface IActionInvoker
     {
       bool InvokeAction(ControllerContext controllerContext, string actionName);
     }
    
     public interface IAsyncActionInvoker : IActionInvoker
     {
       IAsyncResult BeginInvokeAction(ControllerContext controllerContext, string actionName, AsyncCallback callback, object state);
       bool EndInvokeAction(IAsyncResult asyncResult);
    }
    
    public abstract class Controller
    {
      //其它成员
      public IActionInvoker ActionInvoker { get; set; }
      protected virtual IActionInvoker CreateActionInvoker()
    }

    ASP.NET MVC真正用于Action方法同步和异步执行的ActionInvoker分别是ControllerActionInvoker和AsyncControllerActionInvoker。如下面的代码片断所示,ControllerActionInvoker定义了一个受保护的方法GetControllerDescriptor用于根据指定的Controller上下文获取相应的ControllerDescriptor,它的子类AsyncControllerActionInvoker对这个方法进行了重写。

    public class ControllerActionInvoker : IActionInvoker
    {
      //其它成员
      protected virtual ControllerDescriptor GetControllerDescriptor(ControllerContext controllerContext);
    }
    
    public class AsyncControllerActionInvoker : ControllerActionInvoker,IAsyncActionInvoker, IActionInvoker
    {
      //其它成员
      protected override ControllerDescriptor GetControllerDescriptor(ControllerContext controllerContext);

    我们所有要了解的是在默认情况下(没有对Controller类型的ActionInvoker属性进行显式设置)采用的ActionInvoker类型是哪个。ASP.NET MVC对Conroller采用的ActionInvoker类型的选择机制是这样的:

    通过当前的DependencyResolver以IAsyncActionInvoker接口去获取注册的ActionInvoker,假如返回对象不为Null,则将其作为默认的ActionInvoker。

    通过当前的DependencyResolver以IActionInvoker接口去获取注册的ActionInvoker,假如返回对象不为Null,则将其作为默认的ActionInvoker。

    创建AsyncControllerActionInvoker对象作为默认的ActionInvoker。

    在默认的情况下,当前的DependencyResolver直接通过对指定的类型进行反射来提供对应的实例对象,所以对于前面两个步骤返回的对象均为Null,所以默认创建出来的ActionInvoker类型为AsyncControllerActionInvoker。我们可以通过如下一个简单的实例来验证这一点。在通过Visual Studio的ASP.NET MVC项目模板创建的空Web应用中,我们创建了如下一个默认的HomeController,在Action方法Index中直接通过ContentResult将ActionInvoker属性的类型名称呈现出来。

    public class HomeController : Controller
     {
       public ActionResult Index()
       {
         return Content("默认ActionInvoker类型:" + this.ActionInvoker.GetType().FullName);
       }
    }

    当运行该Web应用时,会在浏览器上产生如下的输出结果,我们可以清楚地看到默认采用的ActionInvoker类型正是AsyncControllerActionInvoker。

    默认ActionInvoker类型:System.Web.Mvc.Async.AsyncControllerActionInvoker

    为了进一步验证基于DependencyResolver对ActionInvoker的提供机制,我们将《ASP.NET MVC Controller激活系统详解:IoC的应用》创建的基于Ninject的自定义NinjectDependencyResolver应用在这里。如下面的代码片断所示,在初始化NinjectDependencyResolver的时候,我们将IActionInvoker和IAsyncActionInvoker影射到两个自定义ActionInvoker类型,即FooActionInvoker和FooAsyncActionInvoker,它们分别继承自ControllerActionInvoker和AsyncControllerActionInvoker。

    public class NinjectDependencyResolver : IDependencyResolver
     {
       public IKernel Kernel { get; private set; }
       public NinjectDependencyResolver()
       {
         this.Kernel = new StandardKernel();
         AddBindings();
       }
       private void AddBindings()
      {
        this.Kernel.Bind<IActionInvoker>().To<FooActionInvoker>();
        this.Kernel.Bind<IAsyncActionInvoker>().To<FooAsyncActionInvoker>();
      }
      public object GetService(Type serviceType)
      {
        return this.Kernel.TryGet(serviceType);
      }
      public IEnumerable<object> GetServices(Type serviceType)
      {
        return this.Kernel.GetAll(serviceType);
      }
    }
    public class FooActionInvoker : ControllerActionInvoker
    {}
    public class FooAsyncActionInvoker : AsyncControllerActionInvoker
    {}

    在Global.asax中对NinjectDependencyResolver进行注册后运行我们的程序,会在浏览器中得到如下的输出结果。IAsyncActionInvoker和FooAsyncActionInvoker进行了影射,NinjectDependencyResolver可以通过IAsyncActionInvoker提供一个FooAsyncActionInvoker实例。

    默认ActionInvoker类型:Artech.Mvc.FooAsyncActionInvoker

    现在我们对NinjectDependencyResolver的定义稍加修改,将针对IAsyncActionInvoker接口的类型影射删除,只保留针对IActionInvoker的映射。

    public class NinjectDependencyResolver : IDependencyResolver
    {
      //其它成员
      private void AddBindings()
      {
        this.Kernel.Bind<IActionInvoker>().To<FooActionInvoker>();
        //this.Kernel.Bind<IAsyncActionInvoker>().To<FooAsyncActionInvoker>();
      }
    }

    再次运行我们的程序则会得到如下的输出结果。由于NinjectDependencyResolver只能通过IActionInvoker接口提供具体的ActionInvoker,所以最终被创建的是一个FooActionInvoker对象。这个实例演示告诉我们:当我们需要使用到自定义的ActionInvoker的时候,可以通过自定义DependencyResolver以IoC的方式提供具体的ActionInvoker实例。

    默认ActionInvoker类型:Artech.Mvc.FooActionInvoker

    四、ControllerDescriptor的同步与异步

    假如采用ControllerActionInvoker,Action总是以同步的方式来直接,但是当AsyncControllerActionInvoker作为Controller的ActionInvoker时,并不意味着总是以异步的方式来执行所有的Action。至于这两种类型的ActionInvoker具体采用对Action的怎样的执行方式,又涉及到两个描述对象,即用于描述Controller和Action的ControllerDescriptor和ActionDescriptor。

    通过前面“Model的绑定”中对这两个对象进行过相应的介绍,我们知道在ASP.NET MVC应用编程接口中具有两个具体的ControllerDescriptor,即ReflectedControllerDescriptor和ReflectedAsyncControllerDescriptor,它们分别代表同步和异步版本的ControllerDescriptor。

    public class ReflectedControllerDescriptor : ControllerDescriptor
    {
      //省略成员
    }
    
    public class ReflectedAsyncControllerDescriptor : ControllerDescriptor
    {
      //省略成员
    }

    ReflectedControllerDescriptor和ReflectedAsyncControllerDescriptor并非对分别实现了IController和IAyncController接口的Controller的描述,而是对直接继承自抽象类Controller和AsyncController的Controller的描述。它们之间的区别在于创建者的不同,在默认情况下ReflectedControllerDescriptor和ReflectedAsyncControllerDescriptor分别是通过ControllerActionInvoker和AsyncControllerActionInvoker来创建的。ActionInvoker和ControllerDescriptor之间的关系可以通过如下图所示的UML来表示。

    image

    ActionInvoker与ControllerDescriptor之间的关系可以通过一个简单的实例来验证。在通过Visual Studio的ASP.NET MVC项目模板创建的空Web应用中,我们自定义了如下两个分别继承自ControllerActionInvoker和AsyncControllerActionInvoker的ActionInvoker类型。在这两个自定义ActionInvoker中,定义了公有的GetControllerDescriptor方法覆盖了基类的同名方法(受保护的虚方法),并直接直接调用基类的同名方法根据提供的Controller上下文的到相应的ControllerDescriptor对象。

    public class FooActionInvoker : ControllerActionInvoker
     {
       public new ControllerDescriptor GetControllerDescriptor(ControllerContext controllerContext)
       {
         return base.GetControllerDescriptor(controllerContext);
       }
     }
    
     public class BarActionInvoker : AsyncControllerActionInvoker
    {
      public new ControllerDescriptor GetControllerDescriptor(ControllerContext controllerContext)
      {
        return base.GetControllerDescriptor(controllerContext);
      }
    }

    然后我们定义了两个Controller类型,它们均是抽象类型Controller的直接继承者。如下面的代码片断所示,这两Controller类(FooController和BarController)都重写了虚方法CreateActionInvoker,而返回的ActionInvoker类型分别是上面我们定义的FooActionInvoker和BarActionInvoker。在默认的Action方法Index中,我们利用当前的ActionInvoker得到用于描述本Controller的ControllerDescriptor对象,并将其类型呈现出来。

    public class FooController : Controller
     {
       protected override IActionInvoker CreateActionInvoker()
       {
         return new FooActionInvoker();
       }
    
       public void Index()
       {
        ControllerDescriptor controllerDescriptor = ((FooActionInvoker)this.ActionInvoker).GetControllerDescriptor(ControllerContext);
        Response.Write(controllerDescriptor.GetType().FullName);
      }
    }
    
    public class BarController : Controller
    {
      protected override IActionInvoker CreateActionInvoker()
      {
        return new BarActionInvoker();
      }
    
      public void Index()
      {
        ControllerDescriptor controllerDescriptor = ((BarActionInvoker)this.ActionInvoker).GetControllerDescriptor(ControllerContext);
        Response.Write(controllerDescriptor.GetType().FullName);
      }
    }

    现在我们运行我们的程序,并在浏览器中输入相应的地址对定义在FooController和BarController的默认Action方法Index发起访问,相应的ControllerDescriptor类型名称会以下图所示的形式呈现出来,它们的类型分别是ReflectedControllerDescriptor和ReflectedAsyncControllerDescriptor。

    image

    五、ActionDescriptor的执行

    Controller包含一组用于描述Action方法的ActionDescriptor对象。由于Action方法可以采用同步和异步执行方法,异步Action对应的ActionDescriptor直接或者间接继承自抽象类AsyncActionDescriptor,后者是抽象类ActionDescriptor的子类。如下面的代码片断所示,同步和异步Action的执行分别通过调用Execute和BeginExecute/EndExecute方法来完成。值得一提的是,AsyncActionDescriptor重写了Execute方法并直接在此方法中抛出一个InvalidOperationException异常,也就是说AsyncActionDescriptor对象只能采用 异步执行方式。

    public abstract class ActionDescriptor : ICustomAttributeProvider
     {
       //其他成员
       public abstract object Execute(ControllerContext controllerContext, IDictionary<string, object> parameters);
     }
    
     public abstract class AsyncActionDescriptor : ActionDescriptor
     {
       //其他成员
      public abstract IAsyncResult BeginExecute(ControllerContext controllerContext, IDictionary<string, object> parameters, AsyncCallback callback, object state);
      public abstract object EndExecute(IAsyncResult asyncResult);
    }

    通过前面“Model的绑定”我们知道,在ASP.NET MVC应用编程接口中采用ReflectedControllerDescriptor来描述同步Action。异步Action方法具有两种不同的定义方式:其一,通过两个匹配的方法XxxAsync/XxxCompleted定义;其二,通过返回类型为Task的方法来定义。这两种异步Action方法对应的AsyncActionDescriptor类型分别是ReflectedAsyncActionDescriptor和TaskAsyncActionDescriptor。

    对于ReflectedControllerDescriptor来说,包含其中的ActionDescriptor类型均为ReflectedActionDescriptor。而ReflectedAsyncControllerDescriptor描述的Controller可以同时包含同步和异步的Action方法,ActionDescriptor的类型取决于Action方法定义的方式。ControllerDescriptor与ActionDescriptor之间的关系如下图所示的UML来表示。

    image

    实例演示:AsyncActionInvoker对ControllerDescriptor的创建

    为了让读者对ActionInvoker对ControllerDescriptor的解析机制具有一个深刻的理解,同时也作为对该机制的验证,我们做一个简单的实例演示。通过前面的介绍我们知道在默认的情况下Controller采用AsyncControllerActionInvoker进行Action方法的执行,这个例子就来演示一下它生成的ControllerDescriptor是个怎样的对象。我们通过Visual Studio的ASP.NET MVC项目模板创建一个空Web应用,并创建一个默认的HomeController,然后对其进行如下的修改。

    public class HomeController : AsyncController
    {
      public void Index()
      {
        MethodInfo method = typeof(AsyncControllerActionInvoker).GetMethod("GetControllerDescriptor", BindingFlags.Instance | BindingFlags.NonPublic);
        ControllerDescriptor controllerDescriptor = (ControllerDescriptor)method.Invoke(this.ActionInvoker, new object[] { this.ControllerContext });
        Response.Write(controllerDescriptor.GetType().FullName + "<br/>");
        CheckAction(controllerDescriptor, "Foo");
        CheckAction(controllerDescriptor, "Bar");
         CheckAction(controllerDescriptor, "Baz");
    
       }
      private void CheckAction(ControllerDescriptor controllerDescriptor,string actionName)
       {
         ActionDescriptor actionDescriptor = controllerDescriptor.FindAction(this.ControllerContext, actionName);
         Response.Write(string.Format("{0}: {1}<br/>",actionName,actionDescriptor.GetType().FullName));
       }
    
       public void Foo() { }
       public void BarAsync() { }
       public void BarCompleted() { }
       public Task<ActionResult> Baz()
       {
         throw new NotImplementedException();
       }

    我们首先将HomeController的基类从Controller改为AsyncController,并定义了Foo、BarAsync/BarCompleted和Baz四个方法,我们知道它们对应着Foo、Bar和Baz三个Action,其中Foo是同步Action,Bar和Baz分别是两种不同定义形式(XxxAsync/XxxCompleted和Task)的异步Action。

    CheckAction用于根据指定的Action名称从ControllerDescriptor对象中获取用于表示对应Action的ActionDescriptor对象,最终将类型名称呈现出来。在Index方法中,我们通过反射的方式调用当前ActionInvoker(一个AsyncControllerActionInvoker对象)的受保护方法GetControllerDescriptor或者用于描述当前Controller(HomeController)的ControllerDescriptor的对象,并将类型名称呈现出来。最后通过调用CheckAction方法将包含在创建的ControllerDescriptor对象的三个ActionDescriptor类型呈现出来。

    当我们运行该程序的时候,在浏览器中会产生如下的输出结果,从中可以看出ControllerDescriptor类型为ReflectedAsyncControllerDescriptor。同步方法Foo对象的ActionDescriptor是一个ReflectedActionDescriptor对象;以XxxAsync/XxxCompleted形式定义的异步方法Bar对应的ActionDescriptor是一个ReflectedAsyncActionDescriptor对象;而返回类型为Task的方法Baz对应的ActionDescriptor类型则是TaskAsyncActionDescriptor。

    image

    AsyncController、AsyncControllerActionInvoker与AsyncActionDescriptor

    不论我们采用哪种形式的定义方式,异步Action方法都只能定义在继承自AsyncController的Controller类型中,否则将被认为是同步方法。此外,由于通过ControllerActionInvoker只能创建包含ReflectedActionDescriptor的ReflectedControllerDescriptor,假如我们在AsyncController中采用ControllerActionInvoker对象作为ActionInvoker,所有的Action方法也将被认为是同步的。

    我们同样可以采用一个简单的实例演示来证实这一点。在通过Visual Studio的ASP.NET MVC项目模板创建的空Web应用中我们定义如下三个Controller(FooController、BarController和BazController)。我们重写了它们的CreateActionInvoker方法,返回的ActionInvoker类型(FooActionInvoker和BarActionInvoker)定义在上面,在这里我们将FooActionInvoker和BarActionInvoker看成是ControllerActionInvoker和AsyncControllerActionInvoker(默认使用的ActionInvoker)。

    public class FooController : AsyncController
     {
       protected override IActionInvoker CreateActionInvoker()
       {
         return new BarActionInvoker();
       }
       public void Index()
       {
         BarActionInvoker actionInvoker = (BarActionInvoker)this.ActionInvoker;
        Utility.DisplayActions(controllerContext=>actionInvoker.GetControllerDescriptor(ControllerContext),ControllerContext);
      }
    
      public void DoSomethingAsync()
      { }
      public void DoSomethingCompleted()
      { }
    }
    
    public class BarController : Controller
    {
      protected override IActionInvoker CreateActionInvoker()
      {
        return new BarActionInvoker();
      }
      public void Index()
      {
        BarActionInvoker actionInvoker = (BarActionInvoker)this.ActionInvoker;
        Utility.DisplayActions(controllerContext => actionInvoker.GetControllerDescriptor(ControllerContext), ControllerContext);
      }
      public void DoSomethingAsync()
      { }
      public void DoSomethingCompleted()
      { }
    }
    
    public class BazController : Controller
    {
      protected override IActionInvoker CreateActionInvoker()
      {
        return new FooActionInvoker();
      }
      public void Index()
      {
        FooActionInvoker actionInvoker = (FooActionInvoker)this.ActionInvoker;
        Utility.DisplayActions(controllerContext => actionInvoker.GetControllerDescriptor(ControllerContext), ControllerContext);
      }
      public void DoSomethingAsync()
      { }
      public void DoSomethingCompleted()
      { }
    }
    
    public static class Utility
    {
      public static void DisplayActions(Func<ControllerContext, ControllerDescriptor> controllerDescriptorAccessor, ControllerContext controllerContext)
      {
        ControllerDescriptor controllerDescriptor = controllerDescriptorAccessor(controllerContext);
        string[] actionNames = { "DoSomething", "DoSomethingAsync", "DoSomethingCompleted" };
        Array.ForEach(actionNames, actionName =>
          {
            ActionDescriptor actionDescriptor = controllerDescriptor.FindAction(controllerContext,actionName);
            if (null != actionDescriptor)
            {
              HttpContext.Current.Response.Write(string.Format("{0}: {1}<br/>", actionDescriptor.ActionName, actionDescriptor.GetType().Name));
            }
          });
      }
    }

    我们在三个Controller中以异步Action的形式定义了两个方法DoSomethingAsync和DoSomethingCompleted。FooController继承自AsyncController,使用AsyncControllerActionInvoker作为其ActionInvoker,这是正常的定义;BarController虽然采用AsyncControllerActionInvoker,但是将抽象类Controller作为其基类;而BazController虽然继承自ActionInvoker,但ActionInvoker类型为ControllerActionInvoker。在默认的Action方法Index中,我们将通过DoSomethingAsync和DoSomethingCompleted方法定义的Action的名称和对应的ActionDescriptor类型输出来。

    假如我们运行该程序,并在浏览器中输入相应的地址对定义在三个Controller的默认Action方法Index发起访问,会呈现出如下图所示的结果。我们可以清楚地看到,对于以XxxAsync/XxxCompleted形式定义的“异步”Action方法定义,只有针对AsyncController并且采用AsyncControllerActionInvoker的情况下才会被解析为一个异步Action。假如不满足这两个条件,它们会被视为两个普通的同步Action。

    image

    Action方法的执行

    目标Action方法的最终执行由被激活的Controller的ActionInvoker决定,ActionInvoker最终通过调用对应的ActionDescriptor来执行被它描述的Action方法。假如采用ControllerActionInvoker,被它创建的ControllerDescriptor(ReflectedControllerDescriptor)只包含同步的ActionDescriptor(ReflectedActionDescriptor),所以Action方法总是以同步的方式被执行。

    假如目标Controller是抽象类Controller的直接继承者,这也是通过Visual Studio的Controller创建向导的默认定义方式,ActionInvoker(ControllerActionInvoker/AsyncControllerActionInvoker)的选择只决定了创建的ControllerDescriptor的类型(ReflectedControllerDescriptor/ReflectedAsyncControllerDescriptor),ControllerDescriptor包含的所有ActionDescriptor依然是同步的(ReflectedActionDescriptor),所以Action方法也总是以同步的方式被执行。

    以异步方式定义的Action方法(XxxAsync/XxxCompleted或采用Task返回类型)只有定义在继承自AsyncController的Controller类型中,并且采用AsyncControllerActionInvoker作为其ActionInvoker,最终才会创建AsyncActionDescriptor来描述该Action。也只有同时满足这两个条件,Action方法才能以异步的方式执行。

    上一篇返回首页 下一篇

    声明: 此文观点不代表本站立场;转载务必保留本文链接;版权疑问请联系我们。

    别人在看

    抖音安全与信任开放日:揭秘推荐算法,告别单一标签依赖

    ultraedit编辑器打开文件时,总是提示是否转换为DOS格式,如何关闭?

    Cornell大神Kleinberg的经典教材《算法设计》是最好入门的算法教材

    从 Microsoft 下载中心安装 Windows 7 SP1 和 Windows Server 2008 R2 SP1 之前要执行的步骤

    Llama 2基于UCloud UK8S的创新应用

    火山引擎DataTester:如何使用A/B测试优化全域营销效果

    腾讯云、移动云继阿里云降价后宣布大幅度降价

    字节跳动数据平台论文被ICDE2023国际顶会收录,将通过火山引擎开放相关成果

    这个话题被围观超10000次,火山引擎VeDI如此解答

    误删库怎么办?火山引擎DataLeap“3招”守护数据安全

    IT头条

    平替CUDA!摩尔线程发布MUSA 4性能分析工具

    00:43

    三起案件揭开侵犯个人信息犯罪的黑灰产业链

    13:59

    百度三年开放2.1万实习岗,全力培育AI领域未来领袖

    00:36

    工信部:一季度,电信业务总量同比增长7.7%,业务收入累计完成4469亿元

    23:42

    Gartner:2024年全球半导体营收6559亿美元,AI助力英伟达首登榜首

    18:04

    技术热点

    iOS 8 中如何集成 Touch ID 功能

    windows7系统中鼠标滑轮键(中键)的快捷应用

    MySQL数据库的23个特别注意的安全事项

    Kruskal 最小生成树算法

    Ubuntu 14.10上安装新的字体图文教程

    Ubuntu14更新后无法进入系统卡在光标界面解怎么办?

      友情链接:
    • IT采购网
    • 科技号
    • 中国存储网
    • 存储网
    • 半导体联盟
    • 医疗软件网
    • 软件中国
    • ITbrand
    • 采购中国
    • CIO智库
    • 考研题库
    • 法务网
    • AI工具网
    • 电子芯片网
    • 安全库
    • 隐私保护
    • 版权申明
    • 联系我们
    IT技术网 版权所有 © 2020-2025,京ICP备14047533号-20,Power by OK设计网

    在上方输入关键词后,回车键 开始搜索。Esc键 取消该搜索窗口。