Interface FlowCommon

All Superinterfaces:
CommonDecorator
All Known Subinterfaces:
FlowAttachmentCommunication, FlowBindingLogicServerCommunication, FlowBroadcastCommunication, FlowCommunicationEventBus, FlowContext, FlowExternalCommunication, FlowExternalWriteCommunication, FlowLogicCallCollectCommunication, FlowLogicCallCommunication, FlowLogicSendCommunication, FLowUserIdSettingCommunication
All Known Implementing Classes:
DefaultFlowContext

public interface FlowCommon extends CommonDecorator
Base interface for flow communication, providing access to the server, request, executor, and communication infrastructure.
Since:
25.1
Author:
渔民小镇
date:
2025-10-09
  • 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

      Request getRequest()
      Get the current request being processed.
      Returns:
      the request
    • getBarSkeleton

      BarSkeleton getBarSkeleton()
      Get the BarSkeleton execution 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

      default Server getServer()
      Get the server descriptor from the bar skeleton.
      Returns:
      the server
    • getServerId

      default int getServerId()
      Get the server ID.
      Returns:
      the server ID
    • getTraceId

      default String getTraceId()
      Get the trace ID from the current request.
      Specified by:
      getTraceId in interface CommonDecorator
      Returns:
      the trace ID, or null if 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

      default Executor getCurrentExecutor()
      Get the executor assigned to the current flow context.
      Specified by:
      getCurrentExecutor in interface CommonDecorator
      Returns:
      the Executor bound 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

      default ExecutorRegion getExecutorRegion()
      Get the executor region from the bar skeleton.
      Returns:
      the executor region
    • getUserThreadExecutor

      default ThreadExecutor getUserThreadExecutor()
      Get the user-bound thread executor, selected by the thread index.
      Returns:
      the user thread executor
    • getVirtualThreadExecutor

      default ThreadExecutor getVirtualThreadExecutor()
      Get the virtual-thread executor bound to the current user's thread index.
      Returns:
      the virtual thread executor
    • execute

      default void execute(Runnable command)
      Execute a task on the current thread executor.
      Parameters:
      command - the task to execute
    • executeUser

      default void executeUser(Runnable command)
      Execute a task on the user-bound thread executor.
      Parameters:
      command - the task to execute
    • executeVirtual

      default void executeVirtual(Runnable command)
      Execute a task on the virtual-thread executor.
      Parameters:
      command - the task to execute
    • setMethodResult

      void setMethodResult(Object data)
      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