public class ActiveObjectsServiceFactory extends Object implements org.osgi.framework.ServiceFactory, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
This is the service factory that will create the ActiveObjects
instance for each plugin using active objects.
The instance created by that factory is a delegating instance that works together with the
ActiveObjectsServiceFactory to get a correctly configure instance according
to the plugin configuration and
the application configuration.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ActiveObjectsServiceFactory.BundleRef
Provides a wrapper that gives explicit object identity hashing and reference equality (via identity hasing)of a
Bundle, for use in maps etc. |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
INIT_TASK_TIMEOUT_MS |
| Constructor and Description |
|---|
ActiveObjectsServiceFactory(ActiveObjectsFactory factory,
com.atlassian.event.api.EventPublisher eventPublisher,
com.atlassian.tenancy.api.TenantContext tenantContext,
com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory threadLocalDelegateExecutorFactory,
InitExecutorServiceProvider initExecutorServiceProvider) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
Object |
getService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration serviceRegistration)
Invoked when the Gemini Blueprints/Spring DM proxy first accesses the module.
|
void |
onHotRestart(HotRestartEvent hotRestartEvent)
Listens for
HotRestartEvent and recreate all ActiveObjects instances within the delegates with
the possibly different configuration and data source |
void |
onPluginDisabledEvent(com.atlassian.plugin.event.events.PluginDisabledEvent pluginDisabledEvent)
Listens for
PluginDisabledEvent. |
void |
onPluginEnabledEvent(com.atlassian.plugin.event.events.PluginEnabledEvent pluginEnabledEvent)
Listens for
PluginEnabledEvent. |
void |
onPluginModuleEnabledEvent(com.atlassian.plugin.event.events.PluginModuleEnabledEvent pluginModuleEnabledEvent)
Listens for
PluginModuleEnabledEvent for ActiveObjectModuleDescriptor. |
void |
onTenantArrived(com.atlassian.tenancy.api.event.TenantArrivedEvent event)
Listens for
TenantArrivedEvent and allows initialisation of any uninitialised instances |
void |
startCleaning() |
void |
stopCleaning() |
void |
ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration serviceRegistration,
Object ao)
Invoked when the Gemini Blueprints/Spring DM proxy releases the module.
|
public ActiveObjectsServiceFactory(@Nonnull ActiveObjectsFactory factory, @Nonnull com.atlassian.event.api.EventPublisher eventPublisher, @Nonnull com.atlassian.tenancy.api.TenantContext tenantContext, @Nonnull com.atlassian.sal.api.executor.ThreadLocalDelegateExecutorFactory threadLocalDelegateExecutorFactory, @Nonnull InitExecutorServiceProvider initExecutorServiceProvider)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic Object getService(org.osgi.framework.Bundle bundle, org.osgi.framework.ServiceRegistration serviceRegistration)
onPluginEnabledEvent(PluginEnabledEvent) to
eagerly initialise the lazy proxies that are not invoked during plugin startup.getService in interface org.osgi.framework.ServiceFactorypublic void ungetService(org.osgi.framework.Bundle bundle,
org.osgi.framework.ServiceRegistration serviceRegistration,
Object ao)
onPluginDisabledEvent(PluginDisabledEvent) to release those references, for plugins that never
realise the module.ungetService in interface org.osgi.framework.ServiceFactorypublic void startCleaning()
public void stopCleaning()
@EventListener public void onTenantArrived(com.atlassian.tenancy.api.event.TenantArrivedEvent event)
TenantArrivedEvent and allows initialisation of any uninitialised instances@EventListener public void onHotRestart(HotRestartEvent hotRestartEvent)
HotRestartEvent and recreate all ActiveObjects instances within the delegates with
the possibly different configuration and data source@EventListener public void onPluginModuleEnabledEvent(com.atlassian.plugin.event.events.PluginModuleEnabledEvent pluginModuleEnabledEvent)
PluginModuleEnabledEvent for ActiveObjectModuleDescriptor.
Passes it to appropriate delegate i.e. the one for which the plugin/bundle key matches.@EventListener public void onPluginEnabledEvent(com.atlassian.plugin.event.events.PluginEnabledEvent pluginEnabledEvent)
PluginEnabledEvent. If the plugin is present in the unattached configurations, it will tickle
aoDelegatesByBundle to ensure that the configuration has been attached to a service, whether it has
been OSGi registered or not.@EventListener public void onPluginDisabledEvent(com.atlassian.plugin.event.events.PluginDisabledEvent pluginDisabledEvent)
PluginDisabledEvent. If the plugin is present in the unattached or attached configurations,
it will be removed to ensure that we don't leak resources and, more importantly, don't retain it if the plugin
is re-enabled.Copyright © 2018 Atlassian. All rights reserved.