Skip to content

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

@kwin

Description

@kwin

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.

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