Class EventSubscriptionsImpl

java.lang.Object
com.xebialabs.xlrelease.osgi.impl.EventSubscriptionsImpl
All Implemented Interfaces:
com.xebialabs.xlrelease.osgi.api.EventSubscriptions

public class EventSubscriptionsImpl extends Object implements com.xebialabs.xlrelease.osgi.api.EventSubscriptions
A single instance is shared between the root host ApplicationContext (declared in OsgiSpringConfiguration) and every plugin's curated parent context (PluginApiParentContext registers the exact same object as a singleton there), mirroring PluginExtensionRegistryImpl's sharing pattern.

Subscriptions are tracked by the ClassLoader active on the calling thread at subscribe(...) time, not by an explicit plugin identifier - subscribe has no such parameter. This relies on PluginContextFactory/PluginExecutionContext pinning the TCCL to the owning bundle's classloader for every plugin code execution path (context refresh, and eventually request handling and extension invocation), so Thread.currentThread().getContextClassLoader() reliably identifies "which plugin is calling right now" wherever a plugin bean's own code runs.

  • Constructor Details

    • EventSubscriptionsImpl

      public EventSubscriptionsImpl(com.xebialabs.xlrelease.events.XLReleaseEventBus eventBus)
  • Method Details

    • subscribe

      public AutoCloseable subscribe(Class<?> eventType, Consumer<Object> handler)
      Specified by:
      subscribe in interface com.xebialabs.xlrelease.osgi.api.EventSubscriptions