类 AsyncContextImpl
- java.lang.Object
-
- org.apache.dubbo.rpc.AsyncContextImpl
-
- 所有已实现的接口:
AsyncContext
public class AsyncContextImpl extends Object implements AsyncContext
-
-
构造器概要
构造器 构造器 说明 AsyncContextImpl()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 CompletableFuture<Object>getInternalFuture()booleanisAsyncStarted()voidsignalContextSwitch()Signal RpcContext switch.voidstart()change the context state to startbooleanstop()change the context state to stopvoidwrite(Object value)write value and complete the async context.
-
-
-
方法详细资料
-
write
public void write(Object value)
从接口复制的说明:AsyncContextwrite 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()
从接口复制的说明:AsyncContextchange the context state to stop- 指定者:
stop在接口中AsyncContext
-
start
public void start()
从接口复制的说明:AsyncContextchange the context state to start- 指定者:
start在接口中AsyncContext
-
signalContextSwitch
public void signalContextSwitch()
从接口复制的说明:AsyncContextSignal 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
-
getInternalFuture
public CompletableFuture<Object> getInternalFuture()
-
-