Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

(RxJava2)Propagators are lazily initialised on first Context Propagation use #10

@kabir

Description

@kabir

The initialisation of the SmallRyeManager seems to happen on first call of injected ManagedExecutor and ThreadContext instances (and first use of their builders). This in turn adds the ContextManagerExtensions, of which the RxJava2Propagator is one.

So with the following endpoint:

@GET
public Publisher<String> testPublisher() throws SystemException {
       //1
        System.out.println(Flowable.fromArray("X").getClass());
       //2
        ThreadContext.builder().propagated(ThreadContext.ALL_REMAINING).build();
       //3
        System.out.println(Flowable.fromArray("X").getClass());

2 does the initialisation of the SmallRye context manager. The Flowable in 1 is a 'plain' one, and 3 is one which supports context propagation.

This might be an acceptable limitation since the Publisher stuff is a nice to have.

But perhaps the ContextPropagation deployers should do something to eagerly initialise this? Would there be some ramifications of doing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions