Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide OSGi condition which is fulfilled once all required org.ehcache.core.spi.service.ServiceFactory objects are provided #3232

Open
kwin opened this issue Jun 21, 2024 · 1 comment · May be fixed by #3233

Comments

@kwin
Copy link

kwin commented Jun 21, 2024

If one uses the API outlined in https://www.ehcache.org/documentation/3.9/getting-started.html via CacheManagerBuilder.newCacheManagerBuilder() .build() too early in OSGi runtimes (i.e. when the services of type org.ehcache.core.spi.service.ServiceFactory have not yet been registered) it fails with

ServiceLocator$DependencyException: Failed to find provider with satisfied dependency set for interface org.ehcache.core.events.CacheEventListenerProvider [candidates []]
  at org.ehcache.core.spi.ServiceLocator$DependencySet.build(ServiceLocator.java:350)
  at org.ehcache.core.EhcacheManager.resolveServices(EhcacheManager.java:154) 
  at org.ehcache.core.EhcacheManager.<init>(EhcacheManager.java:125)
  at org.ehcache.core.EhcacheManager.<init>(EhcacheManager.java:115) 
  at org.ehcache.core.EhcacheManager.<init>(EhcacheManager.java:111)
  at com.novonordisk.hcp.integrations.shade.ehcache.config.builders.CacheManagerBuilder.newCacheManager

The above happens with Ehcache 3.9.9 (for other versions the line numbers may differ)

In order to programmatically prevent this race condition, please provide a OSGi condition which is only satisfied once all necessary ServiceFactory service are registered.

@kwin
Copy link
Author

kwin commented Jun 21, 2024

This would also require an extension to the documentation at https://www.ehcache.org/documentation/3.9/osgi.html.

kwin added a commit to kwin/ehcache3 that referenced this issue Jun 21, 2024
are registered

This allows to defer starting of custom OSGi DS component which rely on
the EhcacheManager in their activate() method until the Ehcache services
are registered

This closes ehcache#3232
kwin added a commit to kwin/ehcache3 that referenced this issue Jun 23, 2024
are registered

This allows to defer starting of custom OSGi DS component which rely on
the EhcacheManager in their activate() method until the Ehcache services
are registered

This closes ehcache#3232
kwin added a commit to kwin/ehcache3 that referenced this issue Jun 23, 2024
are registered

This allows to defer starting of custom OSGi DS component which rely on
the EhcacheManager in their activate() method until the Ehcache services
are registered

This closes ehcache#3232
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 a pull request may close this issue.

1 participant