You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "metatech (JIRA)" <ji...@apache.org> on 2012/10/02 21:01:08 UTC

[jira] [Comment Edited] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467970#comment-13467970 ] 

metatech edited comment on AMQ-3692 at 10/3/12 5:59 AM:
--------------------------------------------------------

Gary: the "SpringOsgiContextHook" uses Spring DM-specific API, whereas the "BrokerBundleWatcher" only uses generic OSGi API, and is therefore also compatible with Blueprint.  There is one minor modification to "BrokerBundleWatcher" which would be required to be compatible with Spring DM : Blueprint provides a "blueprintBundle" built-in variable, for which I did not find an equivalent for Spring DM.  However, Spring DM provides a "bundleContext" built-in variable (see 6.6. Accessing the BundleContext), from which the "bundle" can easily be obtained with the "getBundle()" method.  A new method "setBundleContext" would need to be added to the class.  The "BrokerBundleWatcher" could then supersede the "SpringOsgiContextHook", I think.
                
      was (Author: metatech):
    Gary: the "SpringOsgiContextHook" uses Spring DM-specific API, where the "BrokerBundleWatcher" only uses generic OSGi API, and is therefore also compatible with Blueprint.  There is one minor modification to "BrokerBundleWatcher" which would be required to be compatible with Spring DM : Blueprint provides a "blueprintBundle" built-in variable, for which I did not find an equivalent for Spring DM.  However, Spring DM provides a "bundleContext" built-in variable (see 6.6. Accessing the BundleContext), from which the "bundle" can easily be obtained with the "getBundle()" method.  A new method "setBundleContext" would need to be added to the class.  The "BrokerBundleWatcher" could then supersede the "SpringOsgiContextHook", I think.
                  
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira