Class AbstractAsyncMethodHandler
java.lang.Object
dev.tachyonmcp.core.server.handlers.AbstractAsyncMethodHandler
- All Implemented Interfaces:
RpcMethodHandler
Convenient base for asynchronous RPC method handlers.
Subclasses implement
handleAsync(dev.tachyonmcp.core.server.session.DispatchContext, java.lang.Object); the blocking handle(dev.tachyonmcp.core.server.session.DispatchContext, java.lang.Object) delegates via
HandlerFutures.joinInterruptibly(java.util.concurrent.CompletionStage<T>).-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor for subclasses. -
Method Summary
Modifier and TypeMethodDescriptionfinal Objecthandle(DispatchContext context, Object params) Handles the method and returns the result to serialize as JSON-RPC response.abstract CompletionStage<Object> handleAsync(DispatchContext context, Object params) Handles the method asynchronously.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.tachyonmcp.core.server.RpcMethodHandler
method
-
Constructor Details
-
AbstractAsyncMethodHandler
protected AbstractAsyncMethodHandler()Default constructor for subclasses.
-
-
Method Details
-
handle
Description copied from interface:RpcMethodHandlerHandles the method and returns the result to serialize as JSON-RPC response.- Specified by:
handlein interfaceRpcMethodHandler- Parameters:
context- the dispatch context with server and outbound stream accessparams- the method parameters, ornull- Returns:
- the result to serialize
- Throws:
Exception- on handler failure
-
handleAsync
Description copied from interface:RpcMethodHandlerHandles the method asynchronously. Default delegates toRpcMethodHandler.handle(dev.tachyonmcp.core.server.session.DispatchContext, java.lang.Object). Override for async handlers that return a future directly.- Specified by:
handleAsyncin interfaceRpcMethodHandler- Parameters:
context- the dispatch contextparams- the method parameters, ornull- Returns:
- a completion stage yielding the result
-