Skip to content

FELIX-6894: Make Component.getServiceProperties() thread-safe - #614

Open
pderop wants to merge 1 commit into
apache:masterfrom
pderop:FELIX-6894
Open

pderop wants to merge 1 commit into
apache:masterfrom
pderop:FELIX-6894

Conversation

@pderop

@pderop pderop commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Motivation:

Component.getServiceProperties() can be called from any thread (e.g. the dm shell command). It reads the dependency events map, which is a plain HashMap modified by the component executor. If a propagated dependency is removed from the component meanwhile, getDependencyEvent() throws a NullPointerException.

Modification:

Use a ConcurrentHashMap for the dependency events, and make getDependencyEvent()/getDependencyEvents() return null/an empty set for a dependency which is no longer part of the component.

Result:

The service properties of a component can be safely computed from any thread, even while its dependencies are being removed.

Motivation:

Component.getServiceProperties() can be called from any thread (e.g. the
dm shell command). It reads the dependency events map, which is a plain
HashMap modified by the component executor. If a propagated dependency
is removed from the component meanwhile, getDependencyEvent() throws a
NullPointerException.

Modification:

Use a ConcurrentHashMap for the dependency events, and make
getDependencyEvent()/getDependencyEvents() return null/an empty set for
a dependency which is no longer part of the component.

Result:

The service properties of a component can be safely computed from any
thread, even while its dependencies are being removed.
@pderop pderop self-assigned this Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant