类 AsyncContextImpl

    • 构造器详细资料

      • AsyncContextImpl

        public AsyncContextImpl()
    • 方法详细资料

      • write

        public void write​(Object value)
        从接口复制的说明: AsyncContext
        write value and complete the async context.
        指定者:
        write 在接口中 AsyncContext
        参数:
        value - invoke result
      • isAsyncStarted

        public boolean isAsyncStarted()
        指定者:
        isAsyncStarted 在接口中 AsyncContext
        返回:
        true if the async context is started
      • stop

        public boolean stop()
        从接口复制的说明: AsyncContext
        change the context state to stop
        指定者:
        stop 在接口中 AsyncContext
      • start

        public void start()
        从接口复制的说明: AsyncContext
        change the context state to start
        指定者:
        start 在接口中 AsyncContext
      • signalContextSwitch

        public void signalContextSwitch()
        从接口复制的说明: AsyncContext
        Signal RpcContext switch. Use this method to switch RpcContext from a Dubbo thread to a new thread created by the user. Note that you should use it in a new thread like this: public class AsyncServiceImpl implements AsyncService { public String sayHello(String name) { final AsyncContext asyncContext = RpcContext.startAsync(); new Thread(() -> { // right place to use this method asyncContext.signalContextSwitch(); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } asyncContext.write("Hello " + name + ", response from provider."); }).start(); return null; } }
        指定者:
        signalContextSwitch 在接口中 AsyncContext