Class NoOpExecutionContextAdapter<TValue>

IMPORT_PATH: "@daiso-tech/core/execution-context/no-op-execution-context-adapter"

No-operation execution context adapter.

This adapter implements IExecutionContextAdapter but provides no actual context storage. It always returns null for get() and simply executes functions without maintaining any context. Useful for scenarios where context management is not needed or for testing purposes.

Use this adapter when you want to disable context functionality or in environments where context propagation is not necessary.

Type Parameters

  • TValue

Implements

Constructors

Methods

Constructors

Methods

  • Executes the given function within the specified context.

    This method ensures the provided context is active during function execution, making it accessible to get() calls within the function and any nested function calls. When the function completes, the previous context (if any) is restored.

    Useful for:

    • Maintaining context across async boundaries
    • Isolating context between concurrent executions
    • Implementing per-request or per-task metadata propagation

    Note: This method is used for both asynchronous and synchronous execution.

    Type Parameters

    • TReturn

      The return type of the function

    Parameters

    Returns TReturn

    The return value of the executed function

    Error propagated from the executed function