Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3425F17611 for ; Wed, 25 Mar 2015 06:54:56 +0000 (UTC) Received: (qmail 66640 invoked by uid 500); 25 Mar 2015 06:54:53 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 66598 invoked by uid 500); 25 Mar 2015 06:54:53 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 66588 invoked by uid 99); 25 Mar 2015 06:54:53 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Mar 2015 06:54:53 +0000 Date: Wed, 25 Mar 2015 06:54:53 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-8537) CamelHazelcast component should create its own HZ instance only if it's not provided MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-8537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14379393#comment-14379393 ] Claus Ibsen commented on CAMEL-8537: ------------------------------------ There is unit test errors due NPE with this patch. Do you mind checking what is the problem and update the PR. > 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 > Fix For: 2.16.0 > > > 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)