Interface FlowCommon
- All Superinterfaces:
CommonDecorator
- All Known Subinterfaces:
FlowAttachmentCommunication, FlowBindingLogicServerCommunication, FlowBroadcastCommunication, FlowCommunicationEventBus, FlowContext, FlowExternalCommunication, FlowExternalWriteCommunication, FlowLogicCallCollectCommunication, FlowLogicCallCommunication, FlowLogicSendCommunication, FLowUserIdSettingCommunication
- All Known Implementing Classes:
DefaultFlowContext
Base interface for flow communication, providing access to the server, request, executor,
and communication infrastructure.
- Since:
- 25.1
- Author:
- 渔民小镇
- date:
- 2025-10-09
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidExecute a task on the current thread executor.default voidexecuteUser(Runnable command) Execute a task on the user-bound thread executor.default voidexecuteVirtual(Runnable command) Execute a task on the virtual-thread executor.Get theBarSkeletonexecution engine for this flow.Get the command info (cmd + subCmd) for the current request.Get the communication type of the current flow (e.g., user request, internal call).default ExecutorGet the executor assigned to the current flow context.Get the current thread executor for this flow context.default ExecutorRegionGet the executor region from the bar skeleton.Get the current request being processed.default ServerGet the server descriptor from the bar skeleton.default intGet the server ID.default longGet the thread index used for executor selection.default StringGet the trace ID from the current request.longGet the user ID associated with this flow.default ThreadExecutorGet the user-bound thread executor, selected by the thread index.default ThreadExecutorGet the virtual-thread executor bound to the current user's thread index.voidsetMethodResult(Object data) Set the result data produced by the action method.voidsetUserId(long userId) Set the user ID associated with this flow.Methods inherited from interface CommonDecorator
getCommunicationAggregation
-
Method Details
-
getUserId
long getUserId()Get the user ID associated with this flow.- Returns:
- the user ID
-
setUserId
void setUserId(long userId) Set the user ID associated with this flow.- Parameters:
userId- the user ID
-
getRequest
-
getBarSkeleton
BarSkeleton getBarSkeleton()Get theBarSkeletonexecution engine for this flow.- Returns:
- the bar skeleton
-
getCmdInfo
CmdInfo getCmdInfo()Get the command info (cmd + subCmd) for the current request.- Returns:
- the command info
-
getServer
-
getServerId
default int getServerId()Get the server ID.- Returns:
- the server ID
-
getTraceId
Get the trace ID from the current request.- Specified by:
getTraceIdin interfaceCommonDecorator- Returns:
- the trace ID, or
nullif not set
-
getThreadIndex
default long getThreadIndex()Get the thread index used for executor selection. Defaults to the user ID, ensuring that requests from the same user are dispatched to the same thread.- Returns:
- the thread index
-
getCurrentExecutor
Get the executor assigned to the current flow context.- Specified by:
getCurrentExecutorin interfaceCommonDecorator- Returns:
- the
Executorbound to the current thread's flow context
-
getCurrentThreadExecutor
ThreadExecutor getCurrentThreadExecutor()Get the current thread executor for this flow context.- Returns:
- the current thread executor
-
getExecutorRegion
Get the executor region from the bar skeleton.- Returns:
- the executor region
-
getUserThreadExecutor
Get the user-bound thread executor, selected by the thread index.- Returns:
- the user thread executor
-
getVirtualThreadExecutor
Get the virtual-thread executor bound to the current user's thread index.- Returns:
- the virtual thread executor
-
execute
Execute a task on the current thread executor.- Parameters:
command- the task to execute
-
executeUser
Execute a task on the user-bound thread executor.- Parameters:
command- the task to execute
-
executeVirtual
Execute a task on the virtual-thread executor.- Parameters:
command- the task to execute
-
setMethodResult
Set the result data produced by the action method.- Parameters:
data- the method result
-
getCommunicationType
CommunicationType getCommunicationType()Get the communication type of the current flow (e.g., user request, internal call).- Returns:
- the communication type
-