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 67C059E76 for ; Fri, 27 Jan 2012 13:47:44 +0000 (UTC) Received: (qmail 78062 invoked by uid 500); 27 Jan 2012 13:47:44 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 78032 invoked by uid 500); 27 Jan 2012 13:47:44 -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 78025 invoked by uid 99); 27 Jan 2012 13:47:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 13:47:43 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Jan 2012 13:47:41 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 01765166F4E for ; Fri, 27 Jan 2012 13:47:20 +0000 (UTC) Date: Fri, 27 Jan 2012 13:47:20 +0000 (UTC) From: "Claus Ibsen (Commented) (JIRA)" To: issues@camel.apache.org Message-ID: <1745055492.85664.1327672040007.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1909467919.77287.1327516720486.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (CAMEL-4941) doStop() is called on Services which haven't been started when route autoStart=false MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAMEL-4941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13194707#comment-13194707 ] Claus Ibsen commented on CAMEL-4941: ------------------------------------ I have polished the javadoc to explain the behavior of the doStop method. > doStop() is called on Services which haven't been started when route autoStart=false > ------------------------------------------------------------------------------------ > > Key: CAMEL-4941 > URL: https://issues.apache.org/jira/browse/CAMEL-4941 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.9.0 > Reporter: Raul Kripalani > Assignee: Raul Kripalani > Priority: Minor > Fix For: 2.10.0 > > Attachments: ServiceHelperHandleUninitialized.patch > > > While unit testing the new camel-mongodb component, I realised that my consumer's doStop() method is called even if the route had autoStart=false and was never started. > This occurs because when autoStartup=false, and the route has never been started manually, the RouteService's state flags are all false. > During the cascading stopping routine, the ServiceHelper.isStopped() method is used to determine whether a service should be stopped or not. Since this method only checks the stopped and stopping flags, it returns false which indicates to the caller that the service is either started or suspended. > The stop routine will then proceed to call doStop on the service, which is erroneous. > To fix this, I propose to add the following new logic to the ServiceHelper.isStopped() method: > {code:java} > // if none of the flags is true, consider that the service is uninitialized, equating this status to stopped > if (!(service.isStarted() || service.isStarting() || > service.isStopped() || service.isStopping() || > service.isSuspended() || service.isSuspending())) > { > return true; > } > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira