You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "ayache khettar (JIRA)" <ji...@apache.org> on 2015/03/24 13:15:53 UTC

[jira] [Commented] (CAMEL-8537) CamelHazelcast component should create its own HZ instance only if it's not provided

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

ayache khettar commented on CAMEL-8537:
---------------------------------------

Hi 

I have provided a patch fix for this improvement as a form of a pull request:  https://github.com/apache/camel/pull/443. Once happy with the changes, do let me know. I will be happy to update the camel wiki for this component too.

One may disagree with this improvement in relation to referencing a HZ instance by its name, but certainly the component should not create more than one HZ instance. The cluster capability of HZ makes more sense in the world of multiple JVM or VM.

Thanks

Ayache

> CamelHazelcast component should create its own HZ instance only if it's not provided
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-8537
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8537
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-hazelcast
>    Affects Versions: 2.15.0
>            Reporter: ayache khettar
>              Labels: patch
>
> Hi
> Currently Hazelcast component creates its own HZ instance regardless if a reference to a HZ instance is provided or not. So in the case of a reference of HZ instance is provided, the one created by the component does not get shutdown - see below code snippet, doesn't get shutdown. So one end up with multipole instances.
> I believe the component should not create its own instance at the doStart() method. It should first check if a reference to HZ instance is provided, if yes then use it and if not create its own. 
> I have made the changes to reflect the correct behaviour described above. The changes will make sure only one instance of HZ is created. Also, added the ability to reference HZ instance by its name.
> {panel:title=What remains?|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
> * Update the wiki to show how to reference HZ by its name
> * Update the wiki to show the newly introduced parameter (hazelcastInstanceName)
> * Update the wiki to ideally show an example of how to publish HZ instance as an OSGI service for reuse by multiple bundles.
> {panel}
> {panel:title=Changes made|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#FFFFCE}
> * No longer the component creates its own HZ instance in doStart() method.
> * When the component is initialised, only one instance is either been created or use the referenced on in the endpoint.
> * Ability to reference HZ instance by its name. This will serve the use case whereby the hazelcast cluster is running remotely or not part of the camel context.
> {panel}
> {code:title=HazelcastComponent.java|borderStyle=solid}
>  @Override
>     public void doStart() throws Exception {
>         super.doStart();
>         if (hazelcastInstance == null) {
>             createOwnInstance = true;
>             hazelcastInstance = createOwnInstance();
>         }
>     }
> {code}
> I have created a pull request for this, details can be seen here: https://github.com/apache/camel/pull/443



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)